Reland aosp/1535007:

Enforce <uses-library> checks for android_app and android_app_import.

Bug: 132357300
Test: lunch aosp_cf_x86_phone-userdebug && m
Merged-In: I50911f727ba98df1035500dbbf467b849be8d6c2
Change-Id: Ief02df2afe56e58189e3165fbb6dbb75f6ff6384
This commit is contained in:
Ulya Trafimovich
2021-01-05 12:04:17 +00:00
committed by Xin Li
parent 59b8d28cf6
commit 55ff4a557d
3 changed files with 17 additions and 10 deletions

View File

@@ -222,31 +222,31 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) {
name: "no preferred",
aaptPreferredConfig: nil,
aaptPrebuiltDPI: []string{},
expected: "prebuilts/apk/app.apk",
expected: "verify_uses_libraries/apk/app.apk",
},
{
name: "AAPTPreferredConfig matches",
aaptPreferredConfig: proptools.StringPtr("xhdpi"),
aaptPrebuiltDPI: []string{"xxhdpi", "ldpi"},
expected: "prebuilts/apk/app_xhdpi.apk",
expected: "verify_uses_libraries/apk/app_xhdpi.apk",
},
{
name: "AAPTPrebuiltDPI matches",
aaptPreferredConfig: proptools.StringPtr("mdpi"),
aaptPrebuiltDPI: []string{"xxhdpi", "xhdpi"},
expected: "prebuilts/apk/app_xxhdpi.apk",
expected: "verify_uses_libraries/apk/app_xxhdpi.apk",
},
{
name: "non-first AAPTPrebuiltDPI matches",
aaptPreferredConfig: proptools.StringPtr("mdpi"),
aaptPrebuiltDPI: []string{"ldpi", "xhdpi"},
expected: "prebuilts/apk/app_xhdpi.apk",
expected: "verify_uses_libraries/apk/app_xhdpi.apk",
},
{
name: "no matches",
aaptPreferredConfig: proptools.StringPtr("mdpi"),
aaptPrebuiltDPI: []string{"ldpi", "xxxhdpi"},
expected: "prebuilts/apk/app.apk",
expected: "verify_uses_libraries/apk/app.apk",
},
}
@@ -266,7 +266,7 @@ func TestAndroidAppImport_DpiVariants(t *testing.T) {
if len(matches) != 2 {
t.Errorf("failed to extract the src apk path from %q", jniRuleCommand)
}
if test.expected != matches[1] {
if strings.HasSuffix(matches[1], test.expected) {
t.Errorf("wrong src apk, expected: %q got: %q", test.expected, matches[1])
}
}
@@ -342,7 +342,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
},
}
`,
expected: "prebuilts/apk/app_arm64.apk",
expected: "verify_uses_libraries/apk/app_arm64.apk",
},
{
name: "no matching arch",
@@ -361,7 +361,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
},
}
`,
expected: "prebuilts/apk/app.apk",
expected: "verify_uses_libraries/apk/app.apk",
},
{
name: "no matching arch without default",
@@ -399,7 +399,7 @@ func TestAndroidAppImport_ArchVariants(t *testing.T) {
if len(matches) != 2 {
t.Errorf("failed to extract the src apk path from %q", jniRuleCommand)
}
if test.expected != matches[1] {
if strings.HasSuffix(matches[1], test.expected) {
t.Errorf("wrong src apk, expected: %q got: %q", test.expected, matches[1])
}
}