diff options
author | Sasha Smundak <asmundak@google.com> | 2020-05-27 16:36:07 -0700 |
---|---|---|
committer | Sasha Smundak <asmundak@google.com> | 2020-06-05 15:39:38 -0700 |
commit | c4f0ff1d6cd68d20e4716119a7d6fbbacd428fe6 (patch) | |
tree | 237eb3b941b8464243978aac04562a320073111b /java/app.go | |
parent | d7fdfd6e772a4bf79966ca0ebc4bd2fee4b63cc6 (diff) | |
download | build_soong-c4f0ff1d6cd68d20e4716119a7d6fbbacd428fe6.tar.gz build_soong-c4f0ff1d6cd68d20e4716119a7d6fbbacd428fe6.tar.bz2 build_soong-c4f0ff1d6cd68d20e4716119a7d6fbbacd428fe6.zip |
Cherrypick aosp/1318079 and aosp/1324841
Allow apex module to have android_app_set as its constituent.
Fix android_app_set documentation
Fixes: 157166068
Test: treehugger & manual
Change-Id: I9f91f1b761286f489d175eb0772f78f702e8a2d6
Merged-In: I9f91f1b761286f489d175eb0772f78f702e8a2d6
Merged-In: Id9b296d9301902deb463b299413491bc66d58944
Diffstat (limited to 'java/app.go')
-rwxr-xr-x | java/app.go | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/java/app.go b/java/app.go index 5bc09ff4..9f024410 100755 --- a/java/app.go +++ b/java/app.go @@ -96,6 +96,14 @@ func (as *AndroidAppSet) Privileged() bool { return Bool(as.properties.Privileged) } +func (as *AndroidAppSet) OutputFile() android.Path { + return as.packedOutput +} + +func (as *AndroidAppSet) MasterFile() string { + return as.masterFile +} + var TargetCpuAbi = map[string]string{ "arm": "ARMEABI_V7A", "arm64": "ARM64_V8A", @@ -120,7 +128,7 @@ func SupportedAbis(ctx android.ModuleContext) []string { } func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext) { - as.packedOutput = android.PathForModuleOut(ctx, "extracted.zip") + as.packedOutput = android.PathForModuleOut(ctx, ctx.ModuleName()+".zip") // 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. @@ -145,26 +153,17 @@ func (as *AndroidAppSet) GenerateAndroidBuildActions(ctx android.ModuleContext) "stem": ctx.ModuleName(), }, }) - // TODO(asmundak): add this (it's wrong now, will cause copying extracted.zip) - /* - var installDir android.InstallPath - if Bool(as.properties.Privileged) { - installDir = android.PathForModuleInstall(ctx, "priv-app", as.BaseModuleName()) - } else if ctx.InstallInTestcases() { - installDir = android.PathForModuleInstall(ctx, as.BaseModuleName(), ctx.DeviceConfig().DeviceArch()) - } else { - installDir = android.PathForModuleInstall(ctx, "app", as.BaseModuleName()) - } - ctx.InstallFile(installDir, as.masterFile", as.packedOutput) - */ } // android_app_set extracts a set of APKs based on the target device // configuration and installs this set as "split APKs". -// The set will always contain `base-master.apk` and every APK built -// to the target device. All density-specific APK will be included, too, -// unless PRODUCT_APPT_PREBUILT_DPI is defined (should contain comma-sepearated -// list of density names (LDPI, MDPI, HDPI, etc.) +// The extracted set always contains 'master' APK whose name is +// _module_name_.apk and every split APK matching target device. +// The extraction of the density-specific splits depends on +// PRODUCT_AAPT_PREBUILT_DPI variable. If present (its value should +// be a list density names: LDPI, MDPI, HDPI, etc.), only listed +// splits will be extracted. Otherwise all density-specific splits +// will be extracted. func AndroidApkSetFactory() android.Module { module := &AndroidAppSet{} module.AddProperties(&module.properties) @@ -335,7 +334,7 @@ type Certificate struct { presigned bool } -var presignedCertificate = Certificate{presigned: true} +var PresignedCertificate = Certificate{presigned: true} func (c Certificate) AndroidMkString() string { if c.presigned { @@ -1196,7 +1195,7 @@ type OverrideAndroidApp struct { android.OverrideModuleBase } -func (i *OverrideAndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) { +func (i *OverrideAndroidApp) GenerateAndroidBuildActions(_ android.ModuleContext) { // All the overrides happen in the base module. // TODO(jungjw): Check the base module type. } @@ -1217,7 +1216,7 @@ type OverrideAndroidTest struct { android.OverrideModuleBase } -func (i *OverrideAndroidTest) GenerateAndroidBuildActions(ctx android.ModuleContext) { +func (i *OverrideAndroidTest) GenerateAndroidBuildActions(_ android.ModuleContext) { // All the overrides happen in the base module. // TODO(jungjw): Check the base module type. } @@ -1239,7 +1238,7 @@ type OverrideRuntimeResourceOverlay struct { android.OverrideModuleBase } -func (i *OverrideRuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.ModuleContext) { +func (i *OverrideRuntimeResourceOverlay) GenerateAndroidBuildActions(_ android.ModuleContext) { // All the overrides happen in the base module. // TODO(jungjw): Check the base module type. } @@ -1483,7 +1482,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext // Sign or align the package if package has not been preprocessed if a.preprocessed { a.outputFile = srcApk - a.certificate = presignedCertificate + 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. @@ -1503,7 +1502,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext alignedApk := android.PathForModuleOut(ctx, "zip-aligned", apkFilename) TransformZipAlign(ctx, alignedApk, dexOutput) a.outputFile = alignedApk - a.certificate = presignedCertificate + a.certificate = PresignedCertificate } // TODO: Optionally compress the output apk. |