Merge changes I046d75db,Ie13817dc am: d2aa190bdc am: f2c86c8c76 am: 1a3ea67458

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2058908

Change-Id: I9ab91976903abbb4e3ec17b3d26db15447f074d6
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Colin Cross
2022-04-12 00:58:51 +00:00
committed by Automerger Merge Worker
5 changed files with 76 additions and 42 deletions

View File

@@ -644,7 +644,21 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
}
certificates := processMainCert(a.ModuleBase, a.getCertString(ctx), certificateDeps, ctx)
a.certificate = certificates[0]
// This can be reached with an empty certificate list if AllowMissingDependencies is set
// and the certificate property for this module is a module reference to a missing module.
if len(certificates) > 0 {
a.certificate = certificates[0]
} else {
if !ctx.Config().AllowMissingDependencies() && len(ctx.GetMissingDependencies()) > 0 {
panic("Should only get here if AllowMissingDependencies set and there are missing dependencies")
}
// Set a certificate to avoid panics later when accessing it.
a.certificate = Certificate{
Key: android.PathForModuleOut(ctx, "missing.pk8"),
Pem: android.PathForModuleOut(ctx, "missing.pem"),
}
}
// Build a final signed app package.
packageFile := android.PathForModuleOut(ctx, a.installApkName+".apk")