Merge "Lineage properties support module references." am: 6df5e0307d

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I7fb218215e9b8c7395756ccbd78edf6674b259ad
This commit is contained in:
Jaewoong Jung
2021-03-11 02:00:38 +00:00
committed by Automerger Merge Worker
6 changed files with 73 additions and 5 deletions

View File

@@ -122,8 +122,8 @@ type overridableAppProperties struct {
// or an android_app_certificate module name in the form ":module".
Certificate *string
// Name of the signing certificate lineage file.
Lineage *string
// Name of the signing certificate lineage file or filegroup module.
Lineage *string `android:"path"`
// the package name of this app. The package name in the manifest file is used if one was not given.
Package_name *string

View File

@@ -74,8 +74,8 @@ type AndroidAppImportProperties struct {
// be set for presigned modules.
Presigned *bool
// Name of the signing certificate lineage file.
Lineage *string
// Name of the signing certificate lineage file or filegroup module.
Lineage *string `android:"path"`
// Sign with the default system dev certificate. Must be used judiciously. Most imported apps
// need to either specify a specific certificate or be presigned.

View File

@@ -138,6 +138,32 @@ func TestAndroidAppImport_SigningLineage(t *testing.T) {
}
}
func TestAndroidAppImport_SigningLineageFilegroup(t *testing.T) {
ctx, _ := testJava(t, `
android_app_import {
name: "foo",
apk: "prebuilts/apk/app.apk",
certificate: "platform",
lineage: ":lineage_bin",
}
filegroup {
name: "lineage_bin",
srcs: ["lineage.bin"],
}
`)
variant := ctx.ModuleForTests("foo", "android_common")
signedApk := variant.Output("signed/foo.apk")
// Check cert signing lineage flag.
signingFlag := signedApk.Args["flags"]
expected := "--lineage lineage.bin"
if expected != signingFlag {
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
}
}
func TestAndroidAppImport_DefaultDevCert(t *testing.T) {
ctx, _ := testJava(t, `
android_app_import {

View File

@@ -1576,6 +1576,31 @@ func TestCertificates(t *testing.T) {
expectedLineage: "--lineage lineage.bin",
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
},
{
name: "lineage from filegroup",
bp: `
android_app {
name: "foo",
srcs: ["a.java"],
certificate: ":new_certificate",
lineage: ":lineage_bin",
sdk_version: "current",
}
android_app_certificate {
name: "new_certificate",
certificate: "cert/new_cert",
}
filegroup {
name: "lineage_bin",
srcs: ["lineage.bin"],
}
`,
certificateOverride: "",
expectedLineage: "--lineage lineage.bin",
expectedCertificate: "cert/new_cert.x509.pem cert/new_cert.pk8",
},
}
for _, test := range testCases {