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

Reland #39157 #39798

Merged
merged 15 commits into from Sep 17, 2019
Merged

Reland #39157 #39798

merged 15 commits into from Sep 17, 2019

Conversation

blasten
Copy link

@blasten blasten commented Sep 4, 2019

I reverted the commits that enabled proguard since #39986 already enabled Proguard.

The APK size increase (examples/hello_world): 5.81KB

@fluttergithubbot fluttergithubbot added d: examples Sample code and demos team Infra upgrades, team productivity, code health, technical debt. See also team: labels. tool Affects the "flutter" command-line tool. See also t: labels. labels Sep 4, 2019
@blasten
Copy link
Author

blasten commented Sep 4, 2019

The tool generates a .java file that passes the fully qualified name of the plugin's main class to the registry: https://github.com/flutter/engine/blob/0a0f3305b5f086b3a413c5156bce810e1d6f4a32/shell/platform/android/io/flutter/plugin/common/PluginRegistry.java#L34

@codecov
Copy link

codecov bot commented Sep 4, 2019

Codecov Report

Merging #39798 into master will increase coverage by 1.29%.
The diff coverage is 82.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #39798      +/-   ##
==========================================
+ Coverage   56.64%   57.93%   +1.29%     
==========================================
  Files         194      194              
  Lines       18691    18729      +38     
==========================================
+ Hits        10587    10851     +264     
+ Misses       8104     7878     -226
Flag Coverage Δ
#flutter_tool 57.93% <82.35%> (+1.29%) ⬆️
Impacted Files Coverage Δ
...ackages/flutter_tools/lib/src/commands/doctor.dart 64.28% <ø> (ø) ⬆️
.../flutter_tools/lib/src/runner/flutter_command.dart 80.7% <ø> (ø) ⬆️
...ages/flutter_tools/lib/src/commands/build_apk.dart 100% <ø> (ø) ⬆️
...ages/flutter_tools/lib/src/commands/build_aar.dart 93.33% <ø> (-0.22%) ⬇️
...kages/flutter_tools/lib/src/commands/precache.dart 93.1% <100%> (+1.43%) ⬆️
packages/flutter_tools/lib/executable.dart 92.85% <100%> (ø) ⬆️
...ckages/flutter_tools/lib/src/commands/upgrade.dart 43.82% <100%> (+9.33%) ⬆️
packages/flutter_tools/lib/src/android/gradle.dart 62.39% <62.5%> (ø) ⬆️
packages/flutter_tools/lib/src/cache.dart 45.43% <82.35%> (+1.2%) ⬆️
packages/flutter_tools/lib/src/version.dart 90.9% <0%> (-1.92%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 72cacb4...de2e98b. Read the comment docs.

@codecov
Copy link

codecov bot commented Sep 4, 2019

Codecov Report

Merging #39798 into master will increase coverage by 0.33%.
The diff coverage is 84.52%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #39798      +/-   ##
==========================================
+ Coverage   59.56%   59.89%   +0.33%     
==========================================
  Files         192      192              
  Lines       18705    18742      +37     
==========================================
+ Hits        11141    11226      +85     
+ Misses       7564     7516      -48
Flag Coverage Δ
#flutter_tool 59.89% <84.52%> (+0.33%) ⬆️
Impacted Files Coverage Δ
...ackages/flutter_tools/lib/src/commands/doctor.dart 64.28% <ø> (ø) ⬆️
.../flutter_tools/lib/src/runner/flutter_command.dart 81.54% <ø> (+3%) ⬆️
...ages/flutter_tools/lib/src/commands/build_apk.dart 100% <ø> (ø) ⬆️
...ages/flutter_tools/lib/src/commands/build_aar.dart 93.33% <ø> (-0.22%) ⬇️
...ckages/flutter_tools/lib/src/commands/upgrade.dart 43.47% <100%> (+9.03%) ⬆️
...kages/flutter_tools/lib/src/commands/precache.dart 93.1% <100%> (+1.43%) ⬆️
packages/flutter_tools/lib/executable.dart 92.85% <100%> (ø) ⬆️
packages/flutter_tools/lib/src/cache.dart 45.31% <82.08%> (+1.08%) ⬆️
packages/flutter_tools/lib/src/android/gradle.dart 75.14% <87.5%> (ø) ⬆️
...utter_tools/lib/src/build_runner/build_script.dart 16.19% <0%> (-3.81%) ⬇️
... and 8 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0df1594...a6589db. Read the comment docs.

@@ -51,6 +51,9 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Copy link
Contributor

Choose a reason for hiding this comment

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

What would be the difference between adding proguard-android.txt instead of proguard-android-optimize.txt?

Copy link
Author

Choose a reason for hiding this comment

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

It looks like proguard-android-optimize.txt turns on optimizations that could cause issues on some versions of Dalvik.

https://android.googlesource.com/platform/sdk/+/master/files/proguard-android-optimize.txt#4

@zanderso
Copy link
Member

zanderso commented Sep 4, 2019

The docs indicate that build times may be affected. I wonder if @chinmaygarde or @cbracken have any of the context here.

@blasten

This comment has been minimized.

@Hixie
Copy link
Contributor

Hixie commented Sep 4, 2019

So this makes things worse by 153,180 bytes. That seems like a lot.

@Hixie
Copy link
Contributor

Hixie commented Sep 4, 2019

Release mode build times being affected is a non-issue so long as they don't become an order of magnitude slower.

@@ -45,6 +45,9 @@ android {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there some way we can do this that doesn't involve developers having to edit their build.grade files?

Copy link
Author

Choose a reason for hiding this comment

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

We could configure the setting from the Flutter plugin, so developers don't have to set this up. However, we do need to provide a way to edit the proguard rules in the file proguard-rules.pro, in case a plugin needs special rules.

@blasten
Copy link
Author

blasten commented Sep 4, 2019

I broke down the dependencies by size:

Dependency Size (in bytes)
com.android.support:support-fragment 66,550
com.android.support:support-v13 47,818
android.arch.lifecycle:runtime 4,793
android.arch.lifecycle:common-java8 128

@Hixie if you think this is a non-starter, then the next option is separating the embedding into two dependencies such that the full app APK doesn't include support-fragment and support-v13. Doing so would bring the size down to 4.3MB (4,558,819).

@blasten

This comment has been minimized.

@blasten
Copy link
Author

blasten commented Sep 11, 2019

The APK size will increase by just 5.81KB, which makes sense since that is the size of lifecycles according to this table: #39798 (comment) cc @xster

@blasten
Copy link
Author

blasten commented Sep 11, 2019

PTAL

@xster
Copy link
Member

xster commented Sep 11, 2019

It was a bit hard to figure out the context since there was a master merge in the middle of the commits but I'm assuming I'm just reviewing bdd27ea...blasten:e38a9a5b3d034862d1448b95f792a619f283c8bc and 7e95146...blasten:reland_maven_deps (done since you merged proguard enable separately) on top of the revert of your previous revert?

If so LGTM. wrt size, we discussed offline and 5.8kb seems reasonable since the current APIs straight up don't implement large swaths of plugin functionalities that iOS implements https://github.com/flutter/engine/blob/c58c5939e95f8d0232e60d0db9f00bc510caec99/shell/platform/darwin/ios/framework/Headers/FlutterPlugin.h#L49. So whether we wrote bridging code ourselves or pulled in a dependency, 5.8kb seems like the right ballpark.

@zanderso
Copy link
Member

What was the reason for the revert? Can you note what, if any, fixes were added for the re-land?

@blasten
Copy link
Author

blasten commented Sep 11, 2019

@zanderso 👍I just updated the description.

@blasten blasten merged commit 8a1bf5b into flutter:master Sep 17, 2019
@blasten blasten deleted the reland_maven_deps branch September 17, 2019 15:19
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Sep 30, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
d: examples Sample code and demos team Infra upgrades, team productivity, code health, technical debt. See also team: labels. tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants