diff options
| author | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
|---|---|---|
| committer | mosimchah <mosimchah@gmail.com> | 2025-12-02 09:27:38 -0500 |
| commit | c7bade461dc55726f62997d13a48582f7c4b4655 (patch) | |
| tree | ea0588da76060a2038f54f67efd046ca77634b10 /apex/builder.go | |
| parent | 0f5414d19317805e8bbbe7c4db5f0fd78769bad5 (diff) | |
| parent | 89d78cff8b00d3b20a90074635c3fe5a2ee49474 (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 'apex/builder.go')
| -rw-r--r-- | apex/builder.go | 65 |
1 files changed, 39 insertions, 26 deletions
diff --git a/apex/builder.go b/apex/builder.go index 23c2ed8aa..4d1624dcb 100644 --- a/apex/builder.go +++ b/apex/builder.go @@ -78,7 +78,7 @@ func init() { pctx.HostBinToolVariable("apex_ls", "apex-ls") pctx.HostBinToolVariable("apex_sepolicy_tests", "apex_sepolicy_tests") pctx.HostBinToolVariable("deapexer", "deapexer") - pctx.HostBinToolVariable("debugfs_static", "debugfs_static") + pctx.HostBinToolVariable("debugfs", "debugfs") pctx.HostBinToolVariable("fsck_erofs", "fsck.erofs") pctx.SourcePathVariable("genNdkUsedbyApexPath", "build/soong/scripts/gen_ndk_usedby_apex.sh") pctx.HostBinToolVariable("conv_linker_config", "conv_linker_config") @@ -226,9 +226,9 @@ var ( }, "image_dir") apexHostVerifierRule = pctx.StaticRule("apexHostVerifierRule", blueprint.RuleParams{ - Command: `${host_apex_verifier} --deapexer=${deapexer} --debugfs=${debugfs_static} ` + + Command: `${host_apex_verifier} --deapexer=${deapexer} --debugfs=${debugfs} ` + `--fsckerofs=${fsck_erofs} --apex=${in} --partition_tag=${partition_tag} && touch ${out}`, - CommandDeps: []string{"${host_apex_verifier}", "${deapexer}", "${debugfs_static}", "${fsck_erofs}"}, + CommandDeps: []string{"${host_apex_verifier}", "${deapexer}", "${debugfs}", "${fsck_erofs}"}, Description: "run host_apex_verifier", }, "partition_tag") @@ -240,7 +240,7 @@ var ( apexElfCheckerUnwantedRule = pctx.StaticRule("apexElfCheckerUnwantedRule", blueprint.RuleParams{ Command: `${apex_elf_checker} --tool_path ${tool_path} --unwanted ${unwanted} ${in} && touch ${out}`, - CommandDeps: []string{"${apex_elf_checker}", "${deapexer}", "${debugfs_static}", "${fsck_erofs}", "${config.ClangBin}/llvm-readelf"}, + CommandDeps: []string{"${apex_elf_checker}", "${deapexer}", "${debugfs}", "${fsck_erofs}", "${config.ClangBin}/llvm-readelf"}, Description: "run apex_elf_checker --unwanted", }, "tool_path", "unwanted") ) @@ -248,7 +248,7 @@ var ( func (a *apexBundle) buildAconfigFiles(ctx android.ModuleContext) []apexFile { var aconfigFiles android.Paths for _, file := range a.filesInfo { - if file.module == nil { + if file.module.IsNil() { continue } if dep, ok := android.OtherModuleProvider(ctx, file.module, android.AconfigPropagatingProviderKey); ok { @@ -276,14 +276,9 @@ func (a *apexBundle) buildAconfigFiles(ctx android.ModuleContext) []apexFile { "cache_files": android.JoinPathsWithPrefix(aconfigFiles, "--cache "), }, }) - files = append(files, newApexFile(ctx, apexAconfigFile, "aconfig_flags", "etc", etc, nil)) - - // To enable fingerprint, we need to have v2 storage files. The default version is 1. - storageFilesVersion := 1 - if ctx.Config().ReleaseFingerprintAconfigPackages() { - storageFilesVersion = 2 - } + files = append(files, newApexFile(ctx, apexAconfigFile, "aconfig_flags", "etc", etc, android.ModuleProxy{})) + storageFilesVersion := ctx.Config().ReleaseAconfigStorageVersion() for _, info := range createStorageInfo { outputFile := android.PathForModuleOut(ctx, info.Output_file) ctx.Build(pctx, android.BuildParams{ @@ -295,10 +290,10 @@ func (a *apexBundle) buildAconfigFiles(ctx android.ModuleContext) []apexFile { "container": ctx.ModuleName(), "file_type": info.File_type, "cache_files": android.JoinPathsWithPrefix(aconfigFiles, "--cache "), - "version": strconv.Itoa(storageFilesVersion), + "version": storageFilesVersion, }, }) - files = append(files, newApexFile(ctx, outputFile, info.File_type, "etc", etc, nil)) + files = append(files, newApexFile(ctx, outputFile, info.File_type, "etc", etc, android.ModuleProxy{})) } } return files @@ -408,8 +403,8 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Path { if m, t := android.SrcIsModuleWithTag(*a.properties.File_contexts); m != "" { isFileContextsModule = true otherModule := android.GetModuleProxyFromPathDep(ctx, m, t) - if otherModule != nil { - fileContextsDir = ctx.OtherModuleDir(*otherModule) + if !otherModule.IsNil() { + fileContextsDir = ctx.OtherModuleDir(otherModule) } } fileContexts = android.PathForModuleSrc(ctx, *a.properties.File_contexts) @@ -526,7 +521,7 @@ func markManifestTestOnly(ctx android.ModuleContext, androidManifestFile android func shouldApplyAssembleVintf(fi apexFile) bool { isVintfFragment, _ := path.Match("etc/vintf/*", fi.path()) - _, fromVintfFragmentModule := fi.module.(*android.VintfFragmentModule) + fromVintfFragmentModule := fi.providers != nil && fi.providers.vintfFragmentInfo != nil return isVintfFragment && !fromVintfFragmentModule } @@ -566,7 +561,7 @@ func (a *apexBundle) installApexSystemServerFiles(ctx android.ModuleContext) { } psi := android.PrebuiltSelectionInfoMap{} - ctx.VisitDirectDeps(func(am android.Module) { + ctx.VisitDirectDepsProxy(func(am android.ModuleProxy) { if info, exists := android.OtherModuleProvider(ctx, am, android.PrebuiltSelectionInfoProvider); exists { psi = info } @@ -580,6 +575,9 @@ func (a *apexBundle) installApexSystemServerFiles(ctx android.ModuleContext) { for _, install := range fi.systemServerDexpreoptInstalls { var installedFile android.InstallPath if performInstalls { + // android_device will create the install rule in soong-only builds. + // Skip creating the installation rule from the base variant + // in soong-only builds to prevent duplicate installation rules. installedFile = ctx.InstallFile(install.InstallDirOnDevice, install.InstallFileOnDevice, install.OutputPathOnHost) } else { // Another module created the install rules, but this module should still depend on @@ -588,7 +586,7 @@ func (a *apexBundle) installApexSystemServerFiles(ctx android.ModuleContext) { } a.extraInstalledFiles = append(a.extraInstalledFiles, installedFile) a.extraInstalledPairs = append(a.extraInstalledPairs, installPair{install.OutputPathOnHost, installedFile}) - ctx.PackageFile(install.InstallDirOnDevice, install.InstallFileOnDevice, install.OutputPathOnHost) + ctx.PackageFileWithFakeFullInstall(install.InstallDirOnDevice, install.InstallFileOnDevice, install.OutputPathOnHost) } if performInstalls { for _, dexJar := range fi.systemServerDexJars { @@ -653,10 +651,10 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { // are zipped. So we need to unzip them. copyCommands = append(copyCommands, fmt.Sprintf("unzip -qDD -d %s %s", destPathDir, - fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs().String())) + fi.providers.appInfo.PackedAdditionalOutputs.String())) if installSymbolFiles { installedPath = ctx.InstallFileWithExtraFilesZip(apexDir.Join(ctx, fi.installDir), - fi.stem(), fi.builtFile, fi.module.(*java.AndroidAppSet).PackedAdditionalOutputs()) + fi.stem(), fi.builtFile, fi.providers.appInfo.PackedAdditionalOutputs) } } else { if installSymbolFiles { @@ -903,7 +901,6 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { "readelf": "${config.ClangBin}/llvm-readelf", }, }) - a.nativeApisUsedByModuleFile = apisUsedbyOutputFile var nativeLibNames []string for _, f := range a.filesInfo { @@ -918,7 +915,6 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { Output(apisBackedbyOutputFile). Flags(nativeLibNames) rb.Build("ndk_backedby_list", "Generate API libraries backed by Apex") - a.nativeApisBackedByModuleFile = apisBackedbyOutputFile var javaLibOrApkPath []android.Path for _, f := range a.filesInfo { @@ -934,7 +930,12 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) { Output(javaApiUsedbyOutputFile). Inputs(javaLibOrApkPath) javaUsedByRule.Build("java_usedby_list", "Generate Java APIs used by Apex") - a.javaApisUsedByModuleFile = javaApiUsedbyOutputFile + + if slices.Contains(ctx.Config().UnbundledBuildApps(), a.Name()) && !android.ShouldSkipAndroidMkProcessing(ctx, a) { + ctx.DistForGoalWithFilename("apps_only", apisUsedbyOutputFile, "ndk_apis_usedby_apex/"+apisUsedbyOutputFile.Base()) + ctx.DistForGoalWithFilename("apps_only", apisBackedbyOutputFile, "ndk_apis_backedby_apex/"+apisBackedbyOutputFile.Base()) + ctx.DistForGoalWithFilename("apps_only", javaApiUsedbyOutputFile, "java_apis_used_by_apex/"+javaApiUsedbyOutputFile.Base()) + } bundleConfig := a.buildBundleConfig(ctx) @@ -1111,7 +1112,7 @@ func (a *apexBundle) buildApexDependencyInfo(ctx android.ModuleContext) { // Skip dependencies that are only available to APEXes; they are developed with updatability // in mind and don't need manual approval. - if android.OtherModulePointerProviderOrDefault(ctx, to, android.CommonModuleInfoProvider).NotAvailableForPlatform { + if android.OtherModuleProviderOrDefault(ctx, to, android.PlatformAvailabilityInfoProvider).NotAvailableToPlatform { return !externalDep } @@ -1179,6 +1180,18 @@ func (a *apexBundle) buildLintReports(ctx android.ModuleContext) { a.lintReports = java.BuildModuleLintReportZips(ctx, depSets, validations) } +func (a *apexBundle) reexportJacocoInfo(ctx android.ModuleContext) { + var jacocoInfos []java.JacocoInfo + for _, fi := range a.filesInfo { + if fi.jacocoInfo.ReportClassesFile != nil { + jacocoInfos = append(jacocoInfos, fi.jacocoInfo) + } + } + + android.SetProvider(ctx, java.ApexJacocoInfoProvider, jacocoInfos) + android.SetProvider(ctx, java.BundleProvider, java.BundleInfo{Bundle: a.bundleModuleFile}) +} + func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Path { var readOnlyPaths = []string{"apex_manifest.json", "apex_manifest.pb"} var executablePaths []string // this also includes dirs @@ -1200,7 +1213,7 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Path readOnlyPaths = append(readOnlyPaths, pathInApex) // Additional APKs appSetDirs = append(appSetDirs, f.installDir) - appSetFiles[f.installDir] = f.module.(*java.AndroidAppSet).PackedAdditionalOutputs() + appSetFiles[f.installDir] = f.providers.appInfo.PackedAdditionalOutputs } else { readOnlyPaths = append(readOnlyPaths, pathInApex) } |
