Move AllowMissingDependencies handling into processMainCert

I046d75dbbd4f21f4a2b6851f558e430e9879fcff fixed android_app modules
with missing certificate dependencies when AllowMissingDependencies
was set, but the same problem can occur in android_app_import and
android_rro modules.  Move the AllowMissingDependencies handling
into processMainCert so that it applies to all of them.

Bug: 246649647
Test: TestAppImportMissingCertificateAllowMissingDependencies
Change-Id: Ic7dd3e61e0e3af15c53b583cf680b1e52394a018
This commit is contained in:
Colin Cross
2022-09-14 12:45:42 -07:00
parent a73e672503
commit bc2c8a7517
5 changed files with 44 additions and 26 deletions

View File

@@ -807,3 +807,23 @@ func TestAndroidTestImport_UncompressDex(t *testing.T) {
}
}
}
func TestAppImportMissingCertificateAllowMissingDependencies(t *testing.T) {
result := android.GroupFixturePreparers(
PrepareForTestWithJavaDefaultModules,
android.PrepareForTestWithAllowMissingDependencies,
android.PrepareForTestWithAndroidMk,
).RunTestWithBp(t, `
android_app_import {
name: "foo",
apk: "a.apk",
certificate: ":missing_certificate",
}`)
foo := result.ModuleForTests("foo", "android_common")
fooApk := foo.Output("signed/foo.apk")
if fooApk.Rule != android.ErrorRule {
t.Fatalf("expected ErrorRule for foo.apk, got %s", fooApk.Rule.String())
}
android.AssertStringDoesContain(t, "expected error rule message", fooApk.Args["error"], "missing dependencies: missing_certificate\n")
}