Merge "Don't run resource shrinking for eng builds" into main am: c3e6594a0d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3075498 Change-Id: If110eeba2d32202c0a5f90af28172931547f1ba9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -538,7 +538,7 @@ func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use non final ids if we are doing optimized shrinking and are using R8.
|
// Use non final ids if we are doing optimized shrinking and are using R8.
|
||||||
nonFinalIds := Bool(a.dexProperties.Optimize.Optimized_shrink_resources) && a.dexer.effectiveOptimizeEnabled()
|
nonFinalIds := a.dexProperties.optimizedResourceShrinkingEnabled(ctx) && a.dexer.effectiveOptimizeEnabled()
|
||||||
a.aapt.buildActions(ctx,
|
a.aapt.buildActions(ctx,
|
||||||
aaptBuildActionOptions{
|
aaptBuildActionOptions{
|
||||||
sdkContext: android.SdkContext(a),
|
sdkContext: android.SdkContext(a),
|
||||||
@@ -569,7 +569,7 @@ func (a *AndroidApp) proguardBuildActions(ctx android.ModuleContext) {
|
|||||||
staticLibProguardFlagFiles = android.FirstUniquePaths(staticLibProguardFlagFiles)
|
staticLibProguardFlagFiles = android.FirstUniquePaths(staticLibProguardFlagFiles)
|
||||||
|
|
||||||
a.Module.extraProguardFlagsFiles = append(a.Module.extraProguardFlagsFiles, staticLibProguardFlagFiles...)
|
a.Module.extraProguardFlagsFiles = append(a.Module.extraProguardFlagsFiles, staticLibProguardFlagFiles...)
|
||||||
if !Bool(a.dexProperties.Optimize.Optimized_shrink_resources) {
|
if !(a.dexProperties.optimizedResourceShrinkingEnabled(ctx)) {
|
||||||
// When using the optimized shrinking the R8 enqueuer will traverse the xml files that become
|
// When using the optimized shrinking the R8 enqueuer will traverse the xml files that become
|
||||||
// live for code references and (transitively) mark these as live.
|
// live for code references and (transitively) mark these as live.
|
||||||
// In this case we explicitly don't wan't the aapt2 generated keep files (which would keep the now
|
// In this case we explicitly don't wan't the aapt2 generated keep files (which would keep the now
|
||||||
@@ -608,7 +608,7 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) (android.Path, a
|
|||||||
var packageResources = a.exportPackage
|
var packageResources = a.exportPackage
|
||||||
|
|
||||||
if ctx.ModuleName() != "framework-res" {
|
if ctx.ModuleName() != "framework-res" {
|
||||||
if a.dexProperties.resourceShrinkingEnabled() {
|
if a.dexProperties.resourceShrinkingEnabled(ctx) {
|
||||||
protoFile := android.PathForModuleOut(ctx, packageResources.Base()+".proto.apk")
|
protoFile := android.PathForModuleOut(ctx, packageResources.Base()+".proto.apk")
|
||||||
aapt2Convert(ctx, protoFile, packageResources, "proto")
|
aapt2Convert(ctx, protoFile, packageResources, "proto")
|
||||||
a.dexer.resourcesInput = android.OptionalPathForPath(protoFile)
|
a.dexer.resourcesInput = android.OptionalPathForPath(protoFile)
|
||||||
@@ -631,7 +631,7 @@ func (a *AndroidApp) dexBuildActions(ctx android.ModuleContext) (android.Path, a
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.Module.compile(ctx, extraSrcJars, extraClasspathJars, extraCombinedJars)
|
a.Module.compile(ctx, extraSrcJars, extraClasspathJars, extraCombinedJars)
|
||||||
if a.dexProperties.resourceShrinkingEnabled() {
|
if a.dexProperties.resourceShrinkingEnabled(ctx) {
|
||||||
binaryResources := android.PathForModuleOut(ctx, packageResources.Base()+".binary.out.apk")
|
binaryResources := android.PathForModuleOut(ctx, packageResources.Base()+".binary.out.apk")
|
||||||
aapt2Convert(ctx, binaryResources, a.dexer.resourcesOutput.Path(), "binary")
|
aapt2Convert(ctx, binaryResources, a.dexer.resourcesOutput.Path(), "binary")
|
||||||
packageResources = binaryResources
|
packageResources = binaryResources
|
||||||
|
@@ -111,8 +111,12 @@ func (d *dexer) effectiveOptimizeEnabled() bool {
|
|||||||
return BoolDefault(d.dexProperties.Optimize.Enabled, d.dexProperties.Optimize.EnabledByDefault)
|
return BoolDefault(d.dexProperties.Optimize.Enabled, d.dexProperties.Optimize.EnabledByDefault)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DexProperties) resourceShrinkingEnabled() bool {
|
func (d *DexProperties) resourceShrinkingEnabled(ctx android.ModuleContext) bool {
|
||||||
return BoolDefault(d.Optimize.Optimized_shrink_resources, Bool(d.Optimize.Shrink_resources))
|
return !ctx.Config().Eng() && BoolDefault(d.Optimize.Optimized_shrink_resources, Bool(d.Optimize.Shrink_resources))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DexProperties) optimizedResourceShrinkingEnabled(ctx android.ModuleContext) bool {
|
||||||
|
return d.resourceShrinkingEnabled(ctx) && Bool(d.Optimize.Optimized_shrink_resources)
|
||||||
}
|
}
|
||||||
|
|
||||||
var d8, d8RE = pctx.MultiCommandRemoteStaticRules("d8",
|
var d8, d8RE = pctx.MultiCommandRemoteStaticRules("d8",
|
||||||
|
Reference in New Issue
Block a user