Merge "Add support for building with R8 full mode" am: b900066dab
am: f84b6b4f89
am: 4198dc431f
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1408707 Change-Id: I595584aff7805332c4c1fb279e25ee2af89fd5cd
This commit is contained in:
@@ -38,6 +38,10 @@ type DexProperties struct {
|
|||||||
// True if the module containing this has it set by default.
|
// True if the module containing this has it set by default.
|
||||||
EnabledByDefault bool `blueprint:"mutated"`
|
EnabledByDefault bool `blueprint:"mutated"`
|
||||||
|
|
||||||
|
// If true, runs R8 in Proguard compatibility mode (default).
|
||||||
|
// Otherwise, runs R8 in full mode.
|
||||||
|
Proguard_compatibility *bool
|
||||||
|
|
||||||
// If true, optimize for size by removing unused code. Defaults to true for apps,
|
// If true, optimize for size by removing unused code. Defaults to true for apps,
|
||||||
// false for libraries and tests.
|
// false for libraries and tests.
|
||||||
Shrink *bool
|
Shrink *bool
|
||||||
@@ -113,7 +117,6 @@ var r8, r8RE = remoteexec.MultiCommandStaticRules(pctx, "r8",
|
|||||||
`rm -f "$outDict" && rm -rf "${outUsageDir}" && ` +
|
`rm -f "$outDict" && rm -rf "${outUsageDir}" && ` +
|
||||||
`mkdir -p $$(dirname ${outUsage}) && ` +
|
`mkdir -p $$(dirname ${outUsage}) && ` +
|
||||||
`$r8Template${config.R8Cmd} ${config.DexFlags} -injars $in --output $outDir ` +
|
`$r8Template${config.R8Cmd} ${config.DexFlags} -injars $in --output $outDir ` +
|
||||||
`--force-proguard-compatibility ` +
|
|
||||||
`--no-data-resources ` +
|
`--no-data-resources ` +
|
||||||
`-printmapping ${outDict} ` +
|
`-printmapping ${outDict} ` +
|
||||||
`-printusage ${outUsage} ` +
|
`-printusage ${outUsage} ` +
|
||||||
@@ -230,6 +233,10 @@ func (d *dexer) r8Flags(ctx android.ModuleContext, flags javaBuilderFlags) (r8Fl
|
|||||||
|
|
||||||
r8Flags = append(r8Flags, opt.Proguard_flags...)
|
r8Flags = append(r8Flags, opt.Proguard_flags...)
|
||||||
|
|
||||||
|
if BoolDefault(opt.Proguard_compatibility, true) {
|
||||||
|
r8Flags = append(r8Flags, "--force-proguard-compatibility")
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(ccross): Don't shrink app instrumentation tests by default.
|
// TODO(ccross): Don't shrink app instrumentation tests by default.
|
||||||
if !Bool(opt.Shrink) {
|
if !Bool(opt.Shrink) {
|
||||||
r8Flags = append(r8Flags, "-dontshrink")
|
r8Flags = append(r8Flags, "-dontshrink")
|
||||||
|
Reference in New Issue
Block a user