diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/app.go | 9 | ||||
-rw-r--r-- | java/app_import.go | 2 | ||||
-rw-r--r-- | java/app_set.go | 7 | ||||
-rw-r--r-- | java/base.go | 4 | ||||
-rw-r--r-- | java/dex.go | 12 | ||||
-rw-r--r-- | java/dex_test.go | 2 | ||||
-rw-r--r-- | java/java.go | 6 | ||||
-rw-r--r-- | java/jdeps.go | 2 | ||||
-rw-r--r-- | java/lint.go | 2 | ||||
-rw-r--r-- | java/platform_compat_config.go | 2 |
10 files changed, 26 insertions, 22 deletions
diff --git a/java/app.go b/java/app.go index 560129b64..05b4a9664 100644 --- a/java/app.go +++ b/java/app.go @@ -82,6 +82,7 @@ type AppInfo struct { Certificate Certificate PrivAppAllowlist android.OptionalPath OverriddenManifestPackageName *string + ApkCertsFile android.Path } var AppInfoProvider = blueprint.NewProvider[*AppInfo]() @@ -691,7 +692,7 @@ func (a *AndroidApp) aaptBuildActions(ctx android.ModuleContext) { } // Use non final ids if we are doing optimized shrinking and are using R8. - nonFinalIds := a.dexProperties.optimizedResourceShrinkingEnabled(ctx) && a.dexer.effectiveOptimizeEnabled() + nonFinalIds := a.dexProperties.optimizedResourceShrinkingEnabled(ctx) && a.dexer.effectiveOptimizeEnabled(ctx) aconfigTextFilePaths := getAconfigFilePaths(ctx) @@ -1233,7 +1234,7 @@ func collectJniDeps(ctx android.ModuleContext, seenModulePaths := make(map[string]bool) ctx.WalkDepsProxy(func(module, parent android.ModuleProxy) bool { - if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled { + if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled { return false } otherName := ctx.OtherModuleName(module) @@ -1253,7 +1254,7 @@ func collectJniDeps(ctx android.ModuleContext, } seenModulePaths[path.String()] = true - commonInfo := android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider) + commonInfo := android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider) if checkNativeSdkVersion && commonInfo.SdkVersion == "" { ctx.PropertyErrorf("jni_libs", "JNI dependency %q uses platform APIs, but this module does not", otherName) @@ -1316,7 +1317,7 @@ func (a *AndroidApp) buildAppDependencyInfo(ctx android.ModuleContext) { // Skip dependencies that are only available to APEXes; they are developed with updatability // in mind and don't need manual approval. - if android.OtherModuleProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform { + if android.OtherModulePointerProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform { return true } diff --git a/java/app_import.go b/java/app_import.go index c0e8171d5..9fb13ba3c 100644 --- a/java/app_import.go +++ b/java/app_import.go @@ -338,7 +338,7 @@ func (a *AndroidAppImport) stripEmbeddedJniLibsUnusedArch( for _, target := range ctx.MultiTargets() { supported_abis := target.Arch.Abi for _, arch := range supported_abis { - wantedJniLibSlice = append(wantedJniLibSlice, " -X lib/"+arch+"/*.so") + wantedJniLibSlice = append(wantedJniLibSlice, " -X 'lib/"+arch+"/*.so'") } } wantedJniLibString := strings.Join(wantedJniLibSlice, " ") diff --git a/java/app_set.go b/java/app_set.go index 2e9d31410..6a2c678a8 100644 --- a/java/app_set.go +++ b/java/app_set.go @@ -193,9 +193,10 @@ func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext) ) android.SetProvider(ctx, AppInfoProvider, &AppInfo{ - AppSet: true, - Privileged: as.Privileged(), - OutputFile: as.OutputFile(), + AppSet: true, + Privileged: as.Privileged(), + OutputFile: as.OutputFile(), + ApkCertsFile: as.apkcertsFile, }) } diff --git a/java/base.go b/java/base.go index 8453a683b..8aa0109d0 100644 --- a/java/base.go +++ b/java/base.go @@ -629,7 +629,7 @@ func CheckStableSdkVersion(ctx android.BaseModuleContext, module android.ModuleP return nil } if info.SdkVersion.Kind == android.SdkCorePlatform { - if useLegacyCorePlatformApi(ctx, android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).BaseModuleName) { + if useLegacyCorePlatformApi(ctx, android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).BaseModuleName) { return fmt.Errorf("non stable SDK %v - uses legacy core platform", info.SdkVersion) } else { // Treat stable core platform as stable. @@ -1816,7 +1816,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath classesJar: outputFile, jarName: jarName, } - if j.GetProfileGuided(ctx) && j.optimizeOrObfuscateEnabled() && !j.EnableProfileRewriting(ctx) { + if j.GetProfileGuided(ctx) && j.optimizeOrObfuscateEnabled(ctx) && !j.EnableProfileRewriting(ctx) { ctx.PropertyErrorf("enable_profile_rewriting", "Enable_profile_rewriting must be true when profile_guided dexpreopt and R8 optimization/obfuscation is turned on. The attached profile should be sourced from an unoptimized/unobfuscated APK.", ) diff --git a/java/dex.go b/java/dex.go index ed9c82ba2..dd6467546 100644 --- a/java/dex.go +++ b/java/dex.go @@ -161,8 +161,8 @@ type dexer struct { providesTransitiveHeaderJarsForR8 } -func (d *dexer) effectiveOptimizeEnabled() bool { - return BoolDefault(d.dexProperties.Optimize.Enabled, d.dexProperties.Optimize.EnabledByDefault) +func (d *dexer) effectiveOptimizeEnabled(ctx android.EarlyModuleContext) bool { + return BoolDefault(d.dexProperties.Optimize.Enabled, d.dexProperties.Optimize.EnabledByDefault && !ctx.Config().Eng()) } func (d *DexProperties) resourceShrinkingEnabled(ctx android.ModuleContext) bool { @@ -173,8 +173,8 @@ func (d *DexProperties) optimizedResourceShrinkingEnabled(ctx android.ModuleCont return d.resourceShrinkingEnabled(ctx) && BoolDefault(d.Optimize.Optimized_shrink_resources, ctx.Config().UseOptimizedResourceShrinkingByDefault()) } -func (d *dexer) optimizeOrObfuscateEnabled() bool { - return d.effectiveOptimizeEnabled() && (proptools.Bool(d.dexProperties.Optimize.Optimize) || proptools.Bool(d.dexProperties.Optimize.Obfuscate)) +func (d *dexer) optimizeOrObfuscateEnabled(ctx android.EarlyModuleContext) bool { + return d.effectiveOptimizeEnabled(ctx) && (proptools.Bool(d.dexProperties.Optimize.Optimize) || proptools.Bool(d.dexProperties.Optimize.Obfuscate)) } var d8, d8RE = pctx.MultiCommandRemoteStaticRules("d8", @@ -353,7 +353,7 @@ func (d *dexer) dexCommonFlags(ctx android.ModuleContext, flags = append(flags, "--release") } else if ctx.Config().Eng() { flags = append(flags, "--debug") - } else if !d.effectiveOptimizeEnabled() && d.dexProperties.Optimize.EnabledByDefault { + } else if !d.effectiveOptimizeEnabled(ctx) && d.dexProperties.Optimize.EnabledByDefault { // D8 uses --debug by default, whereas R8 uses --release by default. // For targets that default to R8 usage (e.g., apps), but override this default, we still // want D8 to run in release mode, preserving semantics as much as possible between the two. @@ -627,7 +627,7 @@ func (d *dexer) compileDex(ctx android.ModuleContext, dexParams *compileDexParam mergeZipsFlags = "-stripFile META-INF/*.kotlin_module -stripFile **/*.kotlin_builtins" } - useR8 := d.effectiveOptimizeEnabled() + useR8 := d.effectiveOptimizeEnabled(ctx) useD8 := !useR8 || ctx.Config().PartialCompileFlags().Use_d8 rbeR8 := ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_R8") rbeD8 := ctx.Config().UseRBE() && ctx.Config().IsEnvTrue("RBE_D8") diff --git a/java/dex_test.go b/java/dex_test.go index e94864bbc..8c1e5f7df 100644 --- a/java/dex_test.go +++ b/java/dex_test.go @@ -797,12 +797,14 @@ func TestDebugReleaseFlags(t *testing.T) { }, { name: "app_eng", + useD8: true, isEng: true, expectedFlags: "--debug", }, { name: "app_release_eng", isEng: true, + useD8: true, dxFlags: "--release", // Eng mode does *not* override explicit dxflags. expectedFlags: "--release", diff --git a/java/java.go b/java/java.go index 7f897a04f..07e38a17e 100644 --- a/java/java.go +++ b/java/java.go @@ -670,12 +670,12 @@ func sdkDeps(ctx android.BottomUpMutatorContext, sdkContext android.SdkContext, ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...) ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...) ctx.AddVariationDependencies(nil, sdkLibTag, sdkDep.classpath...) - if d.effectiveOptimizeEnabled() && sdkDep.hasStandardLibs() { + if d.effectiveOptimizeEnabled(ctx) && sdkDep.hasStandardLibs() { ctx.AddVariationDependencies(nil, proguardRaiseTag, config.LegacyCorePlatformBootclasspathLibraries..., ) } - if d.effectiveOptimizeEnabled() && sdkDep.hasFrameworkLibs() { + if d.effectiveOptimizeEnabled(ctx) && sdkDep.hasFrameworkLibs() { ctx.AddVariationDependencies(nil, proguardRaiseTag, config.FrameworkLibraries...) } } @@ -2235,7 +2235,7 @@ func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) { // install these alongside the java binary. ctx.VisitDirectDepsProxyWithTag(jniInstallTag, func(jni android.ModuleProxy) { // Use the BaseModuleName of the dependency (without any prebuilt_ prefix) - commonInfo, _ := android.OtherModuleProvider(ctx, jni, android.CommonModuleInfoProvider) + commonInfo := android.OtherModulePointerProviderOrDefault(ctx, jni, android.CommonModuleInfoProvider) j.androidMkNamesOfJniLibs = append(j.androidMkNamesOfJniLibs, commonInfo.BaseModuleName+":"+commonInfo.Target.Arch.ArchType.Bitness()) }) // Check that native libraries are not listed in `required`. Prompt users to use `jni_libs` instead. diff --git a/java/jdeps.go b/java/jdeps.go index 7ef6c89ee..56142c89b 100644 --- a/java/jdeps.go +++ b/java/jdeps.go @@ -46,7 +46,7 @@ func (j *jdepsGeneratorSingleton) GenerateBuildActions(ctx android.SingletonCont moduleInfos := make(map[string]android.IdeInfo) ctx.VisitAllModuleProxies(func(module android.ModuleProxy) { - if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled { + if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled { return } diff --git a/java/lint.go b/java/lint.go index 61b50dcba..dc1e51ffb 100644 --- a/java/lint.go +++ b/java/lint.go @@ -659,7 +659,7 @@ func (l *lintSingleton) generateLintReportZips(ctx android.SingletonContext) { var outputs []*LintInfo var dirs []string ctx.VisitAllModuleProxies(func(m android.ModuleProxy) { - commonInfo, _ := android.OtherModuleProvider(ctx, m, android.CommonModuleInfoProvider) + commonInfo := android.OtherModulePointerProviderOrDefault(ctx, m, android.CommonModuleInfoProvider) if ctx.Config().KatiEnabled() && !commonInfo.ExportedToMake { return } diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go index b2d6ca130..d2ec8bd4f 100644 --- a/java/platform_compat_config.go +++ b/java/platform_compat_config.go @@ -277,7 +277,7 @@ func (p *platformCompatConfigSingleton) GenerateBuildActions(ctx android.Singlet var compatConfigMetadata android.Paths ctx.VisitAllModuleProxies(func(module android.ModuleProxy) { - if !android.OtherModuleProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled { + if !android.OtherModulePointerProviderOrDefault(ctx, module, android.CommonModuleInfoProvider).Enabled { return } if c, ok := android.OtherModuleProvider(ctx, module, PlatformCompatConfigMetadataInfoProvider); ok { |