Export app certificates to Make for apkcerts list
Bug: 70669383 Test: m apkcerts-list contains framework-res.apk Change-Id: I38af458e4262371c9c8368b5eebcff063a9bc359
This commit is contained in:
35
java/app.go
35
java/app.go
@@ -77,6 +77,11 @@ type AndroidApp struct {
|
||||
exportPackage android.Path
|
||||
rroDirs android.Paths
|
||||
manifestPath android.Path
|
||||
certificate certificate
|
||||
}
|
||||
|
||||
type certificate struct {
|
||||
pem, key android.Path
|
||||
}
|
||||
|
||||
func (a *AndroidApp) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
@@ -132,18 +137,30 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
a.Module.compile(ctx, a.aaptSrcJar)
|
||||
}
|
||||
|
||||
certificate := String(a.appProperties.Certificate)
|
||||
if certificate == "" {
|
||||
certificate = ctx.Config().DefaultAppCertificate(ctx).String()
|
||||
} else if dir, _ := filepath.Split(certificate); dir == "" {
|
||||
certificate = filepath.Join(ctx.Config().DefaultAppCertificateDir(ctx).String(), certificate)
|
||||
} else {
|
||||
certificate = filepath.Join(android.PathForSource(ctx).String(), certificate)
|
||||
c := String(a.appProperties.Certificate)
|
||||
switch {
|
||||
case c == "":
|
||||
pem, key := ctx.Config().DefaultAppCertificate(ctx)
|
||||
a.certificate = certificate{pem, key}
|
||||
case strings.ContainsRune(c, '/'):
|
||||
a.certificate = certificate{
|
||||
android.PathForSource(ctx, c+".x509.pem"),
|
||||
android.PathForSource(ctx, c+".pk8"),
|
||||
}
|
||||
default:
|
||||
defaultDir := ctx.Config().DefaultAppCertificateDir(ctx)
|
||||
a.certificate = certificate{
|
||||
defaultDir.Join(ctx, c+".x509.pem"),
|
||||
defaultDir.Join(ctx, c+".pk8"),
|
||||
}
|
||||
}
|
||||
|
||||
certificates := []string{certificate}
|
||||
certificates := []certificate{a.certificate}
|
||||
for _, c := range a.appProperties.Additional_certificates {
|
||||
certificates = append(certificates, filepath.Join(android.PathForSource(ctx).String(), c))
|
||||
certificates = append(certificates, certificate{
|
||||
android.PathForSource(ctx, c+".x509.pem"),
|
||||
android.PathForSource(ctx, c+".pk8"),
|
||||
})
|
||||
}
|
||||
|
||||
packageFile := android.PathForModuleOut(ctx, "package.apk")
|
||||
|
Reference in New Issue
Block a user