This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Remove default for stripped
option, don't strip by default on android
#52852
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Picking this back up. Need to figure out why AGP doesn't strip the resultant appbundle properly when the NDK version isn't downloaded. |
9 tasks
github-merge-queue bot
pushed a commit
to flutter/flutter
that referenced
this pull request
Dec 12, 2024
In preparation for changing engine builds to be unstripped by default flutter/engine#52852, which will allow us to make progress towards resolving #60240. Tricks AGP in to downloading the NDK when building a flutter app (that uses the FGP, which to my knowledge is all ways of building flutter apk/aab/aar). I want to follow this up by modifying the tool to search for the log line that the NDK is missing (making it throw an error in that case) as a safeguard, because that would be the last line of defense before we accidentally build a bloated app. The safeguard won't work for add to app, from what I understand, because while they use the FGP (so they should be forced to be download the NDK) they don't invoke the flutter tool, and therefore won't invoke the custom error handling of [`gradle_errors.dart`](https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle_errors.dart) Some details 1. Respects existing values for `externalNativeBuild.cmake.path` for apps that actually use it. 2. Silences some warnings that would otherwise appear for add to app builds or builds that manually invoke gradle: ``` C/C++: CMake Warning (dev) in CMakeLists.txt: C/C++: No project() command is present. The top-level CMakeLists.txt file must C/C++: contain a literal, direct call to the project() command. Add a line of C/C++: code such as C/C++: project(ProjectName) C/C++: near the top of the file, but after cmake_minimum_required(). C/C++: CMake is pretending there is a "project(Project)" command on the first C/C++: line. C/C++: This warning is for project developers. Use -Wno-dev to suppress it. C/C++: CMake Warning: C/C++: Manually-specified variables were not used by the project: C/C++: CMAKE_EXPORT_COMPILE_COMMANDS C/C++: CMAKE_LIBRARY_OUTPUT_DIRECTORY C/C++: CMAKE_RUNTIME_OUTPUT_DIRECTORY ``` 3. Our ci installs the NDK at an abnormal place that AGP can't find without help. I've modified all the `build.gradle`s that we have checked in to point to the pre-installed path. **But some of our tests make a new app from the templates, and those tests will now start downloading the NDK** (as they won't be able to find it at it's current path from templates). We could resolve this by actually fixing #136666. This would be a very significant lift from what I understand - we rely on this hardcoding in a lot of places in our infra. Fixes #155576 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Gray Mackall <[email protected]>
Merged
9 tasks
github-merge-queue bot
pushed a commit
to flutter/flutter
that referenced
this pull request
Dec 12, 2024
)" (#160205) <!-- start_original_pr_link --> Reverts: #159756 <!-- end_original_pr_link --> <!-- start_initiating_author --> Initiated by: gmackall <!-- end_initiating_author --> <!-- start_revert_reason --> Reason for reverting: Made the tree red due to some std out. <!-- end_revert_reason --> <!-- start_original_pr_author --> Original PR Author: gmackall <!-- end_original_pr_author --> <!-- start_reviewers --> Reviewed By: {reidbaker} <!-- end_reviewers --> <!-- start_revert_body --> This change reverts the following previous change: In preparation for changing engine builds to be unstripped by default flutter/engine#52852, which will allow us to make progress towards resolving #60240. Tricks AGP in to downloading the NDK when building a flutter app (that uses the FGP, which to my knowledge is all ways of building flutter apk/aab/aar). I want to follow this up by modifying the tool to search for the log line that the NDK is missing (making it throw an error in that case) as a safeguard, because that would be the last line of defense before we accidentally build a bloated app. The safeguard won't work for add to app, from what I understand, because while they use the FGP (so they should be forced to be download the NDK) they don't invoke the flutter tool, and therefore won't invoke the custom error handling of [`gradle_errors.dart`](https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle_errors.dart) Some details 1. Respects existing values for `externalNativeBuild.cmake.path` for apps that actually use it. 2. Silences some warnings that would otherwise appear for add to app builds or builds that manually invoke gradle: ``` C/C++: CMake Warning (dev) in CMakeLists.txt: C/C++: No project() command is present. The top-level CMakeLists.txt file must C/C++: contain a literal, direct call to the project() command. Add a line of C/C++: code such as C/C++: project(ProjectName) C/C++: near the top of the file, but after cmake_minimum_required(). C/C++: CMake is pretending there is a "project(Project)" command on the first C/C++: line. C/C++: This warning is for project developers. Use -Wno-dev to suppress it. C/C++: CMake Warning: C/C++: Manually-specified variables were not used by the project: C/C++: CMAKE_EXPORT_COMPILE_COMMANDS C/C++: CMAKE_LIBRARY_OUTPUT_DIRECTORY C/C++: CMAKE_RUNTIME_OUTPUT_DIRECTORY ``` 3. Our ci installs the NDK at an abnormal place that AGP can't find without help. I've modified all the `build.gradle`s that we have checked in to point to the pre-installed path. **But some of our tests make a new app from the templates, and those tests will now start downloading the NDK** (as they won't be able to find it at it's current path from templates). We could resolve this by actually fixing #136666. This would be a very significant lift from what I understand - we rely on this hardcoding in a lot of places in our infra. Fixes #155576 ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md <!-- end_revert_body --> Co-authored-by: auto-submit[bot] <[email protected]>
@gmackall post-monorepo can you recreate this in the framework and close this engine PR (especially since you landed the ndk download)? |
9 tasks
github-merge-queue bot
pushed a commit
to flutter/flutter
that referenced
this pull request
Feb 3, 2025
…don't strip by default on android (#161546) Remake of flutter/engine#52852. Makes it so that `stripped` defaults to false for android in `gn` arguments, i.e. we don't strip the Android engine builds. AGP does this by default when the NDK is installed (and we download it automatically now after #159756). In testing, the step that AGP does to strip symbols adds ~1-2 seconds to the build. Adds a tool verification for release app bundle builds that checks to make sure we have stripped the debug symbols and placed them in the [`BUNDLE-METADATA` directory](https://developer.android.com/guide/app-bundle/app-bundle-format). The check is done by invoking `apkanalyzer`, which takes ~`0.5` seconds, which is why the check is only enabled for release builds. BEFORE LANDING: I need to follow up on flutter/engine#50443 (comment), to ensure we start stripping symbols internally as well. ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md --------- Co-authored-by: Gray Mackall <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is round 3, after #50443 and #51394. I think this is finally the right place to make the change, if this gn actually works.
Always respect the
stripped
argument if it is passed, but otherwise default to not stripping on android, and stripping on other platforms.Still need to do some testing before landing, but making the PR so that this stays on my radar
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.