summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
author Jaewoong Jung <jungjw@google.com> 2021-03-11 00:59:32 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2021-03-11 00:59:32 +0000
commit6df5e0307dcdcf9b02a0d096537f14cf6a68fe5d (patch)
tree98c1027e146b3e6b744d89de37b57090ee4a12df /java
parent9c2e6d50b4c665cf0848423cea7c86378611fb44 (diff)
parent1c1b6e6d9555e4323e80ad0c48fed988c6cef411 (diff)
Merge "Lineage properties support module references."
Diffstat (limited to 'java')
-rwxr-xr-xjava/app.go4
-rw-r--r--java/app_import.go4
-rw-r--r--java/app_import_test.go26
-rw-r--r--java/app_test.go25
4 files changed, 55 insertions, 4 deletions
diff --git a/java/app.go b/java/app.go
index 0660aa62e..e98fe3114 100755
--- a/java/app.go
+++ b/java/app.go
@@ -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
diff --git a/java/app_import.go b/java/app_import.go
index d38f63e06..d4da64da5 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -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.
diff --git a/java/app_import_test.go b/java/app_import_test.go
index 00406aa2e..cae41d0e7 100644
--- a/java/app_import_test.go
+++ b/java/app_import_test.go
@@ -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 {
diff --git a/java/app_test.go b/java/app_test.go
index f41047aa6..78e1a57a9 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -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 {