diff options
| author | LaMont Jones <lamontjones@google.com> | 2023-11-06 22:11:08 +0000 |
|---|---|---|
| committer | LaMont Jones <lamontjones@google.com> | 2023-11-07 18:39:40 +0000 |
| commit | 9a9128610bc4f8a9b7b0ac365ca0e3720231da31 (patch) | |
| tree | 3982caa9341682bb81e62eeb3d524d134227a76b /ui | |
| parent | 216ed6c9181d56f65ee8750ad0f3723f511737fe (diff) | |
Readd support for PRODUCT_RELEASE_CONFIG_MAPS
This allows product config to determine what build flags are present in
a product's build, as well as their value.
As product config moves to a declarative specification, this can be
handled with less unnecessary work.
Bug: b/302593603, b/308849337, b/309477343
Test: manual
Change-Id: Ic0551990864bba6d03b6bf49fcfd4ae2523d9c6d
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/build/config.go | 37 | ||||
| -rw-r--r-- | ui/build/dumpvars.go | 3 |
2 files changed, 40 insertions, 0 deletions
diff --git a/ui/build/config.go b/ui/build/config.go index c33312be0..20d920485 100644 --- a/ui/build/config.go +++ b/ui/build/config.go @@ -31,6 +31,7 @@ import ( "time" "android/soong/shared" + "android/soong/ui/metrics" "google.golang.org/protobuf/proto" @@ -461,6 +462,42 @@ func NewBuildActionConfig(action BuildAction, dir string, ctx Context, args ...s return NewConfig(ctx, getConfigArgs(action, dir, ctx, args)...) } +// Prepare for getting make variables. For them to be accurate, we need to have +// obtained PRODUCT_RELEASE_CONFIG_MAPS. +// +// Returns: +// +// Whether config should be called again. +// +// TODO: when converting product config to a declarative language, make sure +// that PRODUCT_RELEASE_CONFIG_MAPS is properly handled as a separate step in +// that process. +func SetProductReleaseConfigMaps(ctx Context, config Config) bool { + ctx.BeginTrace(metrics.RunKati, "SetProductReleaseConfigMaps") + defer ctx.EndTrace() + + if config.SkipConfig() { + // This duplicates the logic from Build to skip product config + // if the user has explicitly said to. + return false + } + + releaseConfigVars := []string{ + "PRODUCT_RELEASE_CONFIG_MAPS", + } + + origValue, _ := config.environ.Get("PRODUCT_RELEASE_CONFIG_MAPS") + // Get the PRODUCT_RELEASE_CONFIG_MAPS for this product, to avoid polluting the environment + // when we run product config to get the rest of the make vars. + releaseMapVars, err := dumpMakeVars(ctx, config, nil, releaseConfigVars, false, "") + if err != nil { + ctx.Fatalln("Error getting PRODUCT_RELEASE_CONFIG_MAPS:", err) + } + productReleaseConfigMaps := releaseMapVars["PRODUCT_RELEASE_CONFIG_MAPS"] + os.Setenv("PRODUCT_RELEASE_CONFIG_MAPS", productReleaseConfigMaps) + return origValue != productReleaseConfigMaps +} + // storeConfigMetrics selects a set of configuration information and store in // the metrics system for further analysis. func storeConfigMetrics(ctx Context, config Config) { diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go index efe747819..d364542c5 100644 --- a/ui/build/dumpvars.go +++ b/ui/build/dumpvars.go @@ -191,6 +191,9 @@ func runMakeProductConfig(ctx Context, config Config) { "TARGET_BUILD_APPS", "TARGET_BUILD_UNBUNDLED", + // Additional release config maps + "PRODUCT_RELEASE_CONFIG_MAPS", + // compiler wrappers set up by make "CC_WRAPPER", "CXX_WRAPPER", |
