Merge "Do not rename prebuilt apexes for product packaging" into main

This commit is contained in:
Treehugger Robot
2024-07-26 21:08:31 +00:00
committed by Gerrit Code Review
2 changed files with 2 additions and 15 deletions

View File

@@ -5244,7 +5244,7 @@ func TestBootDexJarsFromSourcesAndPrebuilts(t *testing.T) {
myApex := ctx.ModuleForTests("myapex", "android_common_myapex").Module() myApex := ctx.ModuleForTests("myapex", "android_common_myapex").Module()
overrideNames := []string{ overrideNames := []string{
"myapex", "",
"myjavalib.myapex", "myjavalib.myapex",
"libfoo.myapex", "libfoo.myapex",
"libbar.myapex", "libbar.myapex",
@@ -11294,13 +11294,6 @@ func TestBootDexJarsMultipleApexPrebuilts(t *testing.T) {
// Test that product packaging installs the selected mainline module (either source or a specific prebuilt) // Test that product packaging installs the selected mainline module (either source or a specific prebuilt)
// RELEASE_APEX_CONTIRBUTIONS_* build flags will be used to select the correct prebuilt for a specific release config // RELEASE_APEX_CONTIRBUTIONS_* build flags will be used to select the correct prebuilt for a specific release config
func TestInstallationRulesForMultipleApexPrebuilts(t *testing.T) { func TestInstallationRulesForMultipleApexPrebuilts(t *testing.T) {
// check that the LOCAL_MODULE in the generated mk file matches the name used in PRODUCT_PACKAGES
// Since the name used in PRODUCT_PACKAGES does not contain prebuilt_ prefix, LOCAL_MODULE should not contain any prefix either
checkLocalModuleName := func(t *testing.T, ctx *android.TestContext, soongApexModuleName string, expectedLocalModuleName string) {
// Variations are created based on apex_name
entries := android.AndroidMkEntriesForTest(t, ctx, ctx.ModuleForTests(soongApexModuleName, "android_common_com.android.foo").Module())
android.AssertStringEquals(t, "LOCAL_MODULE of the prebuilt apex must match the name listed in PRODUCT_PACKAGES", expectedLocalModuleName, entries[0].EntryMap["LOCAL_MODULE"][0])
}
// for a mainline module family, check that only the flagged soong module is visible to make // for a mainline module family, check that only the flagged soong module is visible to make
checkHideFromMake := func(t *testing.T, ctx *android.TestContext, visibleModuleName string, hiddenModuleNames []string) { checkHideFromMake := func(t *testing.T, ctx *android.TestContext, visibleModuleName string, hiddenModuleNames []string) {
variation := func(moduleName string) string { variation := func(moduleName string) string {
@@ -11355,7 +11348,7 @@ func TestInstallationRulesForMultipleApexPrebuilts(t *testing.T) {
prebuilt_apex { prebuilt_apex {
name: "com.google.android.foo.v2", name: "com.google.android.foo.v2",
apex_name: "com.android.foo", apex_name: "com.android.foo",
source_apex_name: "com.google.android.foo", // source_apex_name becomes LOCAL_MODULE in the generated mk file source_apex_name: "com.google.android.foo",
src: "com.android.foo-arm.apex", src: "com.android.foo-arm.apex",
prefer: true, // prefer is set to true on both the prebuilts to induce an error if flagging is not present prefer: true, // prefer is set to true on both the prebuilts to induce an error if flagging is not present
} }
@@ -11441,11 +11434,6 @@ func TestInstallationRulesForMultipleApexPrebuilts(t *testing.T) {
} }
ctx := testApex(t, bp, preparer) ctx := testApex(t, bp, preparer)
// Check that the LOCAL_MODULE of the two prebuilts is com.android.foo
// This ensures that product packaging can pick them for installation if it has been flagged by apex_contributions
checkLocalModuleName(t, ctx, "prebuilt_com.google.android.foo", "com.google.android.foo")
checkLocalModuleName(t, ctx, "prebuilt_com.google.android.foo.v2", "com.google.android.foo")
// Check that // Check that
// 1. The contents of the selected apex_contributions are visible to make // 1. The contents of the selected apex_contributions are visible to make
// 2. The rest of the apexes in the mainline module family (source or other prebuilt) is hidden from make // 2. The rest of the apexes in the mainline module family (source or other prebuilt) is hidden from make

View File

@@ -246,7 +246,6 @@ func (p *prebuiltCommon) AndroidMkEntries() []android.AndroidMkEntries {
OutputFile: android.OptionalPathForPath(p.outputApex), OutputFile: android.OptionalPathForPath(p.outputApex),
Include: "$(BUILD_PREBUILT)", Include: "$(BUILD_PREBUILT)",
Host_required: p.hostRequired, Host_required: p.hostRequired,
OverrideName: p.BaseModuleName(),
ExtraEntries: []android.AndroidMkExtraEntriesFunc{ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) { func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_PATH", p.installDir.String()) entries.SetString("LOCAL_MODULE_PATH", p.installDir.String())