summaryrefslogtreecommitdiff
path: root/android/config.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2025-01-08 13:05:40 -0800
committer Cole Faust <colefaust@google.com> 2025-01-08 14:25:18 -0800
commitc5bfbddeec6d81be1fef37a8c2dffe00947a7df0 (patch)
tree351151893cd2c8c4b7fece629a568dab9224d19f /android/config.go
parente7893d750914543f02274136116c50be8a15a205 (diff)
Support disting in soong-only builds
Disting was normally handled by the packaging kati step, which was not run in soong-only builds. Disting needs to be done in a separate ninja file, so that if you toggle dist on/off you only need to regenerate a small ninja file instead of the main one. This change makes it so that the kati packaging step is also run in soong-only builds. (which makes them not technically soong-only, but the packaging step is very fast so it's fine) Phonies in soong were normally exported to the main make invocation and then make would emit the ninja rules for them. In soong-only builds soong would emit the ninja phone rules directly. This is problematic when supporting disting in soong, because some of the phony rules have the same name as dist targets, causing ninja to complain about duplicate rules. To resolve this, make soong export its phonies to the packaging step, which will dedup them with the dist phonies. Bug: 388312357 Test: m --soong-only dist Change-Id: If6de8c28274fe96dac674f449b9bc0b488540655
Diffstat (limited to 'android/config.go')
-rw-r--r--android/config.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/android/config.go b/android/config.go
index e9cb2cd31..70c5e4f28 100644
--- a/android/config.go
+++ b/android/config.go
@@ -83,6 +83,7 @@ type CmdArgs struct {
OutDir string
SoongOutDir string
SoongVariables string
+ KatiSuffix string
ModuleGraphFile string
ModuleActionsFile string
@@ -349,6 +350,7 @@ type config struct {
// Changes behavior based on whether Kati runs after soong_build, or if soong_build
// runs standalone.
katiEnabled bool
+ katiSuffix string
captureBuild bool // true for tests, saves build parameters for each module
ignoreEnvironment bool // true for tests, returns empty from all Getenv calls
@@ -620,6 +622,7 @@ func NewConfig(cmdArgs CmdArgs, availableEnv map[string]string) (Config, error)
outDir: cmdArgs.OutDir,
soongOutDir: cmdArgs.SoongOutDir,
runGoTests: cmdArgs.RunGoTests,
+ katiSuffix: cmdArgs.KatiSuffix,
multilibConflicts: make(map[ArchType]bool),
moduleListFile: cmdArgs.ModuleListFile,
@@ -1512,6 +1515,10 @@ func (c *config) VendorApiLevelFrozen() bool {
return c.productVariables.GetBuildFlagBool("RELEASE_BOARD_API_LEVEL_FROZEN")
}
+func (c *config) katiPackageMkDir() string {
+ return filepath.Join(c.soongOutDir, "kati_packaging"+c.katiSuffix)
+}
+
func (c *deviceConfig) Arches() []Arch {
var arches []Arch
for _, target := range c.config.Targets[Android] {