summaryrefslogtreecommitdiff
path: root/java/platform_bootclasspath.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2021-04-26 16:44:00 +0100
committerPaul Duffin <paulduffin@google.com>2021-04-28 09:03:46 +0100
commitad19d3858ef362b29448247bccbd312de4d31395 (patch)
treeb9f314979555bf40d7ef4419a75cb5ee7bb3ec5f /java/platform_bootclasspath.go
parent59dc69c2c7b0d0e8a6c99306ff2089e3c71e6ce5 (diff)
Move bootFrameworkProfileRule to platform_bootclasspath
Changes bootFrameworkProfileRule to use ModuleContext instead of SingletonContext and moves the call from dexpreoptBootJar's GenerateSingletonBuildActions method to platform_bootclasspath's GenerateAndroidBuildActions. Changing the context also allows the code to switch from bootFrameworkProfileRule to GetGlobalSoongConfig. Also extracts the shouldBuildBootImages function so it can be used by platform_bootclasspath to preserve the existing behavior. Bug: 177892522 Test: m droid Change-Id: I30d3ca10be7f84348ad3aa9cc984dd15b8f6f4e9
Diffstat (limited to 'java/platform_bootclasspath.go')
-rw-r--r--java/platform_bootclasspath.go24
1 files changed, 21 insertions, 3 deletions
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 05b8e2fa2..6503eca87 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -168,9 +168,7 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
return
}
- // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars
- // GenerateSingletonBuildActions method as it cannot create it for itself.
- dexpreopt.GetGlobalSoongConfig(ctx)
+ b.generateBootImageBuildActions(ctx)
}
func (b *platformBootclasspathModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
@@ -297,3 +295,23 @@ func (b *platformBootclasspathModule) generatedHiddenAPIMetadataRules(ctx androi
rule.Build("platform-bootclasspath-monolithic-hiddenapi-metadata", "monolithic hidden API metadata")
}
+
+// generateBootImageBuildActions generates ninja rules related to the boot image creation.
+func (b *platformBootclasspathModule) generateBootImageBuildActions(ctx android.ModuleContext) {
+ // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars
+ // GenerateSingletonBuildActions method as it cannot create it for itself.
+ dexpreopt.GetGlobalSoongConfig(ctx)
+
+ imageConfig := b.getImageConfig(ctx)
+ if imageConfig == nil {
+ return
+ }
+
+ global := dexpreopt.GetGlobalConfig(ctx)
+ if !shouldBuildBootImages(ctx.Config(), global) {
+ return
+ }
+
+ // Generate the framework profile rule
+ bootFrameworkProfileRule(ctx, imageConfig)
+}