Merge "Use WithBash actions" into main
diff --git a/Android.bp b/Android.bp
index 523f55c..6c40661 100644
--- a/Android.bp
+++ b/Android.bp
@@ -147,16 +147,6 @@
// Framework guests.
cc_defaults {
name: "cc_baremetal_defaults",
- arch: {
- arm64: {
- cflags: [
- // Prevent the compiler from optimizing code using SVE, as the
- // baremetal environment might not have configured the hardware.
- "-Xclang -target-feature",
- "-Xclang -sve",
- ],
- },
- },
defaults_visibility: ["//visibility:public"],
}
diff --git a/aconfig/Android.bp b/aconfig/Android.bp
index 40aeee4..b9f09d2 100644
--- a/aconfig/Android.bp
+++ b/aconfig/Android.bp
@@ -36,6 +36,9 @@
// but other verticals/platforms can override via soong config setting.
all_aconfig_declarations {
name: "all_aconfig_declarations",
+ visibility: [
+ "//vendor:__subpackages__", // for vendor extensions
+ ],
api_signature_files: select(soong_config_variable("android_aconfig", "opt_platform_api_srcs"), {
default: [
":frameworks-base-api-current.txt",
diff --git a/aconfig/all_aconfig_declarations.go b/aconfig/all_aconfig_declarations.go
index b17820e..3d07e16 100644
--- a/aconfig/all_aconfig_declarations.go
+++ b/aconfig/all_aconfig_declarations.go
@@ -162,9 +162,7 @@
})
ctx.Phony("all_aconfig_declarations_textproto", this.releaseMap[rcName].intermediateTextProtoPath)
}
-}
-func (this *allAconfigDeclarationsSingleton) MakeVars(ctx android.MakeVarsContext) {
for _, rcName := range this.sortedConfigNames() {
ctx.DistForGoal("droid", this.releaseMap[rcName].intermediateBinaryProtoPath)
for _, goal := range []string{"docs", "droid", "sdk"} {
diff --git a/aconfig/all_aconfig_declarations_extension.go b/aconfig/all_aconfig_declarations_extension.go
index 44992cd..d5a4588 100644
--- a/aconfig/all_aconfig_declarations_extension.go
+++ b/aconfig/all_aconfig_declarations_extension.go
@@ -79,12 +79,10 @@
ctx.Phony(ctx.ModuleName(), ext.finalizedFlags)
+ ctx.DistForGoalWithFilename("sdk", ext.finalizedFlags, path.Join(proptools.String(ext.properties.Dist_dir), "finalized-flags.txt"))
+
// This module must not set any provider or call `ctx.SetOutputFiles`!
// This module is only used to depend on the singleton module all_aconfig_declarations and
// generate the custom finalized-flags.txt file in dist builds, and should not be depended
// by other modules.
}
-
-func (ext *allAconfigDeclarationsExtension) MakeVars(ctx android.MakeVarsContext) {
- ctx.DistForGoalWithFilename("sdk", ext.finalizedFlags, path.Join(proptools.String(ext.properties.Dist_dir), "finalized-flags.txt"))
-}
diff --git a/aconfig/build_flags/build_flags_singleton.go b/aconfig/build_flags/build_flags_singleton.go
index e76db49..e375d9c 100644
--- a/aconfig/build_flags/build_flags_singleton.go
+++ b/aconfig/build_flags/build_flags_singleton.go
@@ -111,9 +111,7 @@
this.configsBinaryProtoPath,
this.configsTextProtoPath,
)
-}
-func (this *allBuildFlagDeclarationsSingleton) MakeVars(ctx android.MakeVarsContext) {
ctx.DistForGoal("droid", this.flagsBinaryProtoPath)
for _, goal := range []string{"docs", "droid", "sdk", "release_config_metadata"} {
ctx.DistForGoalWithFilename(goal, this.flagsBinaryProtoPath, "build_flags/all_flags.pb")
diff --git a/aconfig/exported_java_aconfig_library.go b/aconfig/exported_java_aconfig_library.go
index dd068d1..63d824a 100644
--- a/aconfig/exported_java_aconfig_library.go
+++ b/aconfig/exported_java_aconfig_library.go
@@ -63,8 +63,5 @@
},
})
ctx.Phony("exported_java_aconfig_library", this.intermediatePath)
-}
-
-func (this *exportedJavaDeclarationsLibrarySingleton) MakeVars(ctx android.MakeVarsContext) {
ctx.DistForGoalWithFilename("sdk", this.intermediatePath, "android-flags.jar")
}
diff --git a/aconfig/init.go b/aconfig/init.go
index 210aec3..b2fe5a3 100644
--- a/aconfig/init.go
+++ b/aconfig/init.go
@@ -104,6 +104,7 @@
` --mode=exported` +
` --allow-instrumentation ${use_new_storage}` +
` --new-exported ${use_new_exported}` +
+ ` --single-exported-file true` +
` --check-api-level ${check_api_level}` +
` --out ${out}.tmp; ` +
` fi ` +
diff --git a/android/Android.bp b/android/Android.bp
index 540d65b..aef18fe 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -11,6 +11,7 @@
"blueprint-depset",
"blueprint-gobtools",
"blueprint-metrics",
+ "blueprint-pool",
"sbox_proto",
"soong",
"soong-android_team_proto",
diff --git a/android/all_teams.go b/android/all_teams.go
index 01be396..3b20107 100644
--- a/android/all_teams.go
+++ b/android/all_teams.go
@@ -134,9 +134,6 @@
WriteFileRuleVerbatim(ctx, t.outputPath, string(data))
ctx.Phony("all_teams", t.outputPath)
-}
-
-func (t *allTeamsSingleton) MakeVars(ctx MakeVarsContext) {
ctx.DistForGoal("all_teams", t.outputPath)
}
diff --git a/android/androidmk.go b/android/androidmk.go
index 951e03c..7d6b056 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -64,7 +64,6 @@
type AndroidMkData struct {
Class string
SubName string
- DistFiles TaggedDistFiles
OutputFile OptionalPath
Disabled bool
Include string
@@ -1093,7 +1092,6 @@
data.Entries = AndroidMkEntries{
Class: data.Class,
SubName: data.SubName,
- DistFiles: data.DistFiles,
OutputFile: data.OutputFile,
Disabled: data.Disabled,
Include: data.Include,
diff --git a/android/mutator.go b/android/mutator.go
index d6166d2..12861c0 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -15,9 +15,8 @@
package android
import (
- "sync"
-
"github.com/google/blueprint"
+ "github.com/google/blueprint/pool"
)
// Phases:
@@ -272,15 +271,9 @@
// for each transition mutator. bottomUpMutatorContext is created once for every module for every BottomUp mutator.
// Use a global pool for each to avoid reallocating every time.
var (
- outgoingTransitionContextPool = sync.Pool{
- New: func() any { return &outgoingTransitionContextImpl{} },
- }
- incomingTransitionContextPool = sync.Pool{
- New: func() any { return &incomingTransitionContextImpl{} },
- }
- bottomUpMutatorContextPool = sync.Pool{
- New: func() any { return &bottomUpMutatorContext{} },
- }
+ outgoingTransitionContextPool = pool.New[outgoingTransitionContextImpl]()
+ incomingTransitionContextPool = pool.New[incomingTransitionContextImpl]()
+ bottomUpMutatorContextPool = pool.New[bottomUpMutatorContext]()
)
type bottomUpMutatorContext struct {
@@ -291,10 +284,10 @@
// callers must immediately follow the call to this function with defer bottomUpMutatorContextPool.Put(mctx).
func bottomUpMutatorContextFactory(ctx blueprint.BottomUpMutatorContext, a Module,
- finalPhase bool) BottomUpMutatorContext {
+ finalPhase bool) *bottomUpMutatorContext {
moduleContext := a.base().baseModuleContextFactory(ctx)
- mctx := bottomUpMutatorContextPool.Get().(*bottomUpMutatorContext)
+ mctx := bottomUpMutatorContextPool.Get()
*mctx = bottomUpMutatorContext{
bp: ctx,
baseModuleContext: moduleContext,
diff --git a/android/sbom.go b/android/sbom.go
index f2b9c0f..fc61c41 100644
--- a/android/sbom.go
+++ b/android/sbom.go
@@ -84,12 +84,6 @@
Inputs: []Path{this.sbomFile},
Output: PathForPhony(ctx, "sbom"),
})
- }
-}
-
-func (this *sbomSingleton) MakeVars(ctx MakeVarsContext) {
- // When building SBOM of products
- if !ctx.Config().UnbundledBuildApps() {
ctx.DistForGoalWithFilename("droid", this.sbomFile, "sbom/sbom.spdx.json")
}
}
diff --git a/android/test_suites.go b/android/test_suites.go
index 936d2b6..18744f1 100644
--- a/android/test_suites.go
+++ b/android/test_suites.go
@@ -58,9 +58,6 @@
t.ravenwood = ravenwoodTestSuite(ctx, files["ravenwood-tests"])
ctx.Phony("ravenwood-tests", t.ravenwood...)
-}
-
-func (t *testSuiteFiles) MakeVars(ctx MakeVarsContext) {
ctx.DistForGoal("robolectric-tests", t.robolectric...)
ctx.DistForGoal("ravenwood-tests", t.ravenwood...)
}
diff --git a/android/transition.go b/android/transition.go
index e1aa891..0677ca1 100644
--- a/android/transition.go
+++ b/android/transition.go
@@ -197,7 +197,7 @@
func (a *androidTransitionMutatorAdapter) OutgoingTransition(bpctx blueprint.OutgoingTransitionContext,
sourceTransitionInfo blueprint.TransitionInfo) blueprint.TransitionInfo {
m := bpctx.Module().(Module)
- ctx := outgoingTransitionContextPool.Get().(*outgoingTransitionContextImpl)
+ ctx := outgoingTransitionContextPool.Get()
defer outgoingTransitionContextPool.Put(ctx)
*ctx = outgoingTransitionContextImpl{
archModuleContext: m.base().archModuleContextFactory(bpctx),
@@ -209,7 +209,7 @@
func (a *androidTransitionMutatorAdapter) IncomingTransition(bpctx blueprint.IncomingTransitionContext,
incomingTransitionInfo blueprint.TransitionInfo) blueprint.TransitionInfo {
m := bpctx.Module().(Module)
- ctx := incomingTransitionContextPool.Get().(*incomingTransitionContextImpl)
+ ctx := incomingTransitionContextPool.Get()
defer incomingTransitionContextPool.Put(ctx)
*ctx = incomingTransitionContextImpl{
archModuleContext: m.base().archModuleContextFactory(bpctx),
diff --git a/android/util.go b/android/util.go
index 30d8ec6..e8d9301 100644
--- a/android/util.go
+++ b/android/util.go
@@ -221,13 +221,13 @@
diff2 := []T{}
m1 := setFromList(l1)
m2 := setFromList(l2)
- for t := range m1 {
+ for _, t := range l1 {
if _, ok := m2[t]; !ok {
diff1 = append(diff1, t)
listsDiffer = true
}
}
- for t := range m2 {
+ for _, t := range l2 {
if _, ok := m1[t]; !ok {
diff2 = append(diff2, t)
listsDiffer = true
diff --git a/android/variable.go b/android/variable.go
index 4867067..aace6ed 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -664,6 +664,8 @@
ProductVirtualAbCompressionFactor string `json:",omitempty"`
ProductVirtualAbCowVersion string `json:",omitempty"`
AbOtaUpdater bool `json:",omitempty"`
+ AbOtaPartitions []string `json:",omitempty"`
+ AbOtaKeys []string `json:",omitempty"`
// Avb (android verified boot) stuff
BoardAvbEnable bool `json:",omitempty"`
diff --git a/apex/apex_singleton.go b/apex/apex_singleton.go
index 263e0a5..a8bd984 100644
--- a/apex/apex_singleton.go
+++ b/apex/apex_singleton.go
@@ -175,8 +175,5 @@
}
a.out = android.PathForOutput(ctx, "prebuilt_info.json")
android.WriteFileRule(ctx, a.out, string(j))
-}
-
-func (a *apexPrebuiltInfo) MakeVars(ctx android.MakeVarsContext) {
ctx.DistForGoal("droidcore", a.out)
}
diff --git a/bloaty/bloaty.go b/bloaty/bloaty.go
index 8ecea98..26f2aa8 100644
--- a/bloaty/bloaty.go
+++ b/bloaty/bloaty.go
@@ -105,13 +105,11 @@
}
})
+ protoFilenamePath := android.PathForOutput(ctx, protoFilename)
ctx.Build(pctx, android.BuildParams{
Rule: bloatyMerger,
Inputs: android.SortedUniquePaths(deps),
- Output: android.PathForOutput(ctx, protoFilename),
+ Output: protoFilenamePath,
})
-}
-
-func (singleton *sizesSingleton) MakeVars(ctx android.MakeVarsContext) {
- ctx.DistForGoalWithFilename("checkbuild", android.PathForOutput(ctx, protoFilename), protoFilename)
+ ctx.DistForGoalWithFilename("checkbuild", protoFilenamePath, protoFilename)
}
diff --git a/cc/ccdeps.go b/cc/ccdeps.go
index 469fe31..4247778 100644
--- a/cc/ccdeps.go
+++ b/cc/ccdeps.go
@@ -41,8 +41,6 @@
outputPath android.Path
}
-var _ android.SingletonMakeVarsProvider = (*ccdepsGeneratorSingleton)(nil)
-
const (
ccdepsJsonFileName = "module_bp_cc_deps.json"
cClang = "clang"
@@ -114,13 +112,6 @@
Rule: android.Touch,
Output: ccfpath,
})
-}
-
-func (c *ccdepsGeneratorSingleton) MakeVars(ctx android.MakeVarsContext) {
- if c.outputPath == nil {
- return
- }
-
ctx.DistForGoal("general-tests", c.outputPath)
}
diff --git a/cc/test.go b/cc/test.go
index 9f86c7a..b3b2ae8 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -442,6 +442,9 @@
if standaloneTestDep.ToGob().SrcPath == nil {
continue
}
+ if standaloneTestDep.SkipInstall() {
+ continue
+ }
test.binaryDecorator.baseInstaller.installStandaloneTestDep(ctx, standaloneTestDep)
}
}
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 960c96a..eb967ad 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -70,7 +70,9 @@
// blueprint:"mutated" and still set it from filesystem_creator
Main_device *bool
- Ab_ota_updater *bool
+ Ab_ota_updater *bool
+ Ab_ota_partitions []string
+ Ab_ota_keys []string
}
type androidDevice struct {
@@ -237,6 +239,26 @@
ctx.CheckbuildFile(allImagesStamp)
a.setVbmetaPhonyTargets(ctx)
+
+ a.distFiles(ctx)
+}
+
+func (a *androidDevice) distFiles(ctx android.ModuleContext) {
+ if !ctx.Config().KatiEnabled() {
+ if proptools.Bool(a.deviceProps.Main_device) {
+ fsInfoMap := a.getFsInfos(ctx)
+ for _, partition := range android.SortedKeys(fsInfoMap) {
+ fsInfo := fsInfoMap[partition]
+ if fsInfo.InstalledFiles.Json != nil {
+ ctx.DistForGoal("droidcore-unbundled", fsInfo.InstalledFiles.Json)
+ }
+ if fsInfo.InstalledFiles.Txt != nil {
+ ctx.DistForGoal("droidcore-unbundled", fsInfo.InstalledFiles.Txt)
+ }
+ }
+ }
+ }
+
}
func (a *androidDevice) MakeVars(ctx android.MakeVarsModuleContext) {
@@ -398,8 +420,12 @@
superPartition := ctx.GetDirectDepProxyWithTag(*a.partitionProps.Super_partition_name, superPartitionDepTag)
if info, ok := android.OtherModuleProvider(ctx, superPartition, SuperImageProvider); ok {
for _, partition := range android.SortedKeys(info.SubImageInfo) {
- builder.Command().Textf("cp ").Input(info.SubImageInfo[partition].OutputHermetic).Textf(" %s/IMAGES/", targetFilesDir.String())
- builder.Command().Textf("cp ").Input(info.SubImageInfo[partition].MapFile).Textf(" %s/IMAGES/", targetFilesDir.String())
+ if info.SubImageInfo[partition].OutputHermetic != nil {
+ builder.Command().Textf("cp ").Input(info.SubImageInfo[partition].OutputHermetic).Textf(" %s/IMAGES/", targetFilesDir.String())
+ }
+ if info.SubImageInfo[partition].MapFile != nil {
+ builder.Command().Textf("cp ").Input(info.SubImageInfo[partition].MapFile).Textf(" %s/IMAGES/", targetFilesDir.String())
+ }
}
} else {
ctx.ModuleErrorf("Super partition %s does set SuperImageProvider\n", superPartition.Name())
@@ -415,9 +441,24 @@
info, _ := android.OtherModuleProvider(ctx, child, android.OutputFilesProvider)
builder.Command().Textf("cp").Inputs(info.DefaultOutputFiles).Textf(" %s/META/", targetFilesDir.String())
})
+ builder.Command().Textf("cp").Input(android.PathForSource(ctx, "external/zucchini/version_info.h")).Textf(" %s/META/zucchini_config.txt", targetFilesDir.String())
+ builder.Command().Textf("cp").Input(android.PathForSource(ctx, "system/update_engine/update_engine.conf")).Textf(" %s/META/update_engine_config.txt", targetFilesDir.String())
+ if a.getFsInfos(ctx)["system"].ErofsCompressHints != nil {
+ builder.Command().Textf("cp").Input(a.getFsInfos(ctx)["system"].ErofsCompressHints).Textf(" %s/META/erofs_default_compress_hints.txt", targetFilesDir.String())
+ }
+ // ab_partitions.txt
+ abPartitionsSorted := android.SortedUniqueStrings(a.deviceProps.Ab_ota_partitions)
+ abPartitionsSortedString := proptools.ShellEscape(strings.Join(abPartitionsSorted, "\\n"))
+ builder.Command().Textf("echo -e").Flag(abPartitionsSortedString).Textf(" > %s/META/ab_partitions.txt", targetFilesDir.String())
+ // otakeys.txt
+ abOtaKeysSorted := android.SortedUniqueStrings(a.deviceProps.Ab_ota_keys)
+ abOtaKeysSortedString := proptools.ShellEscape(strings.Join(abOtaKeysSorted, "\\n"))
+ builder.Command().Textf("echo -e").Flag(abOtaKeysSortedString).Textf(" > %s/META/otakeys.txt", targetFilesDir.String())
+ // selinuxfc
+ if a.getFsInfos(ctx)["system"].SelinuxFc != nil {
+ builder.Command().Textf("cp").Input(a.getFsInfos(ctx)["system"].SelinuxFc).Textf(" %s/META/file_contexts.bin", targetFilesDir.String())
+ }
}
- builder.Command().Textf("cp").Input(android.PathForSource(ctx, "external/zucchini/version_info.h")).Textf(" %s/META/zucchini_config.txt", targetFilesDir.String())
- builder.Command().Textf("cp").Input(android.PathForSource(ctx, "system/update_engine/update_engine.conf")).Textf(" %s/META/update_engine_config.txt", targetFilesDir.String())
}
func (a *androidDevice) getFilesystemInfo(ctx android.ModuleContext, depName string) FilesystemInfo {
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 3f77433..0381951 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -36,6 +36,7 @@
func init() {
registerBuildComponents(android.InitRegistrationContext)
registerMutators(android.InitRegistrationContext)
+ pctx.HostBinToolVariable("fileslist", "fileslist")
}
func registerBuildComponents(ctx android.RegistrationContext) {
@@ -54,11 +55,24 @@
})
}
-// Remember to add referenced files to implicits!
-var textFileProcessorRule = pctx.AndroidStaticRule("text_file_processing", blueprint.RuleParams{
- Command: "build/soong/scripts/text_file_processor.py $in $out",
- CommandDeps: []string{"build/soong/scripts/text_file_processor.py"},
-})
+var (
+ // Remember to add referenced files to implicits!
+ textFileProcessorRule = pctx.AndroidStaticRule("text_file_processing", blueprint.RuleParams{
+ Command: "build/soong/scripts/text_file_processor.py $in $out",
+ CommandDeps: []string{"build/soong/scripts/text_file_processor.py"},
+ })
+
+ // Remember to add the output image file as an implicit dependency!
+ installedFilesJsonRule = pctx.AndroidStaticRule("installed_files_json", blueprint.RuleParams{
+ Command: `${fileslist} ${rootDir} > ${out}`,
+ CommandDeps: []string{"${fileslist}"},
+ }, "rootDir")
+
+ installedFilesTxtRule = pctx.AndroidStaticRule("installed_files_txt", blueprint.RuleParams{
+ Command: `build/make/tools/fileslist_util.py -c ${in} > ${out}`,
+ CommandDeps: []string{"build/make/tools/fileslist_util.py"},
+ })
+)
type filesystem struct {
android.ModuleBase
@@ -76,6 +90,8 @@
entries []string
filesystemBuilder filesystemBuilder
+
+ selinuxFc android.Path
}
type filesystemBuilder interface {
@@ -358,6 +374,11 @@
return fs == unknown
}
+type InstalledFilesStruct struct {
+ Txt android.Path
+ Json android.Path
+}
+
type FilesystemInfo struct {
// The built filesystem image
Output android.Path
@@ -391,6 +412,15 @@
SpecsForSystemOther map[string]android.PackagingSpec
FullInstallPaths []FullInstallPathInfo
+
+ // Installed files list
+ InstalledFiles InstalledFilesStruct
+
+ // Path to compress hints file for erofs filesystems
+ // This will be nil for other fileystems like ext4
+ ErofsCompressHints android.Path
+
+ SelinuxFc android.Path
}
// FullInstallPathInfo contains information about the "full install" paths of all the files
@@ -498,6 +528,34 @@
}
}
+func buildInstalledFiles(ctx android.ModuleContext, partition string, rootDir android.Path, image android.Path) (txt android.ModuleOutPath, json android.ModuleOutPath) {
+ fileName := "installed-files"
+ if len(partition) > 0 {
+ fileName += fmt.Sprintf("-%s", partition)
+ }
+ txt = android.PathForModuleOut(ctx, fmt.Sprintf("%s.txt", fileName))
+ json = android.PathForModuleOut(ctx, fmt.Sprintf("%s.json", fileName))
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: installedFilesJsonRule,
+ Implicit: image,
+ Output: json,
+ Description: "Installed file list json",
+ Args: map[string]string{
+ "rootDir": rootDir.String(),
+ },
+ })
+
+ ctx.Build(pctx, android.BuildParams{
+ Rule: installedFilesTxtRule,
+ Input: json,
+ Output: txt,
+ Description: "Installed file list txt",
+ })
+
+ return txt, json
+}
+
var pctx = android.NewPackageContext("android/soong/filesystem")
func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -578,6 +636,17 @@
fileListFile := android.PathForModuleOut(ctx, "fileList")
android.WriteFileRule(ctx, fileListFile, f.installedFilesList())
+ partitionName := f.partitionName()
+ if partitionName == "system" {
+ partitionName = ""
+ }
+ installedFileTxt, installedFileJson := buildInstalledFiles(ctx, partitionName, rootDir, f.output)
+
+ var erofsCompressHints android.Path
+ if f.properties.Erofs.Compress_hints != nil {
+ erofsCompressHints = android.PathForModuleSrc(ctx, *f.properties.Erofs.Compress_hints)
+ }
+
fsInfo := FilesystemInfo{
Output: f.output,
OutputHermetic: outputHermetic,
@@ -590,6 +659,12 @@
BuildImagePropFileDeps: buildImagePropFileDeps,
SpecsForSystemOther: f.systemOtherFiles(ctx),
FullInstallPaths: fullInstallPaths,
+ InstalledFiles: InstalledFilesStruct{
+ Txt: installedFileTxt,
+ Json: installedFileJson,
+ },
+ ErofsCompressHints: erofsCompressHints,
+ SelinuxFc: f.selinuxFc,
}
android.SetProvider(ctx, FilesystemProvider, fsInfo)
@@ -936,12 +1011,12 @@
if f.properties.File_contexts != nil && f.properties.Precompiled_file_contexts != nil {
ctx.ModuleErrorf("file_contexts and precompiled_file_contexts cannot both be set")
} else if f.properties.File_contexts != nil {
- addPath("selinux_fc", f.buildFileContexts(ctx))
+ f.selinuxFc = f.buildFileContexts(ctx)
} else if f.properties.Precompiled_file_contexts != nil {
- src := android.PathForModuleSrc(ctx, *f.properties.Precompiled_file_contexts)
- if src != nil {
- addPath("selinux_fc", src)
- }
+ f.selinuxFc = android.PathForModuleSrc(ctx, *f.properties.Precompiled_file_contexts)
+ }
+ if f.selinuxFc != nil {
+ addPath("selinux_fc", f.selinuxFc)
}
if timestamp := proptools.String(f.properties.Fake_timestamp); timestamp != "" {
addStr("timestamp", timestamp)
diff --git a/filesystem/super_image.go b/filesystem/super_image.go
index da007bb..58c938a 100644
--- a/filesystem/super_image.go
+++ b/filesystem/super_image.go
@@ -291,8 +291,6 @@
switch p {
case "system":
handleSubPartition("system", s.partitionProps.System_partition)
- // TODO: add system_other to deps after it can be generated
- //getFsInfo("system_other", s.partitionProps.System_other_partition, &subImageInfo.System_other)
case "system_dlkm":
handleSubPartition("system_dlkm", s.partitionProps.System_dlkm_partition)
case "system_ext":
@@ -321,8 +319,7 @@
if len(systemOtherFiles) != 1 {
ctx.PropertyErrorf("system_other_partition", "Expected 1 output file from module %q", *&s.properties.System_other_partition)
} else {
- addStr("system_other_image", systemOtherFiles[0].String())
- deps = append(deps, systemOtherFiles[0])
+ handleSubPartition("system_other", s.partitionProps.System_other_partition)
}
}
diff --git a/filesystem/system_other.go b/filesystem/system_other.go
index 28fe1ce..1c00dd3 100644
--- a/filesystem/system_other.go
+++ b/filesystem/system_other.go
@@ -85,6 +85,7 @@
output := android.PathForModuleOut(ctx, "system_other.img")
stagingDir := android.PathForModuleOut(ctx, "staging_dir")
+ stagingDirTimestamp := android.PathForModuleOut(ctx, "staging_dir.timestamp")
builder := android.NewRuleBuilder(pctx, ctx)
builder.Command().Textf("rm -rf %s && mkdir -p %s", stagingDir, stagingDir)
@@ -113,6 +114,8 @@
if len(m.properties.Preinstall_dexpreopt_files_from) > 0 {
builder.Command().Textf("touch %s", filepath.Join(stagingDir.String(), "system-other-odex-marker"))
}
+ builder.Command().Textf("touch").Output(stagingDirTimestamp)
+ builder.Build("assemble_filesystem_staging_dir", "Assemble filesystem staging dir")
// Most of the time, if build_image were to call a host tool, it accepts the path to the
// host tool in a field in the prop file. However, it doesn't have that option for fec, which
@@ -120,6 +123,7 @@
fec := ctx.Config().HostToolPath(ctx, "fec")
pathToolDirs := []string{filepath.Dir(fec.String())}
+ builder = android.NewRuleBuilder(pctx, ctx)
builder.Command().
Textf("PATH=%s:$PATH", strings.Join(pathToolDirs, ":")).
BuiltTool("build_image").
@@ -127,11 +131,44 @@
Input(systemInfo.BuildImagePropFile).
Implicits(systemInfo.BuildImagePropFileDeps).
Implicit(fec).
+ Implicit(stagingDirTimestamp).
Output(output).
Text(stagingDir.String())
builder.Build("build_system_other", "build system other")
+ // Create a hermetic system_other.img with pinned timestamps
+ builder = android.NewRuleBuilder(pctx, ctx)
+ outputHermetic := android.PathForModuleOut(ctx, "for_target_files", "system_other.img")
+ outputHermeticPropFile := m.propFileForHermeticImg(ctx, builder, systemInfo.BuildImagePropFile)
+ builder.Command().
+ Textf("PATH=%s:$PATH", strings.Join(pathToolDirs, ":")).
+ BuiltTool("build_image").
+ Text(stagingDir.String()). // input directory
+ Input(outputHermeticPropFile).
+ Implicits(systemInfo.BuildImagePropFileDeps).
+ Implicit(fec).
+ Implicit(stagingDirTimestamp).
+ Output(outputHermetic).
+ Text(stagingDir.String())
+
+ builder.Build("build_system_other_hermetic", "build system other")
+
+ fsInfo := FilesystemInfo{
+ Output: output,
+ OutputHermetic: outputHermetic,
+ RootDir: stagingDir,
+ }
+
+ android.SetProvider(ctx, FilesystemProvider, fsInfo)
+
ctx.SetOutputFiles(android.Paths{output}, "")
ctx.CheckbuildFile(output)
}
+
+func (f *systemOtherImage) propFileForHermeticImg(ctx android.ModuleContext, builder *android.RuleBuilder, inputPropFile android.Path) android.Path {
+ propFilePinnedTimestamp := android.PathForModuleOut(ctx, "for_target_files", "prop")
+ builder.Command().Textf("cat").Input(inputPropFile).Flag(">").Output(propFilePinnedTimestamp).
+ Textf(" && echo use_fixed_timestamp=true >> %s", propFilePinnedTimestamp)
+ return propFilePinnedTimestamp
+}
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index 2c2da17..9217e1c 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -381,8 +381,9 @@
partitionProps.Vbmeta_partitions = vbmetaPartitions
deviceProps := &filesystem.DeviceProperties{
- Main_device: proptools.BoolPtr(true),
- Ab_ota_updater: proptools.BoolPtr(ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.AbOtaUpdater),
+ Main_device: proptools.BoolPtr(true),
+ Ab_ota_updater: proptools.BoolPtr(ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.AbOtaUpdater),
+ Ab_ota_partitions: ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.AbOtaPartitions,
}
if bootloader, ok := f.createBootloaderFilegroup(ctx); ok {
deviceProps.Bootloader = proptools.StringPtr(":" + bootloader)
diff --git a/java/droidstubs.go b/java/droidstubs.go
index c8f798a..caad688 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -1429,6 +1429,16 @@
d.setOutputFiles(ctx)
d.setPhonyRules(ctx)
+
+ if d.apiLintTimestamp != nil {
+ if d.apiLintReport != nil {
+ ctx.DistForGoalsWithFilename(
+ []string{fmt.Sprintf("%s-api-lint", d.Name()), "droidcore"},
+ d.apiLintReport,
+ fmt.Sprintf("apilint/%s-lint-report.txt", d.Name()),
+ )
+ }
+ }
}
func setDroidInfo(ctx android.ModuleContext, d *Droidstubs, info *StubsInfo, typ StubsType) {
@@ -1524,18 +1534,6 @@
}
)
-func (d *Droidstubs) MakeVars(ctx android.MakeVarsModuleContext) {
- if d.apiLintTimestamp != nil {
- if d.apiLintReport != nil {
- ctx.DistForGoalsWithFilename(
- []string{fmt.Sprintf("%s-api-lint", d.Name()), "droidcore"},
- d.apiLintReport,
- fmt.Sprintf("apilint/%s-lint-report.txt", d.Name()),
- )
- }
- }
-}
-
func StubsDefaultsFactory() android.Module {
module := &DocDefaults{}
diff --git a/java/java.go b/java/java.go
index 91b7cf2..383fc3f 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1282,13 +1282,6 @@
Input: j.implementationAndResourcesJar,
Output: j.apiXmlFile,
})
- }
-}
-
-var _ android.ModuleMakeVarsProvider = (*Library)(nil)
-
-func (j *Library) MakeVars(ctx android.MakeVarsModuleContext) {
- if j.apiXmlFile != nil {
ctx.DistForGoal("dist_files", j.apiXmlFile)
}
}
diff --git a/java/jdeps.go b/java/jdeps.go
index c2ce503..927c169 100644
--- a/java/jdeps.go
+++ b/java/jdeps.go
@@ -37,8 +37,6 @@
outputPath android.Path
}
-var _ android.SingletonMakeVarsProvider = (*jdepsGeneratorSingleton)(nil)
-
const (
jdepsJsonFileName = "module_bp_java_deps.json"
)
@@ -101,13 +99,6 @@
Rule: android.Touch,
Output: jfpath,
})
-}
-
-func (j *jdepsGeneratorSingleton) MakeVars(ctx android.MakeVarsContext) {
- if j.outputPath == nil {
- return
- }
-
ctx.DistForGoal("general-tests", j.outputPath)
}
diff --git a/java/lint.go b/java/lint.go
index 3838745..66f7f85 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -704,16 +704,12 @@
zip(l.referenceBaselineZip, func(l *LintInfo) android.Path { return l.ReferenceBaseline })
ctx.Phony("lint-check", l.htmlZip, l.textZip, l.xmlZip, l.referenceBaselineZip)
-}
-func (l *lintSingleton) MakeVars(ctx android.MakeVarsContext) {
if !ctx.Config().UnbundledBuild() {
ctx.DistForGoal("lint-check", l.htmlZip, l.textZip, l.xmlZip, l.referenceBaselineZip)
}
}
-var _ android.SingletonMakeVarsProvider = (*lintSingleton)(nil)
-
func init() {
android.RegisterParallelSingletonType("lint",
func() android.Singleton { return &lintSingleton{} })
diff --git a/java/platform_compat_config.go b/java/platform_compat_config.go
index bb98944..d4d2fb5 100644
--- a/java/platform_compat_config.go
+++ b/java/platform_compat_config.go
@@ -278,12 +278,7 @@
rule.Build("merged-compat-config", "Merge compat config")
p.metadata = outputPath
-}
-
-func (p *platformCompatConfigSingleton) MakeVars(ctx android.MakeVarsContext) {
- if p.metadata != nil {
- ctx.DistForGoal("droidcore", p.metadata)
- }
+ ctx.DistForGoal("droidcore", p.metadata)
}
func platformCompatConfigSingletonFactory() android.Singleton {
diff --git a/phony/phony.go b/phony/phony.go
index 4f61c45..807b95b 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -38,11 +38,9 @@
type phony struct {
android.ModuleBase
-
requiredModuleNames []string
hostRequiredModuleNames []string
targetRequiredModuleNames []string
- outputDeps android.Paths
}
func PhonyFactory() android.Module {
@@ -56,14 +54,6 @@
p.requiredModuleNames = ctx.RequiredModuleNames(ctx)
p.hostRequiredModuleNames = ctx.HostRequiredModuleNames()
p.targetRequiredModuleNames = ctx.TargetRequiredModuleNames()
-
- ctx.VisitDirectDepsWithTag(android.RequiredDepTag, func(dep android.Module) {
- if o, ok := android.OtherModuleProvider(ctx, dep, android.OutputFilesProvider); ok {
- p.outputDeps = append(p.outputDeps, o.DefaultOutputFiles...)
- }
- })
-
- ctx.Phony(p.Name(), p.outputDeps...)
}
func (p *phony) AndroidMk() android.AndroidMkData {
@@ -87,10 +77,6 @@
fmt.Fprintln(w, "LOCAL_TARGET_REQUIRED_MODULES :=",
strings.Join(p.targetRequiredModuleNames, " "))
}
- if len(p.outputDeps) > 0 {
- fmt.Fprintln(w, "LOCAL_ADDITIONAL_DEPENDENCIES :=",
- strings.Join(p.outputDeps.Strings(), " "))
- }
// AconfigUpdateAndroidMkData may have added elements to Extra. Process them here.
for _, extra := range data.Extra {
extra(w, nil)
diff --git a/provenance/provenance_singleton.go b/provenance/provenance_singleton.go
index c372db2..c1bc1c7 100644
--- a/provenance/provenance_singleton.go
+++ b/provenance/provenance_singleton.go
@@ -99,6 +99,7 @@
})
context.Phony("droidcore", android.PathForPhony(context, "provenance_metadata"))
+ context.DistForGoal("droidcore", p.mergedMetaDataFile)
}
func GenerateArtifactProvenanceMetaData(ctx android.ModuleContext, artifactPath android.Path, installedFile android.InstallPath) android.Path {
@@ -116,9 +117,3 @@
return artifactMetaDataFile
}
-
-func (p *provenanceInfoSingleton) MakeVars(ctx android.MakeVarsContext) {
- ctx.DistForGoal("droidcore", p.mergedMetaDataFile)
-}
-
-var _ android.SingletonMakeVarsProvider = (*provenanceInfoSingleton)(nil)
diff --git a/rust/androidmk.go b/rust/androidmk.go
index 8de6b60..9894684 100644
--- a/rust/androidmk.go
+++ b/rust/androidmk.go
@@ -92,9 +92,6 @@
func (binary *binaryDecorator) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkEntries) {
ctx.SubAndroidMk(ret, binary.baseCompiler)
- if binary.distFile.Valid() {
- ret.DistFiles = android.MakeDefaultDistFiles(binary.distFile.Path())
- }
ret.Class = "EXECUTABLES"
}
@@ -143,9 +140,6 @@
} else if library.shared() {
ret.Class = "SHARED_LIBRARIES"
}
- if library.distFile.Valid() {
- ret.DistFiles = android.MakeDefaultDistFiles(library.distFile.Path())
- }
ret.ExtraEntries = append(ret.ExtraEntries,
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if library.tocFile.Valid() {
@@ -158,10 +152,6 @@
ctx.SubAndroidMk(ret, procMacro.baseCompiler)
ret.Class = "PROC_MACRO_LIBRARIES"
- if procMacro.distFile.Valid() {
- ret.DistFiles = android.MakeDefaultDistFiles(procMacro.distFile.Path())
- }
-
}
func (sourceProvider *BaseSourceProvider) AndroidMk(ctx AndroidMkContext, ret *android.AndroidMkEntries) {
diff --git a/rust/compiler.go b/rust/compiler.go
index f186ef3..c3bc937 100644
--- a/rust/compiler.go
+++ b/rust/compiler.go
@@ -257,8 +257,6 @@
location installLocation
sanitize *sanitize
- distFile android.OptionalPath
-
installDeps android.InstallPaths
// unstripped output file.