Merge changes Ia9f2186e,Ibe567d3b into main am: 0a9eb7f657
am: e1b039d184
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3247637 Change-Id: I70cf56e14a9bc13b1c8499037f8ddca3e54b0dd5 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -262,6 +262,58 @@ var (
|
||||
}, "tool_path", "unwanted")
|
||||
)
|
||||
|
||||
func (a *apexBundle) buildAconfigFiles(ctx android.ModuleContext) []apexFile {
|
||||
var aconfigFiles android.Paths
|
||||
for _, file := range a.filesInfo {
|
||||
if file.module == nil {
|
||||
continue
|
||||
}
|
||||
if dep, ok := android.OtherModuleProvider(ctx, file.module, android.AconfigPropagatingProviderKey); ok {
|
||||
if len(dep.AconfigFiles) > 0 && dep.AconfigFiles[ctx.ModuleName()] != nil {
|
||||
aconfigFiles = append(aconfigFiles, dep.AconfigFiles[ctx.ModuleName()]...)
|
||||
}
|
||||
}
|
||||
|
||||
validationFlag := ctx.DeviceConfig().AconfigContainerValidation()
|
||||
if validationFlag == "error" || validationFlag == "warning" {
|
||||
android.VerifyAconfigBuildMode(ctx, ctx.ModuleName(), file.module, validationFlag == "error")
|
||||
}
|
||||
}
|
||||
aconfigFiles = android.FirstUniquePaths(aconfigFiles)
|
||||
|
||||
var files []apexFile
|
||||
if len(aconfigFiles) > 0 {
|
||||
apexAconfigFile := android.PathForModuleOut(ctx, "aconfig_flags.pb")
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: aconfig.AllDeclarationsRule,
|
||||
Inputs: aconfigFiles,
|
||||
Output: apexAconfigFile,
|
||||
Description: "combine_aconfig_declarations",
|
||||
Args: map[string]string{
|
||||
"cache_files": android.JoinPathsWithPrefix(aconfigFiles, "--cache "),
|
||||
},
|
||||
})
|
||||
files = append(files, newApexFile(ctx, apexAconfigFile, "aconfig_flags", "etc", etc, nil))
|
||||
|
||||
for _, info := range createStorageInfo {
|
||||
outputFile := android.PathForModuleOut(ctx, info.Output_file)
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: aconfig.CreateStorageRule,
|
||||
Inputs: aconfigFiles,
|
||||
Output: outputFile,
|
||||
Description: info.Desc,
|
||||
Args: map[string]string{
|
||||
"container": ctx.ModuleName(),
|
||||
"file_type": info.File_type,
|
||||
"cache_files": android.JoinPathsWithPrefix(aconfigFiles, "--cache "),
|
||||
},
|
||||
})
|
||||
files = append(files, newApexFile(ctx, outputFile, info.File_type, "etc", etc, nil))
|
||||
}
|
||||
}
|
||||
return files
|
||||
}
|
||||
|
||||
// buildManifest creates buile rules to modify the input apex_manifest.json to add information
|
||||
// gathered by the build system such as provided/required native libraries. Two output files having
|
||||
// different formats are generated. a.manifestJsonOut is JSON format for Q devices, and
|
||||
@@ -644,48 +696,10 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
|
||||
outHostBinDir := ctx.Config().HostToolPath(ctx, "").String()
|
||||
prebuiltSdkToolsBinDir := filepath.Join("prebuilts", "sdk", "tools", runtime.GOOS, "bin")
|
||||
|
||||
defaultReadOnlyFiles := []string{"apex_manifest.json", "apex_manifest.pb"}
|
||||
aconfigDest := imageDir.Join(ctx, "etc").String()
|
||||
if len(a.aconfigFiles) > 0 {
|
||||
apexAconfigFile := android.PathForModuleOut(ctx, "aconfig_flags.pb")
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: aconfig.AllDeclarationsRule,
|
||||
Inputs: a.aconfigFiles,
|
||||
Output: apexAconfigFile,
|
||||
Description: "combine_aconfig_declarations",
|
||||
Args: map[string]string{
|
||||
"cache_files": android.JoinPathsWithPrefix(a.aconfigFiles, "--cache "),
|
||||
},
|
||||
})
|
||||
|
||||
copyCommands = append(copyCommands, "cp -f "+apexAconfigFile.String()+" "+aconfigDest)
|
||||
implicitInputs = append(implicitInputs, apexAconfigFile)
|
||||
defaultReadOnlyFiles = append(defaultReadOnlyFiles, "etc/"+apexAconfigFile.Base())
|
||||
|
||||
for _, info := range createStorageInfo {
|
||||
outputFile := android.PathForModuleOut(ctx, info.Output_file)
|
||||
ctx.Build(pctx, android.BuildParams{
|
||||
Rule: aconfig.CreateStorageRule,
|
||||
Inputs: a.aconfigFiles,
|
||||
Output: outputFile,
|
||||
Description: info.Desc,
|
||||
Args: map[string]string{
|
||||
"container": ctx.ModuleName(),
|
||||
"file_type": info.File_type,
|
||||
"cache_files": android.JoinPathsWithPrefix(a.aconfigFiles, "--cache "),
|
||||
},
|
||||
})
|
||||
|
||||
copyCommands = append(copyCommands, "cp -f "+outputFile.String()+" "+aconfigDest)
|
||||
implicitInputs = append(implicitInputs, outputFile)
|
||||
defaultReadOnlyFiles = append(defaultReadOnlyFiles, "etc/"+outputFile.Base())
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// Step 2: create canned_fs_config which encodes filemode,uid,gid of each files
|
||||
// in this APEX. The file will be used by apexer in later steps.
|
||||
cannedFsConfig := a.buildCannedFsConfig(ctx, defaultReadOnlyFiles)
|
||||
cannedFsConfig := a.buildCannedFsConfig(ctx)
|
||||
implicitInputs = append(implicitInputs, cannedFsConfig)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1127,8 +1141,8 @@ func (a *apexBundle) buildLintReports(ctx android.ModuleContext) {
|
||||
a.lintReports = java.BuildModuleLintReportZips(ctx, depSetsBuilder.Build())
|
||||
}
|
||||
|
||||
func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext, defaultReadOnlyFiles []string) android.OutputPath {
|
||||
var readOnlyPaths = defaultReadOnlyFiles
|
||||
func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.OutputPath {
|
||||
var readOnlyPaths = []string{"apex_manifest.json", "apex_manifest.pb"}
|
||||
var executablePaths []string // this also includes dirs
|
||||
var appSetDirs []string
|
||||
appSetFiles := make(map[string]android.Path)
|
||||
|
Reference in New Issue
Block a user