Soong filesystem may install aconfig_flags.pb am: 74f3f30ae4
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3046652 Change-Id: I3fe0139693348b205a2fa72186b991c6094f696f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -130,6 +130,7 @@ func aconfigUpdateAndroidBuildActions(ctx ModuleContext) {
|
||||
AconfigFiles: mergedAconfigFiles,
|
||||
ModeInfos: mergedModeInfos,
|
||||
})
|
||||
ctx.Module().base().aconfigFilePaths = getAconfigFilePaths(ctx.Module().base(), mergedAconfigFiles)
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -902,6 +902,9 @@ type ModuleBase struct {
|
||||
installedInitRcPaths InstallPaths
|
||||
installedVintfFragmentsPaths InstallPaths
|
||||
|
||||
// Merged Aconfig files for all transitive deps.
|
||||
aconfigFilePaths Paths
|
||||
|
||||
// set of dependency module:location mappings used to populate the license metadata for
|
||||
// apex containers.
|
||||
licenseInstallMap []string
|
||||
|
@@ -482,6 +482,10 @@ func (m *moduleContext) PackageFile(installPath InstallPath, name string, srcPat
|
||||
return m.packageFile(fullInstallPath, srcPath, false)
|
||||
}
|
||||
|
||||
func (m *moduleContext) getAconfigPaths() *Paths {
|
||||
return &m.module.base().aconfigFilePaths
|
||||
}
|
||||
|
||||
func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, executable bool) PackagingSpec {
|
||||
licenseFiles := m.Module().EffectiveLicenseFiles()
|
||||
spec := PackagingSpec{
|
||||
@@ -492,6 +496,7 @@ func (m *moduleContext) packageFile(fullInstallPath InstallPath, srcPath Path, e
|
||||
effectiveLicenseFiles: &licenseFiles,
|
||||
partition: fullInstallPath.partition,
|
||||
skipInstall: m.skipInstall(),
|
||||
aconfigPaths: m.getAconfigPaths(),
|
||||
}
|
||||
m.packagingSpecs = append(m.packagingSpecs, spec)
|
||||
return spec
|
||||
@@ -616,6 +621,7 @@ func (m *moduleContext) InstallSymlink(installPath InstallPath, name string, src
|
||||
executable: false,
|
||||
partition: fullInstallPath.partition,
|
||||
skipInstall: m.skipInstall(),
|
||||
aconfigPaths: m.getAconfigPaths(),
|
||||
})
|
||||
|
||||
return fullInstallPath
|
||||
@@ -658,6 +664,7 @@ func (m *moduleContext) InstallAbsoluteSymlink(installPath InstallPath, name str
|
||||
executable: false,
|
||||
partition: fullInstallPath.partition,
|
||||
skipInstall: m.skipInstall(),
|
||||
aconfigPaths: m.getAconfigPaths(),
|
||||
})
|
||||
|
||||
return fullInstallPath
|
||||
|
@@ -48,6 +48,9 @@ type PackagingSpec struct {
|
||||
// is created via InstallFile or InstallSymlink) or a simple packaging (i.e. created via
|
||||
// PackageFile).
|
||||
skipInstall bool
|
||||
|
||||
// Paths of aconfig files for the built artifact
|
||||
aconfigPaths *Paths
|
||||
}
|
||||
|
||||
func (p *PackagingSpec) Equals(other *PackagingSpec) bool {
|
||||
@@ -102,6 +105,11 @@ func (p *PackagingSpec) SkipInstall() bool {
|
||||
return p.skipInstall
|
||||
}
|
||||
|
||||
// Paths of aconfig files for the built artifact
|
||||
func (p *PackagingSpec) GetAconfigPaths() Paths {
|
||||
return *p.aconfigPaths
|
||||
}
|
||||
|
||||
type PackageModule interface {
|
||||
Module
|
||||
packagingBase() *PackagingBase
|
||||
|
@@ -15,6 +15,7 @@ bootstrap_go_package {
|
||||
"soong-phony", // for testing
|
||||
],
|
||||
srcs: [
|
||||
"aconfig_files.go",
|
||||
"avb_add_hash_footer.go",
|
||||
"avb_gen_vbmeta_image.go",
|
||||
"bootimg.go",
|
||||
|
58
filesystem/aconfig_files.go
Normal file
58
filesystem/aconfig_files.go
Normal file
@@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2024 The Android Open Source Project
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package filesystem
|
||||
|
||||
import (
|
||||
"android/soong/android"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint/proptools"
|
||||
)
|
||||
|
||||
func (f *filesystem) buildAconfigFlagsFiles(ctx android.ModuleContext, builder *android.RuleBuilder, specs map[string]android.PackagingSpec, dir android.Path) {
|
||||
if !proptools.Bool(f.properties.Gen_aconfig_flags_pb) {
|
||||
return
|
||||
}
|
||||
|
||||
aconfigFlagsBuilderPath := android.PathForModuleOut(ctx, "aconfig_flags_builder.sh")
|
||||
aconfigToolPath := ctx.Config().HostToolPath(ctx, "aconfig")
|
||||
cmd := builder.Command().Tool(aconfigFlagsBuilderPath).Implicit(aconfigToolPath)
|
||||
|
||||
installAconfigFlags := filepath.Join(dir.String(), "etc", "aconfig_flags_"+f.partitionName()+".pb")
|
||||
|
||||
var sb strings.Builder
|
||||
sb.WriteString("set -e\n")
|
||||
sb.WriteString(aconfigToolPath.String())
|
||||
sb.WriteString(" dump-cache --dedup --format protobuf --out ")
|
||||
sb.WriteString(installAconfigFlags)
|
||||
sb.WriteString(" \\\n")
|
||||
|
||||
var caches []string
|
||||
for _, ps := range specs {
|
||||
cmd.Implicits(ps.GetAconfigPaths())
|
||||
caches = append(caches, ps.GetAconfigPaths().Strings()...)
|
||||
}
|
||||
caches = android.SortedUniqueStrings(caches)
|
||||
|
||||
for _, cache := range caches {
|
||||
sb.WriteString(" --cache ")
|
||||
sb.WriteString(cache)
|
||||
sb.WriteString(" \\\n")
|
||||
}
|
||||
sb.WriteRune('\n')
|
||||
|
||||
android.WriteExecutableFileRuleVerbatim(ctx, aconfigFlagsBuilderPath, sb.String())
|
||||
}
|
@@ -131,6 +131,9 @@ type filesystemProperties struct {
|
||||
// Default is false
|
||||
Build_logtags *bool
|
||||
|
||||
// Install aconfig_flags.pb file for the modules installed in this partition.
|
||||
Gen_aconfig_flags_pb *bool
|
||||
|
||||
Fsverity fsverityProperties
|
||||
}
|
||||
|
||||
@@ -300,6 +303,7 @@ func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) androi
|
||||
f.addMakeBuiltFiles(ctx, builder, rootDir)
|
||||
f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
|
||||
f.buildEventLogtagsFile(ctx, builder, rebasedDir)
|
||||
f.buildAconfigFlagsFiles(ctx, builder, specs, rebasedDir)
|
||||
|
||||
// run host_init_verifier
|
||||
// Ideally we should have a concept of pluggable linters that verify the generated image.
|
||||
@@ -441,6 +445,7 @@ func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool)
|
||||
f.buildNonDepsFiles(ctx, builder, rootDir)
|
||||
f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
|
||||
f.buildEventLogtagsFile(ctx, builder, rebasedDir)
|
||||
f.buildAconfigFlagsFiles(ctx, builder, specs, rebasedDir)
|
||||
|
||||
output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
|
||||
cmd := builder.Command().
|
||||
|
Reference in New Issue
Block a user