summaryrefslogtreecommitdiff
path: root/apex/builder.go
diff options
context:
space:
mode:
Diffstat (limited to 'apex/builder.go')
-rw-r--r--apex/builder.go98
1 files changed, 36 insertions, 62 deletions
diff --git a/apex/builder.go b/apex/builder.go
index a851d120d..879406567 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -43,7 +43,6 @@ func init() {
pctx.Import("android/soong/java")
pctx.HostBinToolVariable("apexer", "apexer")
pctx.HostBinToolVariable("apexer_with_DCLA_preprocessing", "apexer_with_DCLA_preprocessing")
- pctx.HostBinToolVariable("apexer_with_trim_preprocessing", "apexer_with_trim_preprocessing")
// ART minimal builds (using the master-art manifest) do not have the "frameworks/base"
// projects, and hence cannot build 'aapt2'. Use the SDK prebuilt instead.
@@ -96,6 +95,7 @@ var createStorageInfo = []createStorageStruct{
{"package.map", "create_aconfig_package_map_file", "package_map"},
{"flag.map", "create_aconfig_flag_map_file", "flag_map"},
{"flag.val", "create_aconfig_flag_val_file", "flag_val"},
+ {"flag.info", "create_aconfig_flag_info_file", "flag_info"},
}
var (
@@ -172,34 +172,6 @@ var (
}, "tool_path", "image_dir", "copy_commands", "file_contexts", "canned_fs_config", "key",
"opt_flags", "manifest", "is_DCLA")
- TrimmedApexRule = pctx.StaticRule("TrimmedApexRule", blueprint.RuleParams{
- Command: `rm -rf ${image_dir} && mkdir -p ${image_dir} && ` +
- `(. ${out}.copy_commands) && ` +
- `APEXER_TOOL_PATH=${tool_path} ` +
- `${apexer_with_trim_preprocessing} ` +
- `--apexer ${apexer} ` +
- `--canned_fs_config ${canned_fs_config} ` +
- `--manifest ${manifest} ` +
- `--libs_to_trim ${libs_to_trim} ` +
- `${image_dir} ` +
- `${out} ` +
- `-- ` +
- `--include_build_info ` +
- `--force ` +
- `--payload_type image ` +
- `--key ${key} ` +
- `--file_contexts ${file_contexts} ` +
- `${opt_flags} `,
- CommandDeps: []string{"${apexer_with_trim_preprocessing}", "${apexer}", "${avbtool}", "${e2fsdroid}",
- "${merge_zips}", "${mke2fs}", "${resize2fs}", "${sefcontext_compile}", "${make_f2fs}",
- "${sload_f2fs}", "${make_erofs}", "${soong_zip}", "${zipalign}", "${aapt2}",
- "prebuilts/sdk/current/public/android.jar"},
- Rspfile: "${out}.copy_commands",
- RspfileContent: "${copy_commands}",
- Description: "APEX ${image_dir} => ${out}",
- }, "tool_path", "image_dir", "copy_commands", "file_contexts", "canned_fs_config", "key",
- "opt_flags", "manifest", "libs_to_trim")
-
apexProtoConvertRule = pctx.AndroidStaticRule("apexProtoConvertRule",
blueprint.RuleParams{
Command: `${aapt2} convert --output-format proto $in -o $out`,
@@ -252,10 +224,10 @@ var (
apexHostVerifierRule = pctx.StaticRule("apexHostVerifierRule", blueprint.RuleParams{
Command: `${host_apex_verifier} --deapexer=${deapexer} --debugfs=${debugfs_static} ` +
- `--fsckerofs=${fsck_erofs} --apex=${in} && touch ${out}`,
+ `--fsckerofs=${fsck_erofs} --apex=${in} --partition_tag=${partition_tag} && touch ${out}`,
CommandDeps: []string{"${host_apex_verifier}", "${deapexer}", "${debugfs_static}", "${fsck_erofs}"},
Description: "run host_apex_verifier",
- })
+ }, "partition_tag")
assembleVintfRule = pctx.StaticRule("assembleVintfRule", blueprint.RuleParams{
Command: `rm -f $out && VINTF_IGNORE_TARGET_FCM_VERSION=true ${assemble_vintf} -i $in -o $out`,
@@ -359,14 +331,14 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
}
manifestJsonFullOut := android.PathForModuleOut(ctx, "apex_manifest_full.json")
- defaultVersion := android.DefaultUpdatableModuleVersion
+ defaultVersion := ctx.Config().ReleaseDefaultUpdatableModuleVersion()
if a.properties.Variant_version != nil {
defaultVersionInt, err := strconv.Atoi(defaultVersion)
if err != nil {
- ctx.ModuleErrorf("expected DefaultUpdatableModuleVersion to be an int, but got %s", defaultVersion)
+ ctx.ModuleErrorf("expected RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION to be an int, but got %s", defaultVersion)
}
if defaultVersionInt%10 != 0 {
- ctx.ModuleErrorf("expected DefaultUpdatableModuleVersion to end in a zero, but got %s", defaultVersion)
+ ctx.ModuleErrorf("expected RELEASE_DEFAULT_UPDATABLE_MODULE_VERSION to end in a zero, but got %s", defaultVersion)
}
variantVersion := []rune(*a.properties.Variant_version)
if len(variantVersion) != 1 || variantVersion[0] < '0' || variantVersion[0] > '9' {
@@ -425,8 +397,10 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Output
} else {
if m, t := android.SrcIsModuleWithTag(*a.properties.File_contexts); m != "" {
isFileContextsModule = true
- otherModule := android.GetModuleFromPathDep(ctx, m, t)
- fileContextsDir = ctx.OtherModuleDir(otherModule)
+ otherModule := android.GetModuleProxyFromPathDep(ctx, m, t)
+ if otherModule != nil {
+ fileContextsDir = ctx.OtherModuleDir(*otherModule)
+ }
}
fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts)
}
@@ -620,7 +594,8 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
}
} else {
if installSymbolFiles {
- installedPath = ctx.InstallFile(apexDir.Join(ctx, fi.installDir), fi.stem(), fi.builtFile)
+ // store installedPath. symlinks might be created if required.
+ installedPath = apexDir.Join(ctx, fi.installDir, fi.stem())
}
}
@@ -817,24 +792,6 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
"opt_flags": strings.Join(optFlags, " "),
},
})
- } else if ctx.Config().ApexTrimEnabled() && len(a.libs_to_trim(ctx)) > 0 {
- ctx.Build(pctx, android.BuildParams{
- Rule: TrimmedApexRule,
- Implicits: implicitInputs,
- Output: unsignedOutputFile,
- Description: "apex",
- Args: map[string]string{
- "tool_path": outHostBinDir + ":" + prebuiltSdkToolsBinDir,
- "image_dir": imageDir.String(),
- "copy_commands": strings.Join(copyCommands, " && "),
- "manifest": a.manifestPbOut.String(),
- "file_contexts": fileContexts.String(),
- "canned_fs_config": cannedFsConfig.String(),
- "key": a.privateKeyFile.String(),
- "opt_flags": strings.Join(optFlags, " "),
- "libs_to_trim": strings.Join(a.libs_to_trim(ctx), ","),
- },
- })
} else {
ctx.Build(pctx, android.BuildParams{
Rule: apexRule,
@@ -963,7 +920,7 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
runApexElfCheckerUnwanted(ctx, unsignedOutputFile.OutputPath, a.properties.Unwanted_transitive_deps))
}
if !a.testApex && android.InList(a.payloadFsType, []fsType{ext4, erofs}) {
- validations = append(validations, runApexHostVerifier(ctx, unsignedOutputFile.OutputPath))
+ validations = append(validations, runApexHostVerifier(ctx, a, unsignedOutputFile.OutputPath))
}
ctx.Build(pctx, android.BuildParams{
Rule: rule,
@@ -1061,8 +1018,9 @@ func (a *apexBundle) getOverrideManifestPackageName(ctx android.ModuleContext) s
}
return ""
}
- if a.overridableProperties.Package_name != "" {
- return a.overridableProperties.Package_name
+ packageNameFromProp := a.overridableProperties.Package_name.GetOrDefault(ctx, "")
+ if packageNameFromProp != "" {
+ return packageNameFromProp
}
manifestPackageName, overridden := ctx.DeviceConfig().OverrideManifestPackageNameFor(ctx.ModuleName())
if overridden {
@@ -1079,7 +1037,7 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
}
depInfos := android.DepNameToDepInfoMap{}
- a.WalkPayloadDeps(ctx, func(ctx android.ModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
+ a.WalkPayloadDeps(ctx, func(ctx android.BaseModuleContext, from blueprint.Module, to android.ApexModule, externalDep bool) bool {
if from.Name() == to.Name() {
// This can happen for cc.reuseObjTag. We are not interested in tracking this.
// As soon as the dependency graph crosses the APEX boundary, don't go further.
@@ -1146,10 +1104,23 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) {
func (a *apexBundle) buildLintReports(ctx android.ModuleContext) {
depSetsBuilder := java.NewLintDepSetBuilder()
for _, fi := range a.filesInfo {
- depSetsBuilder.Transitive(fi.lintDepSets)
+ if fi.lintInfo != nil {
+ depSetsBuilder.Transitive(fi.lintInfo)
+ }
+ }
+
+ depSets := depSetsBuilder.Build()
+ var validations android.Paths
+
+ if a.checkStrictUpdatabilityLinting(ctx) {
+ baselines := depSets.Baseline.ToList()
+ if len(baselines) > 0 {
+ outputFile := java.VerifyStrictUpdatabilityChecks(ctx, baselines)
+ validations = append(validations, outputFile)
+ }
}
- a.lintReports = java.BuildModuleLintReportZips(ctx, depSetsBuilder.Build())
+ a.lintReports = java.BuildModuleLintReportZips(ctx, depSets, validations)
}
func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.OutputPath {
@@ -1260,12 +1231,15 @@ func runApexElfCheckerUnwanted(ctx android.ModuleContext, apexFile android.Outpu
return timestamp
}
-func runApexHostVerifier(ctx android.ModuleContext, apexFile android.OutputPath) android.Path {
+func runApexHostVerifier(ctx android.ModuleContext, a *apexBundle, apexFile android.OutputPath) android.Path {
timestamp := android.PathForModuleOut(ctx, "host_apex_verifier.timestamp")
ctx.Build(pctx, android.BuildParams{
Rule: apexHostVerifierRule,
Input: apexFile,
Output: timestamp,
+ Args: map[string]string{
+ "partition_tag": a.PartitionTag(ctx.DeviceConfig()),
+ },
})
return timestamp
}