diff options
author | 2019-04-20 06:17:14 +0000 | |
---|---|---|
committer | 2019-04-20 06:17:14 +0000 | |
commit | 36ab727c824f6e1a375a22ffe1a7b36c3620fca0 (patch) | |
tree | 53aa4c454b247c5dc960abbb46c91bdbb32c0c7b /java/java.go | |
parent | 3ed757ab3a32958e6d780fab5d26506bd5520268 (diff) | |
parent | 2057f82161dec05cb23535da713ec0fae44c38d1 (diff) |
Merge "Fix handling optimize.enabled from java_defaults"
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/java/java.go b/java/java.go index 7768756ec..2cf9267fb 100644 --- a/java/java.go +++ b/java/java.go @@ -228,6 +228,8 @@ type CompilerDeviceProperties struct { // If false, disable all optimization. Defaults to true for android_app and android_test // modules, false for java_library and java_test modules. Enabled *bool + // True if the module containing this has it set by default. + EnabledByDefault bool `blueprint:"mutated"` // If true, optimize for size by removing unused code. Defaults to true for apps, // false for libraries and tests. @@ -257,6 +259,10 @@ type CompilerDeviceProperties struct { IsSDKLibrary bool `blueprint:"mutated"` } +func (me *CompilerDeviceProperties) EffectiveOptimizeEnabled() bool { + return BoolDefault(me.Optimize.Enabled, me.Optimize.EnabledByDefault) +} + // Module contains the properties and members used by all java module types type Module struct { android.ModuleBase @@ -460,7 +466,7 @@ func (j *Module) deps(ctx android.BottomUpMutatorContext) { } else if sdkDep.useModule { ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules) ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.modules...) - if Bool(j.deviceProperties.Optimize.Enabled) { + if j.deviceProperties.EffectiveOptimizeEnabled() { ctx.AddVariationDependencies(nil, proguardRaiseTag, config.DefaultBootclasspathLibraries...) ctx.AddVariationDependencies(nil, proguardRaiseTag, config.DefaultLibraries...) } |