Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Fix warning from pack symbols of android_clang_* dir #26587

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexeyBarabash
Copy link
Contributor

This PR suppresses the warning from pack symbols script.

Resolves brave/brave-browser#42317

Submitter Checklist:

  • I confirm that no security/privacy review is needed and no other type of reviews are needed, or that I have requested them
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

  1. run npm run create_dist -- Release --target_os=android --target_arch=arm --target_android_base=mono --target_android_output_format=aab
  2. ensure there are no warnings like
tar: android_clang_*/*.so: Warning: Cannot stat: No such file or directory
tar: android_clang_*/lib.unstripped: Warning: Cannot stat: No such file or directory

Copy link
Member

@SergeyZhukovsky SergeyZhukovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

set -euo pipefail

mkdir -p dist
tar -czvf $1 --ignore-failed-read *.so apks android_clang_*/*.so android_clang_*/lib.unstripped lib.unstripped android_chrome_versions.txt
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're using bash here, you could keep the script as is and just add shopt -s nullglob before this line (and drop the --ignore-failed-read).

Example:

$ ls
foo.txt
$ echo *.txt *.sh
foo.txt *.sh
$ shopt -s nullglob
$ echo *.txt *.sh
foo.txt
$

If you don't want to use nullglob for some reason, an alternative would be to put the existing files in an array and then pass that to tar:

files=(apks lib.unstripped android_chrome_versions.txt)
for f in *.so android_clang_*/*.so android_clang_*/lib.unstripped; do
    [[ ! -e "$f" ]] || files+=("$f")
done
tar -czvf "${1:?}" "${files[@]}"

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at https://mozilla.org/MPL/2.0/.

set -euo pipefail

mkdir -p dist
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here? I don't see any reference to this directory in the script. If this is used elsewhere, then maybe the directory should also be created elsewhere.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest always running shell scripts through shellcheck and fixing any findings

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if there's a way to know which files are expected to exist and which aren't (e.g. based on the architecture, or something), then it would be better to pass that information to the script and avoid situations where some files don't exist and it's ignored. That's unnecessarily loose and could end up causing problems down the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] Warning from pack symbols for android_clang_* dir
3 participants