summaryrefslogtreecommitdiff
path: root/java/platform_bootclasspath.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2021-04-27 12:42:20 +0100
committerPaul Duffin <paulduffin@google.com>2021-04-30 12:06:28 +0100
commitf23bc472b091dd809245e9e92d42a58f849182a3 (patch)
tree32015ebdda2158ef5a721f10d725621bb6d4a3b2 /java/platform_bootclasspath.go
parentd01da058605d975b08cbb530b7bbdf520efb183e (diff)
Move configuration checks from getBootImageJar
The getBootImageJar function will be removed once the boot image creation has been moved to the platform_bootclasspath and bootclasspath_fragment module types. However, the consistency checks that it performs are still useful so this change moves them out first. The ART boot image related checks are now performed in the bootclasspath_fragment module type. A previous change accidentally disabled the checks when the contents property was not empty which has been fixed. Also, the error messages have been tweaked to make it clear that the art-bootclasspath-fragment is now the source of truth as to its contents not the configuration. The framework boot image related checks are now performed in the platform_bootclasspath module type. Initially, this change included an extra check to make sure that UpdatableBootJars comes from updatable APEXes but that broke because framework-wifi and framework-tethering are not currently marked as updatable in AOSP. Bug: 177892522 Test: m nothing Change-Id: I80fb600fa2c7cec4566b3461c6a33c4c6f0743f4
Diffstat (limited to 'java/platform_bootclasspath.go')
-rw-r--r--java/platform_bootclasspath.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 9f1629428..f88823fd0 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -184,6 +184,11 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
// Gather all the fragments dependencies.
b.fragments = gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)
+ // Check the configuration of the boot modules.
+ // ART modules are checked by the art-bootclasspath-fragment.
+ b.checkNonUpdatableModules(ctx, nonUpdatableModules)
+ b.checkUpdatableModules(ctx, updatableModules)
+
b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)
// Nothing to do if skipping the dexpreopt of boot image jars.
@@ -194,6 +199,42 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
b.generateBootImageBuildActions(ctx, updatableModules)
}
+// checkNonUpdatableModules ensures that the non-updatable modules supplied are not part of an
+// updatable module.
+func (b *platformBootclasspathModule) checkNonUpdatableModules(ctx android.ModuleContext, modules []android.Module) {
+ for _, m := range modules {
+ apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo)
+ fromUpdatableApex := apexInfo.Updatable
+ if fromUpdatableApex {
+ // error: this jar is part of an updatable apex
+ ctx.ModuleErrorf("module %q from updatable apexes %q is not allowed in the framework boot image", ctx.OtherModuleName(m), apexInfo.InApexes)
+ } else {
+ // ok: this jar is part of the platform or a non-updatable apex
+ }
+ }
+}
+
+// checkUpdatableModules ensures that the updatable modules supplied are not from the platform.
+func (b *platformBootclasspathModule) checkUpdatableModules(ctx android.ModuleContext, modules []android.Module) {
+ for _, m := range modules {
+ apexInfo := ctx.OtherModuleProvider(m, android.ApexInfoProvider).(android.ApexInfo)
+ fromUpdatableApex := apexInfo.Updatable
+ if fromUpdatableApex {
+ // ok: this jar is part of an updatable apex
+ } else {
+ name := ctx.OtherModuleName(m)
+ if apexInfo.IsForPlatform() {
+ // error: this jar is part of the platform
+ ctx.ModuleErrorf("module %q from platform is not allowed in the updatable boot jars list", name)
+ } else {
+ // TODO(b/177892522): Treat this as an error.
+ // Cannot do that at the moment because framework-wifi and framework-tethering are in the
+ // PRODUCT_UPDATABLE_BOOT_JARS but not marked as updatable in AOSP.
+ }
+ }
+ }
+}
+
func (b *platformBootclasspathModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
return defaultBootImageConfig(ctx)
}