Add preprocessed property for android_test_import

If set to true, preprocessed indicates that the prebuilt apk is
installable as is and does not need any further processing (e.g.
zipaligning, signing).

Test: app_test.go
Bug: 155412211
Change-Id: If0c27c1e340c1bdb270064f636dc6bf33a0fc949
This commit is contained in:
Liz Kammer
2020-05-20 14:36:30 -07:00
parent 63beac5076
commit 3b70b3fea5
2 changed files with 59 additions and 4 deletions

View File

@@ -2369,6 +2369,45 @@ func TestAndroidTestImport_NoJinUncompressForPresigned(t *testing.T) {
if jniRule != android.Cp.String() {
t.Errorf("Unexpected JNI uncompress rule: " + jniRule)
}
if variant.MaybeOutput("zip-aligned/foo_presigned.apk").Rule == nil {
t.Errorf("Presigned test apk should be aligned")
}
}
func TestAndroidTestImport_Preprocessed(t *testing.T) {
ctx, _ := testJava(t, `
android_test_import {
name: "foo",
apk: "prebuilts/apk/app.apk",
presigned: true,
preprocessed: true,
}
android_test_import {
name: "foo_cert",
apk: "prebuilts/apk/app.apk",
certificate: "cert/new_cert",
preprocessed: true,
}
`)
testModules := []string{"foo", "foo_cert"}
for _, m := range testModules {
apkName := m + ".apk"
variant := ctx.ModuleForTests(m, "android_common")
jniRule := variant.Output("jnis-uncompressed/" + apkName).BuildParams.Rule.String()
if jniRule != android.Cp.String() {
t.Errorf("Unexpected JNI uncompress rule: " + jniRule)
}
// Make sure signing and aligning were skipped.
if variant.MaybeOutput("signed/"+apkName).Rule != nil {
t.Errorf("signing rule shouldn't be included for preprocessed.")
}
if variant.MaybeOutput("zip-aligned/"+apkName).Rule != nil {
t.Errorf("aligning rule shouldn't be for preprocessed")
}
}
}
func TestStl(t *testing.T) {