Add product_config module
product_config module will export productVariables struct (defined in
android/variable.go). Other modules can depend on product_Config module
to read product variables, without needing to update Soong.
Bug: 346214955
Test: build and see output of product_config module
Change-Id: I06e1d2716dc2a8b90984bb46c5fc901cd1ca5020
diff --git a/ui/build/config.go b/ui/build/config.go
index feded1c..a217d48 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -1488,6 +1488,15 @@
}
}
+func (c *configImpl) SoongExtraVarsFile() string {
+ targetProduct, err := c.TargetProductOrErr()
+ if err != nil {
+ return filepath.Join(c.SoongOutDir(), "soong.extra.variables")
+ } else {
+ return filepath.Join(c.SoongOutDir(), "soong."+targetProduct+".extra.variables")
+ }
+}
+
func (c *configImpl) SoongNinjaFile() string {
targetProduct, err := c.TargetProductOrErr()
if err != nil {
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 2f3150d..99474d9 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -694,6 +694,7 @@
}
}
distFile(ctx, config, config.SoongVarsFile(), "soong")
+ distFile(ctx, config, config.SoongExtraVarsFile(), "soong")
if !config.SkipKati() {
distGzipFile(ctx, config, config.SoongAndroidMk(), "soong")
diff --git a/ui/build/test_build.go b/ui/build/test_build.go
index 24ad082..687ad6f 100644
--- a/ui/build/test_build.go
+++ b/ui/build/test_build.go
@@ -64,7 +64,8 @@
outDir := config.OutDir()
modulePathsDir := filepath.Join(outDir, ".module_paths")
rawFilesDir := filepath.Join(outDir, "soong", "raw")
- variablesFilePath := filepath.Join(outDir, "soong", "soong.variables")
+ variablesFilePath := config.SoongVarsFile()
+ extraVariablesFilePath := config.SoongExtraVarsFile()
// dexpreopt.config is an input to the soong_docs action, which runs the
// soong_build primary builder. However, this file is created from $(shell)
@@ -95,6 +96,7 @@
if strings.HasPrefix(line, modulePathsDir) ||
strings.HasPrefix(line, rawFilesDir) ||
line == variablesFilePath ||
+ line == extraVariablesFilePath ||
line == dexpreoptConfigFilePath ||
line == buildDatetimeFilePath ||
line == bpglob ||