Merge "Prebuilt is enabled even if the source one is not." am: 6bba8382af
am: 0a30c0b67b
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1521068 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: If5af257e67f1892eae922105c128f7f4aedadcc3
This commit is contained in:
@@ -178,7 +178,7 @@ func InitSingleSourcePrebuiltModule(module PrebuiltInterface, srcProps interface
|
|||||||
srcPropertyName := proptools.PropertyNameForField(srcField)
|
srcPropertyName := proptools.PropertyNameForField(srcField)
|
||||||
|
|
||||||
srcsSupplier := func(ctx BaseModuleContext) []string {
|
srcsSupplier := func(ctx BaseModuleContext) []string {
|
||||||
if !ctx.Module().Enabled() {
|
if !module.Enabled() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
value := srcPropsValue.FieldByIndex(srcFieldIndex)
|
value := srcPropsValue.FieldByIndex(srcFieldIndex)
|
||||||
|
@@ -2566,6 +2566,34 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAndroidAppImport_overridesDisabledAndroidApp(t *testing.T) {
|
||||||
|
ctx, _ := testJava(t, `
|
||||||
|
android_app {
|
||||||
|
name: "foo",
|
||||||
|
srcs: ["a.java"],
|
||||||
|
enabled: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
android_app_import {
|
||||||
|
name: "foo",
|
||||||
|
apk: "prebuilts/apk/app.apk",
|
||||||
|
certificate: "platform",
|
||||||
|
prefer: true,
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
|
||||||
|
variant := ctx.ModuleForTests("prebuilt_foo", "android_common")
|
||||||
|
a := variant.Module().(*AndroidAppImport)
|
||||||
|
// The prebuilt module should still be enabled and active even if the source-based counterpart
|
||||||
|
// is disabled.
|
||||||
|
if !a.prebuilt.UsePrebuilt() {
|
||||||
|
t.Errorf("prebuilt foo module is not active")
|
||||||
|
}
|
||||||
|
if !a.Enabled() {
|
||||||
|
t.Errorf("prebuilt foo module is disabled")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestAndroidTestImport(t *testing.T) {
|
func TestAndroidTestImport(t *testing.T) {
|
||||||
ctx, config := testJava(t, `
|
ctx, config := testJava(t, `
|
||||||
android_test_import {
|
android_test_import {
|
||||||
|
Reference in New Issue
Block a user