aboutsummaryrefslogtreecommitdiffstats
path: root/java/app.go
diff options
context:
space:
mode:
authorLiz Kammer <eakammer@google.com>2020-05-20 14:36:30 -0700
committerLiz Kammer <eakammer@google.com>2020-05-21 17:25:52 -0700
commit7e20ddae4a0a08c02366f969d4dd12000e99226c (patch)
tree97fa97b1cd088a80ac5aa41c168c1b215b060f0a /java/app.go
parentb029f03191ae4ab26c439df4de481f94a4b3dcff (diff)
downloadbuild_soong-7e20ddae4a0a08c02366f969d4dd12000e99226c.tar.gz
build_soong-7e20ddae4a0a08c02366f969d4dd12000e99226c.tar.bz2
build_soong-7e20ddae4a0a08c02366f969d4dd12000e99226c.zip
Add preprocessed property for android_test_import
If set to true, preprocessed indicates that the prebuilt apk is installable as is and does not need any further processing (e.g. zipaligning, signing). (This is a cherry pick.) Test: app_test.go Bug: 155412211 Merged-In: If0c27c1e340c1bdb270064f636dc6bf33a0fc949 Change-Id: If0c27c1e340c1bdb270064f636dc6bf33a0fc949
Diffstat (limited to 'java/app.go')
-rwxr-xr-xjava/app.go24
1 files changed, 20 insertions, 4 deletions
diff --git a/java/app.go b/java/app.go
index 86cf7471..5d45d333 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1230,6 +1230,8 @@ type AndroidAppImport struct {
usesLibrary usesLibrary
+ preprocessed bool
+
installPath android.InstallPath
}
@@ -1322,7 +1324,7 @@ func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
ctx android.ModuleContext, inputPath android.Path, outputPath android.OutputPath) {
// Test apps don't need their JNI libraries stored uncompressed. As a matter of fact, messing
// with them may invalidate pre-existing signature data.
- if ctx.InstallInTestcases() && Bool(a.properties.Presigned) {
+ if ctx.InstallInTestcases() && (Bool(a.properties.Presigned) || a.preprocessed) {
ctx.Build(pctx, android.BuildParams{
Rule: android.Cp,
Output: outputPath,
@@ -1343,7 +1345,7 @@ func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
// Returns whether this module should have the dex file stored uncompressed in the APK.
func (a *AndroidAppImport) shouldUncompressDex(ctx android.ModuleContext) bool {
- if ctx.Config().UnbundledBuild() {
+ if ctx.Config().UnbundledBuild() || a.preprocessed {
return false
}
@@ -1435,9 +1437,13 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
apkFilename := proptools.StringDefault(a.properties.Filename, a.BaseModuleName()+".apk")
- // Sign or align the package
// TODO: Handle EXTERNAL
- if !Bool(a.properties.Presigned) {
+
+ // Sign or align the package if package has not been preprocessed
+ if a.preprocessed {
+ a.outputFile = srcApk
+ a.certificate = presignedCertificate
+ } else if !Bool(a.properties.Presigned) {
// If the certificate property is empty at this point, default_dev_cert must be set to true.
// Which makes processMainCert's behavior for the empty cert string WAI.
certificates = processMainCert(a.ModuleBase, String(a.properties.Certificate), certificates, ctx)
@@ -1572,15 +1578,24 @@ func AndroidAppImportFactory() android.Module {
return module
}
+type androidTestImportProperties struct {
+ // Whether the prebuilt apk can be installed without additional processing. Default is false.
+ Preprocessed *bool
+}
+
type AndroidTestImport struct {
AndroidAppImport
testProperties testProperties
+ testImportProperties androidTestImportProperties
+
data android.Paths
}
func (a *AndroidTestImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ a.preprocessed = Bool(a.testImportProperties.Preprocessed)
+
a.generateAndroidBuildActions(ctx)
a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data)
@@ -1598,6 +1613,7 @@ func AndroidTestImportFactory() android.Module {
module.AddProperties(&module.dexpreoptProperties)
module.AddProperties(&module.usesLibrary.usesLibraryProperties)
module.AddProperties(&module.testProperties)
+ module.AddProperties(&module.testImportProperties)
module.populateAllVariantStructs()
android.AddLoadHook(module, func(ctx android.LoadHookContext) {
module.processVariants(ctx)