aboutsummaryrefslogtreecommitdiff
path: root/java/app_import.go
diff options
context:
space:
mode:
authormosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
committermosimchah <mosimchah@gmail.com>2025-12-02 09:27:38 -0500
commitc7bade461dc55726f62997d13a48582f7c4b4655 (patch)
treeea0588da76060a2038f54f67efd046ca77634b10 /java/app_import.go
parent0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff)
parent89d78cff8b00d3b20a90074635c3fe5a2ee49474 (diff)
Merge branch 'lineage-23.1' of https://github.com/LineageOS/android_build_soong into HEADw16.1
* 'lineage-23.1' of https://github.com/LineageOS/android_build_soong: (528 commits) Revert "install_symlink: Make symlink target configurable" Reapply "Clear as much of cc.Module as possible after GenerateBuildActions" Revert "rust: config: Fix missing CPU variant LD flags in Rust" Rename build-flag in outdir Revert^4 "cipd: Default CIPD proxy server to on, add opt-out" Convert check-vintf-all to phony with actions Create a partial implementation of check-vintf-all for soong-only Configure RBE rust pool based on build variant Revert^3 "Add sdk version check to arr" Add jdk.internal.invoke to the allowlist Make droid always depend on symbols zip Import Device and Odm skus Don't install gob_gen in Soong Remove bazel reference from run_integration_tests.sh Fix bootstrap_test.sh Don't panic in aconfig libraries when AllowMissingDependencies is set Avoid returning nil paths from PathForModuleSrc Revert "Flag controled clang version" Rework module target dependencies on required deps Revert^2 "Add sdk version check to arr" ... Change-Id: I6e9a63fa14fda917a42e426e5dcebbad7f67e1de
Diffstat (limited to 'java/app_import.go')
-rw-r--r--java/app_import.go65
1 files changed, 41 insertions, 24 deletions
diff --git a/java/app_import.go b/java/app_import.go
index 9fb13ba3c..93686a991 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -105,8 +105,6 @@ type AndroidAppImport struct {
installPath android.InstallPath
hideApexVariantFromMake bool
-
- provenanceMetaDataFile android.Path
}
type AndroidAppImportProperties struct {
@@ -122,7 +120,7 @@ type AndroidAppImportProperties struct {
// Set this flag to true if the prebuilt apk is already signed. The certificate property must not
// be set for presigned modules.
- Presigned *bool
+ Presigned proptools.Configurable[bool] `android:"replace_instead_of_append"`
// Name of the signing certificate lineage file or filegroup module.
Lineage *string `android:"path"`
@@ -157,7 +155,7 @@ type AndroidAppImportProperties struct {
Relative_install_path *string
// Whether the prebuilt apk can be installed without additional processing. Default is false.
- Preprocessed *bool
+ Preprocessed proptools.Configurable[bool] `android:"replace_instead_of_append"`
// Whether or not to skip checking the preprocessed apk for proper alignment and uncompressed
// JNI libs and dex files. Default is false
@@ -289,7 +287,7 @@ func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
ctx android.ModuleContext, inputPath android.Path, outputPath android.WritablePath) {
// 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) || Bool(a.properties.Preprocessed)) {
+ if ctx.InstallInTestcases() && (a.properties.Presigned.GetOrDefault(ctx, false) || a.properties.Preprocessed.GetOrDefault(ctx, false)) {
ctx.Build(pctx, android.BuildParams{
Rule: android.Cp,
Output: outputPath,
@@ -320,7 +318,7 @@ func (a *AndroidAppImport) extractSubApk(
// 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() || proptools.Bool(a.properties.Preprocessed) {
+ if ctx.Config().UnbundledBuild() || a.properties.Preprocessed.GetOrDefault(ctx, false) {
return false
}
@@ -355,11 +353,19 @@ func (a *AndroidAppImport) stripEmbeddedJniLibsUnusedArch(
func (a *AndroidAppImport) GenerateAndroidBuildActions(ctx android.ModuleContext) {
a.generateAndroidBuildActions(ctx)
+ moduleInfoJSON := ctx.ModuleInfoJSON()
+ moduleInfoJSON.Class = []string{"APPS"}
+ moduleInfoJSON.SystemSharedLibs = []string{"none"}
+
appInfo := &AppInfo{
Prebuilt: true,
}
setCommonAppInfo(appInfo, a)
android.SetProvider(ctx, AppInfoProvider, appInfo)
+ android.SetProvider(ctx, ApkCertInfoProvider, ApkCertInfo{
+ Certificate: appInfo.Certificate,
+ Name: appInfo.InstallApkName + ".apk",
+ })
}
func (a *AndroidAppImport) InstallApkName() string {
@@ -380,19 +386,18 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
a.hideApexVariantFromMake = true
}
- if Bool(a.properties.Preprocessed) {
- if a.properties.Presigned != nil && !*a.properties.Presigned {
+ if a.properties.Preprocessed.GetOrDefault(ctx, false) {
+ if !a.properties.Presigned.GetOrDefault(ctx, true) {
ctx.ModuleErrorf("Setting preprocessed: true implies presigned: true, so you cannot set presigned to false")
}
- t := true
- a.properties.Presigned = &t
+ a.properties.Presigned.AppendSimpleValue(true)
}
numCertPropsSet := 0
if a.properties.Certificate.GetOrDefault(ctx, "") != "" {
numCertPropsSet++
}
- if Bool(a.properties.Presigned) {
+ if a.properties.Presigned.GetOrDefault(ctx, false) {
numCertPropsSet++
}
if Bool(a.properties.Default_dev_cert) {
@@ -438,7 +443,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
installDir := android.PathForModuleInstall(ctx, pathFragments...)
a.dexpreopter.isApp = true
a.dexpreopter.installPath = installDir.Join(ctx, a.BaseModuleName()+".apk")
- a.dexpreopter.isPresignedPrebuilt = Bool(a.properties.Presigned)
+ a.dexpreopter.isPresignedPrebuilt = a.properties.Presigned.GetOrDefault(ctx, false)
a.dexpreopter.uncompressedDex = a.shouldUncompressDex(ctx)
a.dexpreopter.enforceUsesLibs = a.usesLibrary.enforceUsesLibraries(ctx)
@@ -476,7 +481,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
// Sign or align the package if package has not been preprocessed
- if proptools.Bool(a.properties.Preprocessed) {
+ if a.properties.Preprocessed.GetOrDefault(ctx, false) {
validationStamp := a.validatePresignedApk(ctx, srcApk)
output := android.PathForModuleOut(ctx, apkFilename)
ctx.Build(pctx, android.BuildParams{
@@ -487,7 +492,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
})
a.outputFile = output
a.certificate = PresignedCertificate
- } else if !Bool(a.properties.Presigned) {
+ } else if !a.properties.Presigned.GetOrDefault(ctx, false) {
// 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 := collectAppDeps(ctx, a, false, false)
@@ -524,7 +529,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
if apexInfo.IsForPlatform() {
a.installPath = ctx.InstallFile(installDir, apkFilename, a.outputFile)
artifactPath := android.PathForModuleSrc(ctx, a.properties.Apk.GetOrDefault(ctx, ""))
- a.provenanceMetaDataFile = provenance.GenerateArtifactProvenanceMetaData(ctx, artifactPath, a.installPath)
+ provenance.GenerateArtifactProvenanceMetaData(ctx, artifactPath, a.installPath)
}
providePrebuiltInfo(ctx,
@@ -554,7 +559,7 @@ func (a *AndroidAppImport) validatePresignedApk(ctx android.ModuleContext, srcAp
if proptools.Bool(a.properties.Skip_preprocessed_apk_checks) {
extraArgs = append(extraArgs, "--skip-preprocessed-apk-checks")
}
- if proptools.Bool(a.properties.Preprocessed) {
+ if a.properties.Preprocessed.GetOrDefault(ctx, false) {
extraArgs = append(extraArgs, "--preprocessed")
}
@@ -581,18 +586,14 @@ func (a *AndroidAppImport) OutputFile() android.Path {
return a.outputFile
}
-func (a *AndroidAppImport) JacocoReportClassesFile() android.Path {
- return nil
+func (a *AndroidAppImport) JacocoInfo() JacocoInfo {
+ return JacocoInfo{}
}
func (a *AndroidAppImport) Certificate() Certificate {
return a.certificate
}
-func (a *AndroidAppImport) ProvenanceMetaDataFile() android.Path {
- return a.provenanceMetaDataFile
-}
-
func (a *AndroidAppImport) PrivAppAllowlist() android.OptionalPath {
return android.OptionalPath{}
}
@@ -788,8 +789,24 @@ func (a *AndroidTestImport) GenerateAndroidBuildActions(ctx android.ModuleContex
a.data = android.PathsForModuleSrc(ctx, a.testProperties.Data)
- android.SetProvider(ctx, android.TestSuiteInfoProvider, android.TestSuiteInfo{
- TestSuites: a.testProperties.Test_suites,
+ var data []android.DataPath
+ for _, d := range a.data {
+ data = append(data, android.DataPath{SrcPath: d})
+ }
+
+ ctx.SetTestSuiteInfo(android.TestSuiteInfo{
+ TestSuites: a.testProperties.Test_suites,
+ MainFile: a.outputFile,
+ MainFileStem: a.outputFile.Base(),
+ NeedsArchFolder: true,
+ Data: data,
+ CompatibilitySupportFiles: a.data,
+ })
+
+ android.SetProvider(ctx, ApkCertInfoProvider, ApkCertInfo{
+ Certificate: a.Certificate(),
+ Name: a.InstallApkName() + ".apk",
+ Test: true,
})
}