Output apkcerts file for android_app_set.
Soong and Make have no ways to figure out what splits will be outputted
from a given android_app_set, so it's impossible for them to provide
full PACKAGES.$(LOCAL_MODULE).CERTIFICATE entries, which are required to
build a final apkcerts.txt. This change makes extract_apks produce
apkcerts.txt files for each input modules instead. The Make-side
counterpart of this change merges all local apkcerts.txt into a final
one.
Bug: 160119159
Bug: 162464887
Test: main_test.go
Test: m apkcerts-list
Merged-In: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
Change-Id: I321e80fd636a955213761f56a3ac64bfe7f7f7c0
diff --git a/java/androidmk.go b/java/androidmk.go
index ed82955..45fd1c1 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -607,6 +607,7 @@
fmt.Fprintln(w, "LOCAL_PRIVILEGED_MODULE := true")
}
fmt.Fprintln(w, "LOCAL_APK_SET_MASTER_FILE := ", apkSet.masterFile)
+ fmt.Fprintln(w, "LOCAL_APKCERTS_FILE := ", apkSet.apkcertsFile)
fmt.Fprintln(w, "LOCAL_OVERRIDES_PACKAGES :=", strings.Join(apkSet.properties.Overrides, " "))
},
},
diff --git a/java/app.go b/java/app.go
index f755d8b..586b66d 100644
--- a/java/app.go
+++ b/java/app.go
@@ -64,6 +64,7 @@
properties AndroidAppSetProperties
packedOutput android.WritablePath
masterFile string
+ apkcertsFile android.ModuleOutPath
}
func (as *AndroidAppSet) Name() string {
@@ -107,6 +108,7 @@
func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
as.packedOutput = android.PathForModuleOut(ctx, "extracted.zip")
+ as.apkcertsFile = android.PathForModuleOut(ctx, "apkcerts.txt")
// We are assuming here that the master file in the APK
// set has `.apk` suffix. If it doesn't the build will fail.
// APK sets containing APEX files are handled elsewhere.
@@ -119,16 +121,19 @@
// TODO(asmundak): do we support device features
ctx.Build(pctx,
android.BuildParams{
- Rule: extractMatchingApks,
- Description: "Extract APKs from APK set",
- Output: as.packedOutput,
- Inputs: android.Paths{as.prebuilt.SingleSourcePath(ctx)},
+ Rule: extractMatchingApks,
+ Description: "Extract APKs from APK set",
+ Output: as.packedOutput,
+ ImplicitOutput: as.apkcertsFile,
+ Inputs: android.Paths{as.prebuilt.SingleSourcePath(ctx)},
Args: map[string]string{
"abis": strings.Join(SupportedAbis(ctx), ","),
"allow-prereleased": strconv.FormatBool(proptools.Bool(as.properties.Prerelease)),
"screen-densities": screenDensities,
"sdk-version": ctx.Config().PlatformSdkVersion(),
"stem": ctx.ModuleName(),
+ "apkcerts": as.apkcertsFile.String(),
+ "partition": as.PartitionTag(ctx.DeviceConfig()),
},
})
// TODO(asmundak): add this (it's wrong now, will cause copying extracted.zip)
diff --git a/java/app_test.go b/java/app_test.go
index 4f174d8..1d49770 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -153,6 +153,9 @@
if s := params.Args["allow-prereleased"]; s != "true" {
t.Errorf("wrong allow-prereleased value: '%s', expected 'true'", s)
}
+ if s := params.Args["partition"]; s != "system" {
+ t.Errorf("wrong partition value: '%s', expected 'system'", s)
+ }
}
func TestAndroidAppSet_Variants(t *testing.T) {
diff --git a/java/builder.go b/java/builder.go
index b552b2c..2fe4d8a 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -68,10 +68,11 @@
`${config.ExtractApksCmd} -o "${out}" -allow-prereleased=${allow-prereleased} ` +
`-sdk-version=${sdk-version} -abis=${abis} ` +
`--screen-densities=${screen-densities} --stem=${stem} ` +
+ `-apkcerts=${apkcerts} -partition=${partition} ` +
`${in}`,
CommandDeps: []string{"${config.ExtractApksCmd}"},
},
- "abis", "allow-prereleased", "screen-densities", "sdk-version", "stem")
+ "abis", "allow-prereleased", "screen-densities", "sdk-version", "stem", "apkcerts", "partition")
turbine = pctx.AndroidStaticRule("turbine",
blueprint.RuleParams{