diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go index 25131eec6..fd2f3c5d1 100644 --- a/apex/bootclasspath_fragment_test.go +++ b/apex/bootclasspath_fragment_test.go @@ -833,6 +833,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) { `) java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + "all_apex_contributions", "art-bootclasspath-fragment", "bar", "dex2oatd", @@ -1003,6 +1004,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) { `) java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + "all_apex_contributions", "android-non-updatable.stubs", "android-non-updatable.stubs.module_lib", "android-non-updatable.stubs.system", @@ -1174,6 +1176,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) { `) java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + "all_apex_contributions", "android-non-updatable.stubs", "android-non-updatable.stubs.system", "android-non-updatable.stubs.test", @@ -1326,6 +1329,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *test `) java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + "all_apex_contributions", "art-bootclasspath-fragment", "bar", "dex2oatd", diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index bef3b58c8..fe4cc7685 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -463,6 +463,12 @@ func (b *BootclasspathFragmentModule) DepsMutator(ctx android.BottomUpMutatorCon // Add a dependency onto the dex2oat tool which is needed for creating the boot image. The // path is retrieved from the dependency by GetGlobalSoongConfig(ctx). dexpreopt.RegisterToolDeps(ctx) + + // Add a dependency to `all_apex_contributions` to determine if prebuilts are active. + // If prebuilts are active, `contents` validation on the source bootclasspath fragment should be disabled. + if _, isPrebuiltModule := ctx.Module().(*PrebuiltBootclasspathFragmentModule); !isPrebuiltModule { + ctx.AddDependency(b, android.AcDepTag, "all_apex_contributions") + } } func (b *BootclasspathFragmentModule) BootclasspathDepsMutator(ctx android.BottomUpMutatorContext) {