override_apex can be replaced with apex_set

Bug: 279247159
Test: m nothing
Change-Id: Ic4f8b2b1ee936afe2bf26de7d6cae19d93ecc831
This commit is contained in:
Jooyung Han
2023-04-22 13:46:59 +09:00
parent 28cbb75a09
commit 912c4ab16f
2 changed files with 72 additions and 3 deletions

View File

@@ -304,8 +304,9 @@ func performOverrideMutator(ctx BottomUpMutatorContext) {
for i, o := range overrides {
mods[i+1].(OverridableModule).override(ctx, o)
if o.getOverriddenByPrebuilt() {
// The overriding module itself, too, is overridden by a prebuilt. Skip its installation.
mods[i+1].HideFromMake()
// The overriding module itself, too, is overridden by a prebuilt.
// Copy the flag and hide it in make
mods[i+1].ReplacedByPrebuilt()
}
}
} else if o, ok := ctx.Module().(OverrideModule); ok {

View File

@@ -5696,7 +5696,7 @@ func TestPrebuiltSkipsSymbols(t *testing.T) {
installSymbolFiles bool
}{
{
name: "Source module build rule doesn't install symbol files",
name: "Source module biuld rule doesn't install symbol files",
usePrebuilt: true,
installSymbolFiles: false,
},
@@ -5750,6 +5750,74 @@ func TestPrebuiltSkipsSymbols(t *testing.T) {
}
}
func TestPrebuiltSkipsSymbols_WorksWithOverrideApex(t *testing.T) {
testCases := []struct {
name string
usePrebuilt bool
installSymbolFiles bool
}{
{
name: "Source module build rule doesn't install symbol files",
usePrebuilt: true,
installSymbolFiles: false,
},
{
name: "Source module is installed with symbols",
usePrebuilt: false,
installSymbolFiles: true,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
preferProperty := "prefer: false"
if tc.usePrebuilt {
preferProperty = "prefer: true"
}
ctx := testApex(t, `
apex {
name: "myapex",
binaries: ["foo"],
key: "myapex.key",
updatable: false,
}
// Source module
override_apex {
name: "myapex2",
base: "myapex",
package_name: "myapex2,"
}
apex_key {
name: "myapex.key",
public_key: "testkey.avbpubkey",
private_key: "testkey.pem",
}
apex_set {
name: "myapex2",
apex_name: "myapex", // needed to replace override_apex
set: "myapex2.apks",
`+preferProperty+`
}
cc_binary {
name: "foo",
srcs: ["mylib.cpp"],
system_shared_libs: [],
stl: "none",
apex_available: [ "myapex" ],
}
`)
// Symbol files are installed by installing entries under ${OUT}/apex/{apex name}
android.AssertStringListContainsEquals(t, "Implicits",
ctx.ModuleForTests("myapex", "android_common_myapex2_myapex_image").Module().FilesToInstall().Strings(),
filepath.Join(ctx.Config().SoongOutDir(), "target/product/test_device/apex/myapex2/bin/foo"),
tc.installSymbolFiles)
})
}
}
func TestApexWithTests(t *testing.T) {
ctx := testApex(t, `
apex_test {