From b2c2173bfd3e2e4ed3f91615ca6500ea704b65d9 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Wed, 11 May 2022 14:29:53 +0000 Subject: [PATCH] Ensure that *bootclasspath* module types depend on device variants Needed to allow change https://r.android.com/2089503 to be reapplied. Bug: 232106778 Test: Apply the change and then run m EMMA_INSTRUMENT=true nothing Change-Id: I92d19c51cc828295ba13951e65911db707f0f2ba --- java/bootclasspath.go | 3 +++ java/bootclasspath_fragment.go | 2 +- java/platform_bootclasspath_test.go | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/java/bootclasspath.go b/java/bootclasspath.go index 52ce77d46..f4cef7fa6 100644 --- a/java/bootclasspath.go +++ b/java/bootclasspath.go @@ -84,6 +84,9 @@ func addDependencyOntoApexModulePair(ctx android.BottomUpMutatorContext, apex st } } + target := ctx.Module().Target() + variations = append(variations, target.Variations()...) + addedDep := false if ctx.OtherModuleDependencyVariantExists(variations, name) { ctx.AddFarVariationDependencies(variations, tag, name) diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index c3a5d5f70..0345aadfd 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -273,7 +273,7 @@ func bootclasspathFragmentFactory() android.Module { android.InitApexModule(m) android.InitSdkAwareModule(m) initClasspathFragment(m, BOOTCLASSPATH) - android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibCommon) + android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) android.AddLoadHook(m, func(ctx android.LoadHookContext) { // If code coverage has been enabled for the framework then append the properties with diff --git a/java/platform_bootclasspath_test.go b/java/platform_bootclasspath_test.go index 1c2a3aee5..6257e49e1 100644 --- a/java/platform_bootclasspath_test.go +++ b/java/platform_bootclasspath_test.go @@ -51,6 +51,7 @@ func TestPlatformBootclasspath(t *testing.T) { var addSourceBootclassPathModule = android.FixtureAddTextFile("source/Android.bp", ` java_library { name: "foo", + host_supported: true, // verify that b/232106778 is fixed srcs: ["a.java"], system_modules: "none", sdk_version: "none",