Skip to content

Conversation

@gmackall
Copy link
Member

@gmackall gmackall commented Aug 21, 2024

Re-lands #136880, fixes #136879.

Additions to/things that are different from the original PR:

Also, unrelatedly:

  • Deletes an entry in gradle_errors.dart that informed people to build with --no-shrink. This flag doesn't do anything, so it can't be the solution to any error.
  • Uniquely lowers the priority of the incompatibleKotlinVersionHandler. This is necessary because the ordering of the errors doesn't fully determine the priority of which handler we decide to use, but also the order of the log lines. The kotlin error lines often print before the other error lines, so putting it last in the list of handlers isn't sufficient to lower it to be the lowest priority handler.

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Aug 21, 2024
@gmackall gmackall changed the title Reland mkustermann optimize Re-land "Ensure flutter build apk --release optimizes+shrinks platform code" Aug 21, 2024
@gmackall gmackall marked this pull request as ready for review August 21, 2024 20:58
@gmackall gmackall requested review from a team and mkustermann August 21, 2024 20:58
Copy link
Member

@mkustermann mkustermann left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for working on this, @gmackall !



String _getAgpLocation(FlutterProject project) {
return ' The version of AGP that your project uses is likely'
Copy link
Member

Choose a reason for hiding this comment

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

nit: You could consider multi-line strings:

return '''
The version of AGP that your project uses is likely
${project.android.settingsGradleFile.path}
in the 'plugins' closure.
Alternatively, ...
''';

(also other places)

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to multi line strings


@visibleForTesting
final GradleHandledError r8DexingBugInAgp73Handler = GradleHandledError(
test: (String line) => line.contains('com.android.tools.r8.internal.Y10: Unused argument with users'),
Copy link
Member

Choose a reason for hiding this comment

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

You may not want to match Y10 as that identifier could be different between minor versions of R8 (it's very likely a obfuscated class name)

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to just test for the parts around it

@gmackall gmackall requested a review from mkustermann August 22, 2024 20:40
@gmackall
Copy link
Member Author

Updated for review, and to make sure that incompatibleKotlinVersionHandler never overrides another handler.

Summary of why this is necessary is that we test each log line as it comes in, and the lines that trigger incompatibleKotlinVersionHandler come before most others. So putting it last in the list of handlers doesn't work. In fact, the order of the list will almost never matter.

Priority of handlers is determined by order of log lines, with only ties being broken by the order of the list of handlers.

Copy link
Member

@mkustermann mkustermann left a comment

Choose a reason for hiding this comment

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

Still LGTM

@gmackall gmackall added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 23, 2024
@auto-submit auto-submit bot merged commit b2de4df into flutter:master Aug 23, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 30, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 1, 2024
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
…m code" (flutter#153868)

Re-lands flutter#136880, fixes flutter#136879.

Additions to/things that are different from the original PR:
- Adds an entry to `gradle_errors.dart` that tells people when they run into the R8 bug because of using AGP 7.3.0 (https://issuetracker.google.com/issues/242308990).
- Previous PR moved templates off of AGP 7.3.0.
- Packages repo has been moved off AGP 7.3.0 (flutter/packages#7432).

Also, unrelatedly:
- Deletes an entry in `gradle_errors.dart` that informed people to build with `--no-shrink`. This flag [doesn't do anything](flutter/website#11022 (comment)), so it can't be the solution to any error.
- Uniquely lowers the priority of the `incompatibleKotlinVersionHandler`. This is necessary because the ordering of the errors doesn't fully determine the priority of which handler we decide to use, but also the order of the log lines. The kotlin error lines often print before the other error lines, so putting it last in the list of handlers isn't sufficient to lower it to be the lowest priority handler.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 3, 2024
@zanderso
Copy link
Member

zanderso commented Sep 3, 2024

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 3, 2024
@reidbaker
Copy link
Contributor

We expect an increase in build time when it comes to optimizing code size. The benefits and costs grow as the size/complexity of your code grows.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flutter release builds (via flutter build apk --release) aren't optimized

4 participants