New issue
Advanced search Search tips

Issue 883166 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 917458
Owner:
Closed: Dec 21
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Bug



Sign in to add a comment

Use d8's built-in --main-dex-list rather than a separate proguard-based build step

Project Member Reported by agrieve@chromium.org, Sep 12

Issue description

Motivation: Faster builds.

r8 is a superset of d8, and has support for MainDexList builder via --main-dex-rules. 

We should delete main_dex_list.py in favor of using this r8 feature.

The main trick (I think) is that we'll need to implement the main dex list assertions by adding -checkdiscard directives to the --main-dex-rules rather than inspecting the main dex list output. This is because we want to assert what is kept by the proguard rules, but not what is kept as part of the classes included for dex verification purposes.
 
Cc: r8-team@google.com
From sgjesse@google.com:

* If R8 is not passed a Proguard configuration, then a keep-all default set of rules will be implicitly added. This should turn off optimization, shrinking and renaming (obfuscation) of the whole application, so passing --no-minification and --no-tree-shaking should not even be required.

* You should pass the --debug flag. This will enable additional debug handling including minimal main dex (what goes into the main dex is only what is specified by the main dex rules) and outlining.

So for an R8 whole program debug build this command line should be sufficient:

  java -jar r8.jar --debug --main-dex-rules <file> ...

If it turns out you need any of --no-minification, --no-tree-shaking or --no-desugaring please let me know.

Also please note that if you add a Proguard configuration with any option (e.g. just with -dontwarn), then the default keep-all handling is disabled. An explicit configuration like the following should match the default keep-all processing:

-keep class ** { *; }
-keepattributes *
-dontoptimize
-dontshrink
-dontobfuscate
For R8 simultaneously optimizing and dexing, we will still want to support multidex (for multidex_in_release). This will have to be a different build path than Comment #1 (which does optimize -> multi dex list -> dex), since we will need to do all 3 in one shot.

R8 does support all 3 at once, but since we don't use multidex_in_release, it isn't a huge priority to implement right now.
Mergedinto: 917458
Status: Duplicate (was: Assigned)

Sign in to add a comment