diff options
author | 2024-12-18 17:08:07 -0800 | |
---|---|---|
committer | 2025-02-03 22:19:24 -0800 | |
commit | e5c7d7c59e63919e9b6ccd655c35fc5371a8bce9 (patch) | |
tree | 2c4013f5e3b6a9aab8824dd53fa3384d3f1fad55 | |
parent | 09dbc010b0dd9055f919e639467691269fb15264 (diff) |
Use unique apex variations for bootclasspath fragments
Upcoming changes to the ApexInfo mutator will require unique apex
variations for the bootclasspath fragments, change them now to simplify
comparisons.
Test: go test ./...
Change-Id: Ia8880fe5ac22a7bd2fb9ddaeb3b04b9ae90b1701
-rw-r--r-- | apex/apex_test.go | 12 | ||||
-rw-r--r-- | apex/bootclasspath_fragment_test.go | 24 | ||||
-rw-r--r-- | apex/classpath_element_test.go | 4 | ||||
-rw-r--r-- | apex/dexpreopt_bootjars_test.go | 4 | ||||
-rw-r--r-- | apex/platform_bootclasspath_test.go | 10 | ||||
-rw-r--r-- | java/bootclasspath_fragment.go | 4 | ||||
-rw-r--r-- | java/dexpreopt_bootjars.go | 3 | ||||
-rw-r--r-- | java/systemserver_classpath_fragment.go | 7 |
8 files changed, 41 insertions, 27 deletions
diff --git a/apex/apex_test.go b/apex/apex_test.go index ef863f41e..78f24635e 100644 --- a/apex/apex_test.go +++ b/apex/apex_test.go @@ -5475,7 +5475,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { checkHiddenAPIIndexFromFlagsInputs(t, ctx, ` my-bootclasspath-fragment/index.csv out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv - out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/index.csv + out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_com.android.art/modular-hiddenapi/index.csv `) }) @@ -5548,7 +5548,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { checkHiddenAPIIndexFromFlagsInputs(t, ctx, ` my-bootclasspath-fragment/index.csv out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv - out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/index.csv + out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_com.android.art/modular-hiddenapi/index.csv `) myApex := ctx.ModuleForTests("myapex", "android_common_myapex").Module() @@ -5743,7 +5743,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { checkHiddenAPIIndexFromFlagsInputs(t, ctx, ` my-bootclasspath-fragment/index.csv out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv - out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/index.csv + out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_com.android.art/modular-hiddenapi/index.csv `) }) @@ -5842,7 +5842,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { checkHiddenAPIIndexFromFlagsInputs(t, ctx, ` out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv out/soong/.intermediates/my-bootclasspath-fragment/android_common_myapex/modular-hiddenapi/index.csv - out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/index.csv + out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_com.android.art/modular-hiddenapi/index.csv `) }) @@ -5954,7 +5954,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) { checkHiddenAPIIndexFromFlagsInputs(t, ctx, ` my-bootclasspath-fragment/index.csv out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/hiddenapi-monolithic/index-from-classes.csv - out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_apex10000/modular-hiddenapi/index.csv + out/soong/.intermediates/packages/modules/com.android.art/art-bootclasspath-fragment/android_common_com.android.art/modular-hiddenapi/index.csv `) }) @@ -11311,7 +11311,7 @@ func TestBootDexJarsMultipleApexPrebuilts(t *testing.T) { { desc: "Source apex com.android.foo is selected, bootjar should come from source java library", selectedApexContributions: "foo.source.contributions", - expectedBootJar: "out/soong/.intermediates/foo-bootclasspath-fragment/android_common_apex10000/hiddenapi-modular/encoded/framework-foo.jar", + expectedBootJar: "out/soong/.intermediates/foo-bootclasspath-fragment/android_common_com.android.foo/hiddenapi-modular/encoded/framework-foo.jar", }, { desc: "Prebuilt apex prebuilt_com.android.foo is selected, profile should come from .prof deapexed from the prebuilt", diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go index a650d1146..c7674b58a 100644 --- a/apex/bootclasspath_fragment_test.go +++ b/apex/bootclasspath_fragment_test.go @@ -712,7 +712,7 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { copyCommands := apexRule.Args["copy_commands"] // Make sure that the fragment provides the hidden API encoded dex jars to the APEX. - fragment := result.Module("mybootclasspathfragment", "android_common_apex10000") + fragment := result.Module("mybootclasspathfragment", "android_common_myapex") info, _ := android.OtherModuleProvider(result, fragment, java.BootclasspathFragmentApexContentInfoProvider) @@ -728,8 +728,8 @@ func TestBootclasspathFragmentContentsNoName(t *testing.T) { android.AssertStringDoesContain(t, name+" apex copy command", copyCommands, expectedCopyCommand) } - checkFragmentExportedDexJar("foo", "out/soong/.intermediates/mybootclasspathfragment/android_common_apex10000/hiddenapi-modular/encoded/foo.jar") - checkFragmentExportedDexJar("bar", "out/soong/.intermediates/mybootclasspathfragment/android_common_apex10000/hiddenapi-modular/encoded/bar.jar") + checkFragmentExportedDexJar("foo", "out/soong/.intermediates/mybootclasspathfragment/android_common_myapex/hiddenapi-modular/encoded/foo.jar") + checkFragmentExportedDexJar("bar", "out/soong/.intermediates/mybootclasspathfragment/android_common_myapex/hiddenapi-modular/encoded/bar.jar") } func getDexJarPath(result *android.TestResult, name string) string { @@ -860,7 +860,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) { } `) - java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_myapex", []string{ "all_apex_contributions", "art-bootclasspath-fragment", "bar", @@ -875,7 +875,7 @@ func TestBootclasspathFragment_HiddenAPIList(t *testing.T) { quuzModuleLibStubs := getDexJarPath(result, "quuz.stubs.exportable.module_lib") // Make sure that the fragment uses the quuz stub dex jars when generating the hidden API flags. - fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") + fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex") rule := fragment.Rule("modularHiddenAPIStubFlagsFile") command := rule.RuleParams.Command @@ -1033,7 +1033,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) { } `) - java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_myapex", []string{ "all_apex_contributions", "android-non-updatable.stubs", "android-non-updatable.stubs.module_lib", @@ -1052,7 +1052,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromSource(t *testing.T) { // Make sure that the fragment uses the android-non-updatable modules when generating the hidden // API flags. - fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") + fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex") rule := fragment.Rule("modularHiddenAPIStubFlagsFile") command := rule.RuleParams.Command @@ -1207,7 +1207,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) { } `) - java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_myapex", []string{ "all_apex_contributions", "android-non-updatable.stubs", "android-non-updatable.stubs.system", @@ -1223,7 +1223,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_FromText(t *testing.T) { // Make sure that the fragment uses the android-non-updatable modules when generating the hidden // API flags. - fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") + fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex") rule := fragment.Rule("modularHiddenAPIStubFlagsFile") command := rule.RuleParams.Command @@ -1362,7 +1362,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *test } `) - java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_apex10000", []string{ + java.CheckModuleDependencies(t, result.TestContext, "mybootclasspathfragment", "android_common_myapex", []string{ "all_apex_contributions", "art-bootclasspath-fragment", "bar", @@ -1381,7 +1381,7 @@ func TestBootclasspathFragment_AndroidNonUpdatable_AlwaysUsePrebuiltSdks(t *test // Make sure that the fragment uses the android-non-updatable modules when generating the hidden // API flags. - fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") + fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex") rule := fragment.Rule("modularHiddenAPIStubFlagsFile") command := rule.RuleParams.Command @@ -1464,7 +1464,7 @@ func TestBootclasspathFragmentProtoContainsMinSdkVersion(t *testing.T) { } `) - fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_apex10000") + fragment := result.ModuleForTests("mybootclasspathfragment", "android_common_myapex") classPathProtoContent := android.ContentFromFileRuleForTests(t, result.TestContext, fragment.Output("bootclasspath.pb.textproto")) // foo ensureContains(t, classPathProtoContent, `jars { diff --git a/apex/classpath_element_test.go b/apex/classpath_element_test.go index f3671743a..55f1475f7 100644 --- a/apex/classpath_element_test.go +++ b/apex/classpath_element_test.go @@ -198,11 +198,11 @@ func TestCreateClasspathElements(t *testing.T) { result := preparer.RunTest(t) - artFragment := result.Module("art-bootclasspath-fragment", "android_common_apex10000") + artFragment := result.Module("art-bootclasspath-fragment", "android_common_com.android.art") artBaz := result.Module("baz", "android_common_apex10000") artQuuz := result.Module("quuz", "android_common_apex10000") - myFragment := result.Module("mybootclasspath-fragment", "android_common_apex10000") + myFragment := result.Module("mybootclasspath-fragment", "android_common_myapex") myBar := result.Module("bar", "android_common_apex10000") other := result.Module("othersdklibrary", "android_common_apex10000") diff --git a/apex/dexpreopt_bootjars_test.go b/apex/dexpreopt_bootjars_test.go index b51bb36cf..6fa1fe225 100644 --- a/apex/dexpreopt_bootjars_test.go +++ b/apex/dexpreopt_bootjars_test.go @@ -176,7 +176,7 @@ func TestDexpreoptBootJarsWithSourceArtApex(t *testing.T) { "out/soong/dexpreopt_arm64/dex_bootjars_input/foo.jar", "out/soong/dexpreopt_arm64/dex_bootjars_input/bar.jar", "out/soong/dexpreopt_arm64/dex_bootjars_input/baz.jar", - "out/soong/.intermediates/art-bootclasspath-fragment/android_common_apex10000/art-bootclasspath-fragment/boot.prof", + "out/soong/.intermediates/art-bootclasspath-fragment/android_common_com.android.art/art-bootclasspath-fragment/boot.prof", "out/soong/.intermediates/default/java/dex_bootjars/android_common/boot/boot.prof", "out/soong/dexpreopt/uffd_gc_flag.txt", } @@ -396,7 +396,7 @@ func TestDexpreoptProfileWithMultiplePrebuiltArtApexes(t *testing.T) { { desc: "Source apex com.android.art is selected, profile should come from source java library", selectedArtApexContributions: "art.source.contributions", - expectedProfile: "out/soong/.intermediates/art-bootclasspath-fragment/android_common_apex10000/art-bootclasspath-fragment/boot.prof", + expectedProfile: "out/soong/.intermediates/art-bootclasspath-fragment/android_common_com.android.art/art-bootclasspath-fragment/boot.prof", }, { desc: "Prebuilt apex prebuilt_com.android.art is selected, profile should come from .prof deapexed from the prebuilt", diff --git a/apex/platform_bootclasspath_test.go b/apex/platform_bootclasspath_test.go index c13d59989..8b5fce91c 100644 --- a/apex/platform_bootclasspath_test.go +++ b/apex/platform_bootclasspath_test.go @@ -165,12 +165,12 @@ func TestPlatformBootclasspath_Fragments(t *testing.T) { android.AssertPathsRelativeToTopEquals(t, message, expected, info.FlagsFilesByCategory[category]) } - android.AssertPathsRelativeToTopEquals(t, "annotation flags", []string{"out/soong/.intermediates/bar-fragment/android_common_apex30/modular-hiddenapi/annotation-flags.csv"}, info.AnnotationFlagsPaths) - android.AssertPathsRelativeToTopEquals(t, "metadata flags", []string{"out/soong/.intermediates/bar-fragment/android_common_apex30/modular-hiddenapi/metadata.csv"}, info.MetadataPaths) - android.AssertPathsRelativeToTopEquals(t, "index flags", []string{"out/soong/.intermediates/bar-fragment/android_common_apex30/modular-hiddenapi/index.csv"}, info.IndexPaths) + android.AssertPathsRelativeToTopEquals(t, "annotation flags", []string{"out/soong/.intermediates/bar-fragment/android_common_myapex/modular-hiddenapi/annotation-flags.csv"}, info.AnnotationFlagsPaths) + android.AssertPathsRelativeToTopEquals(t, "metadata flags", []string{"out/soong/.intermediates/bar-fragment/android_common_myapex/modular-hiddenapi/metadata.csv"}, info.MetadataPaths) + android.AssertPathsRelativeToTopEquals(t, "index flags", []string{"out/soong/.intermediates/bar-fragment/android_common_myapex/modular-hiddenapi/index.csv"}, info.IndexPaths) - android.AssertArrayString(t, "stub flags", []string{"out/soong/.intermediates/bar-fragment/android_common_apex30/modular-hiddenapi/filtered-stub-flags.csv:out/soong/.intermediates/bar-fragment/android_common_apex30/modular-hiddenapi/signature-patterns.csv"}, info.StubFlagSubsets.RelativeToTop()) - android.AssertArrayString(t, "all flags", []string{"out/soong/.intermediates/bar-fragment/android_common_apex30/modular-hiddenapi/filtered-flags.csv:out/soong/.intermediates/bar-fragment/android_common_apex30/modular-hiddenapi/signature-patterns.csv"}, info.FlagSubsets.RelativeToTop()) + android.AssertArrayString(t, "stub flags", []string{"out/soong/.intermediates/bar-fragment/android_common_myapex/modular-hiddenapi/filtered-stub-flags.csv:out/soong/.intermediates/bar-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.StubFlagSubsets.RelativeToTop()) + android.AssertArrayString(t, "all flags", []string{"out/soong/.intermediates/bar-fragment/android_common_myapex/modular-hiddenapi/filtered-flags.csv:out/soong/.intermediates/bar-fragment/android_common_myapex/modular-hiddenapi/signature-patterns.csv"}, info.FlagSubsets.RelativeToTop()) } // TestPlatformBootclasspath_LegacyPrebuiltFragment verifies that the diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go index 8fb8ba9a4..f6d6cad4a 100644 --- a/java/bootclasspath_fragment.go +++ b/java/bootclasspath_fragment.go @@ -290,6 +290,10 @@ func testBootclasspathFragmentFactory() android.Module { return m } +func (m *BootclasspathFragmentModule) UniqueApexVariations() bool { + return true +} + func (m *BootclasspathFragmentModule) bootclasspathFragmentPropertyCheck(ctx android.ModuleContext) { contents := m.properties.Contents.GetOrDefault(ctx, nil) if len(contents) == 0 { diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go index 497facb4d..093cc876b 100644 --- a/java/dexpreopt_bootjars.go +++ b/java/dexpreopt_bootjars.go @@ -566,6 +566,9 @@ func addDependenciesOntoSelectedBootImageApexes(ctx android.BottomUpMutatorConte // The prebuilt might have been renamed by prebuilt_rename mutator if the source module does not exist. // Remove the prebuilt_ prefix. ctx.AddFarVariationDependencies(apexVariationOfSelected, dexpreoptBootJarDepTag, android.RemoveOptionalPrebuiltPrefix(selected)) + } else { + // Couldn't find a dependency, do it again to report an error. + ctx.AddFarVariationDependencies(apexVariationOfSelected, dexpreoptBootJarDepTag, selected) } } } diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go index 3176ad94c..f3074ed0a 100644 --- a/java/systemserver_classpath_fragment.go +++ b/java/systemserver_classpath_fragment.go @@ -58,6 +58,10 @@ func platformSystemServerClasspathFactory() android.Module { return m } +func (m *platformSystemServerClasspathModule) UniqueApexVariations() bool { + return true +} + func (p *platformSystemServerClasspathModule) AndroidMkEntries() (entries []android.AndroidMkEntries) { return p.classpathFragmentBase().androidMkEntries() } @@ -115,6 +119,9 @@ func systemServerClasspathFactory() android.Module { android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon) return m } +func (m *SystemServerClasspathModule) UniqueApexVariations() bool { + return true +} func (s *SystemServerClasspathModule) GenerateAndroidBuildActions(ctx android.ModuleContext) { if len(s.properties.Contents.GetOrDefault(ctx, nil)) == 0 && len(s.properties.Standalone_contents.GetOrDefault(ctx, nil)) == 0 { |