Merge "Qualify prebuilt_etc apex module name by relative paths" into main

This commit is contained in:
Cole Faust 2024-05-15 21:21:04 +00:00 committed by Gerrit Code Review
commit 277e444cb3
2 changed files with 41 additions and 1 deletions

View file

@ -1636,7 +1636,8 @@ func apexFileForShBinary(ctx android.BaseModuleContext, sh *sh.ShBinary) apexFil
func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt prebuilt_etc.PrebuiltEtcModule, outputFile android.Path) apexFile { func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt prebuilt_etc.PrebuiltEtcModule, outputFile android.Path) apexFile {
dirInApex := filepath.Join(prebuilt.BaseDir(), prebuilt.SubDir()) dirInApex := filepath.Join(prebuilt.BaseDir(), prebuilt.SubDir())
return newApexFile(ctx, outputFile, outputFile.Base(), dirInApex, etc, prebuilt) makeModuleName := strings.ReplaceAll(filepath.Join(dirInApex, outputFile.Base()), "/", "_")
return newApexFile(ctx, outputFile, makeModuleName, dirInApex, etc, prebuilt)
} }
func apexFileForCompatConfig(ctx android.BaseModuleContext, config java.PlatformCompatConfigIntf, depName string) apexFile { func apexFileForCompatConfig(ctx android.BaseModuleContext, config java.PlatformCompatConfigIntf, depName string) apexFile {

View file

@ -11531,3 +11531,42 @@ func TestAconfifDeclarationsValidation(t *testing.T) {
"depend on java_aconfig_library not passed as an input", "depend on java_aconfig_library not passed as an input",
aconfigFlagArgs, fmt.Sprintf("%s/%s/intermediate.pb", outDir, "quux")) aconfigFlagArgs, fmt.Sprintf("%s/%s/intermediate.pb", outDir, "quux"))
} }
func TestMultiplePrebuiltsWithSameBase(t *testing.T) {
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
prebuilts: ["myetc", "myetc2"],
min_sdk_version: "29",
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
prebuilt_etc {
name: "myetc",
src: "myprebuilt",
filename: "myfilename",
}
prebuilt_etc {
name: "myetc2",
sub_dir: "mysubdir",
src: "myprebuilt",
filename: "myfilename",
}
`, withFiles(android.MockFS{
"packages/modules/common/build/allowed_deps.txt": nil,
}))
ab := ctx.ModuleForTests("myapex", "android_common_myapex").Module().(*apexBundle)
data := android.AndroidMkDataForTest(t, ctx, ab)
var builder strings.Builder
data.Custom(&builder, ab.BaseModuleName(), "TARGET_", "", data)
androidMk := builder.String()
android.AssertStringDoesContain(t, "not found", androidMk, "LOCAL_MODULE := etc_myfilename.myapex")
android.AssertStringDoesContain(t, "not found", androidMk, "LOCAL_MODULE := etc_mysubdir_myfilename.myapex")
}