Fix prebuilts of overridden apps

AndroidApp had its own HideFromMake method and flag that shadowed
the one in ModuleBase.  This caused performOverrideMutator to set the
AndroidApp flag, but ModuleBase.skipInstall to read the ModuleBase
flag, resulting in a conflicting install rule being created.  Remove
AndroidApp's HideFromMake in favor of the ModuleBase one.

Bug: 232788722
Test: TestOverrideAndroidAppWithPrebuilt
Change-Id: I8c0dfcb50ff4dc1e4d0574f150b10d79908f46aa
This commit is contained in:
Colin Cross
2022-05-16 16:19:54 -07:00
parent 198f589222
commit aaa0c1ffcd
3 changed files with 36 additions and 6 deletions

View File

@@ -2038,6 +2038,41 @@ func TestOverrideAndroidAppOverrides(t *testing.T) {
}
}
func TestOverrideAndroidAppWithPrebuilt(t *testing.T) {
result := PrepareForTestWithJavaDefaultModules.RunTestWithBp(
t, `
android_app {
name: "foo",
srcs: ["a.java"],
sdk_version: "current",
}
override_android_app {
name: "bar",
base: "foo",
}
android_app_import {
name: "bar",
prefer: true,
apk: "bar.apk",
presigned: true,
}
`)
// An app that has an override that also has a prebuilt should not be hidden.
foo := result.ModuleForTests("foo", "android_common")
if foo.Module().IsHideFromMake() {
t.Errorf("expected foo to have HideFromMake false")
}
// An override that also has a prebuilt should be hidden.
barOverride := result.ModuleForTests("foo", "android_common_bar")
if !barOverride.Module().IsHideFromMake() {
t.Errorf("expected bar override variant of foo to have HideFromMake true")
}
}
func TestOverrideAndroidAppStem(t *testing.T) {
ctx, _ := testJava(t, `
android_app {