diff options
author | 2020-12-04 11:51:29 -0800 | |
---|---|---|
committer | 2020-12-04 11:51:29 -0800 | |
commit | 84f1b808664b9f764de6e97ba312911d3834e2a1 (patch) | |
tree | f8adede9f95588b1789ee29ff60cc7c9d2e95940 /java/app_test.go | |
parent | 2ba87f466c3af3ffdf2b925520c4d4e45a3f5aba (diff) |
No matching variant android_app_import fix
This fixes a bug where android_app_import or android_test_import without
a matching variant or a default apk property value breaks the build.
Test: app_test.go
Fixes: 152343232
Change-Id: I8215aa1a6dad74b503eaa1169a64f8c30dda287c
Diffstat (limited to 'java/app_test.go')
-rw-r--r-- | java/app_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/java/app_test.go b/java/app_test.go index 6efb0dcb3..c9abc6177 100644 --- a/java/app_test.go +++ b/java/app_test.go @@ -2524,6 +2524,24 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { `, expected: "prebuilts/apk/app.apk", }, + { + name: "no matching arch without default", + bp: ` + android_app_import { + name: "foo", + arch: { + arm: { + apk: "prebuilts/apk/app_arm.apk", + }, + }, + presigned: true, + dex_preopt: { + enabled: true, + }, + } + `, + expected: "", + }, } jniRuleRe := regexp.MustCompile("^if \\(zipinfo (\\S+)") @@ -2531,6 +2549,12 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) { ctx, _ := testJava(t, test.bp) variant := ctx.ModuleForTests("foo", "android_common") + if test.expected == "" { + if variant.Module().Enabled() { + t.Error("module should have been disabled, but wasn't") + } + continue + } jniRuleCommand := variant.Output("jnis-uncompressed/foo.apk").RuleParams.Command matches := jniRuleRe.FindStringSubmatch(jniRuleCommand) if len(matches) != 2 { |