Do all dexpreoptDisabled checks before registering a dex2oat host dep.
Also disable dexpreopting for host. These are necessary to avoid adding
dependencies on dex2oat in various non-platform builds where they will
break.
Since we cannot assume at least one module enables dexpreopting now,
the two dexpreopt singletons are silently disabled if there has been no
call to dexpreopt.GetGlobalSoongConfig.
Bug: 145934348
Bug: 148312086
Bug: 148319588
Bug: 148690468
Test: m
Test: env OUT_DIR=out-tools prebuilts/build-tools/build-prebuilts.sh
on the aosp-build-tools branch
Test: build/soong/soong_ui.bash --make-mode static_sdk_tools dist DIST_DIR=out-dist BUILD_HOST_static=1
on internal (cf b/148312086#comment8)
Test: build/soong/soong_ui.bash --make-mode dist DIST_DIR=out-apps TARGET_BUILD_APPS=Launcher3 TARGET_BUILD_VARIANT=userdebug
on internal without art/ and external/vixl/ (cf b/148319588)
Change-Id: I240dade7204b87fc2d12181534ab23439eca8b46
diff --git a/java/java.go b/java/java.go
index 2e53654..ceedd89 100644
--- a/java/java.go
+++ b/java/java.go
@@ -76,7 +76,9 @@
ctx.RegisterModuleType("java_host_for_device", HostForDeviceFactory)
ctx.RegisterModuleType("dex_import", DexImportFactory)
- ctx.FinalDepsMutators(dexpreopt.RegisterToolDepsMutator)
+ ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
+ ctx.BottomUp("dexpreopt_tool_deps", dexpreoptToolDepsMutator).Parallel()
+ })
ctx.RegisterSingletonType("logtags", LogtagsSingleton)
ctx.RegisterSingletonType("kythe_java_extract", kytheExtractJavaFactory)
@@ -371,7 +373,6 @@
android.DefaultableModuleBase
android.ApexModuleBase
android.SdkBase
- dexpreopt.DexPreoptModule
properties CompilerProperties
protoProperties android.ProtoProperties
@@ -1577,16 +1578,6 @@
}
} else {
outputFile = implementationAndResourcesJar
-
- // dexpreopt.GetGlobalSoongConfig needs to be called at least once even if
- // no module actually is dexpreopted, to ensure there's a cached
- // GlobalSoongConfig for the dexpreopt singletons, which will run
- // regardless.
- // TODO(b/147613152): Remove when the singletons no longer rely on the
- // cached GlobalSoongConfig.
- if !dexpreopt.GetGlobalConfig(ctx).DisablePreopt {
- _ = dexpreopt.GetGlobalSoongConfig(ctx)
- }
}
ctx.CheckbuildFile(outputFile)
@@ -1794,6 +1785,10 @@
return j.jacocoReportClassesFile
}
+func (j *Module) IsInstallable() bool {
+ return Bool(j.properties.Installable)
+}
+
//
// Java libraries (.jar file)
//
@@ -1831,7 +1826,6 @@
j.checkSdkVersion(ctx)
j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar")
j.dexpreopter.isSDKLibrary = j.deviceProperties.IsSDKLibrary
- j.dexpreopter.isInstallable = Bool(j.properties.Installable)
j.dexpreopter.uncompressedDex = shouldUncompressDex(ctx, &j.dexpreopter)
j.deviceProperties.UncompressDex = j.dexpreopter.uncompressedDex
j.compile(ctx, nil)
@@ -2353,7 +2347,6 @@
android.ApexModuleBase
prebuilt android.Prebuilt
android.SdkBase
- dexpreopt.DexPreoptModule
properties ImportProperties
@@ -2564,7 +2557,6 @@
android.DefaultableModuleBase
android.ApexModuleBase
prebuilt android.Prebuilt
- dexpreopt.DexPreoptModule
properties DexImportProperties
@@ -2590,13 +2582,16 @@
return proptools.StringDefault(j.properties.Stem, j.ModuleBase.Name())
}
+func (j *DexImport) IsInstallable() bool {
+ return true
+}
+
func (j *DexImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if len(j.properties.Jars) != 1 {
ctx.PropertyErrorf("jars", "exactly one jar must be provided")
}
j.dexpreopter.installPath = android.PathForModuleInstall(ctx, "framework", j.Stem()+".jar")
- j.dexpreopter.isInstallable = true
j.dexpreopter.uncompressedDex = shouldUncompressDex(ctx, &j.dexpreopter)
inputJar := ctx.ExpandSource(j.properties.Jars[0], "jars")