diff options
author | Cole Faust <colefaust@google.com> | 2023-03-29 14:23:56 -0700 |
---|---|---|
committer | Cole Faust <colefaust@google.com> | 2023-03-30 11:32:02 -0700 |
commit | 2943cbd16f19a16fb48a34a16120dd8bdd7de9a3 (patch) | |
tree | 4aa1ff34f64ad6ab160b2d62380d8705e05e1d5e /product_config/BUILD | |
parent | e56079c25a5a6496303b20a65d7f6233716610ee (diff) | |
download | bazel-2943cbd16f19a16fb48a34a16120dd8bdd7de9a3.tar.gz |
Move the testing platforms out of soong_injection
I realized that we don't need to create all platforms in soong_injection
if we move the product_vars target out of soong_injection as well.
product_vars needs to be a select statement from all the products
to their _product_vars target, so we require all android_product()s
to "register" with that product_vars select statement.
Bug: 269577299
Test: b test --config=android //build/bazel/rules/apex:all
Change-Id: I47456ee1dbcc62af2c11cbff7e2b08152506eb29
Diffstat (limited to 'product_config/BUILD')
-rw-r--r-- | product_config/BUILD | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/product_config/BUILD b/product_config/BUILD index 0f16da2e..598c8b12 100644 --- a/product_config/BUILD +++ b/product_config/BUILD @@ -1,13 +1,12 @@ +load(":android_product.bzl", "all_android_product_labels") + package(default_visibility = ["//visibility:public"]) -# The current product we're building for. -# We could've chosen this product via a --platforms flag, -# or transitioned into it. This is used to select() on -# the current product. Note that this represents the current -# android _product_ as defined in pre-bazel terms. -# There are several bazel platforms that can resolve to -# the same product, for example the host platform and the -# device platform. +# The current product we're building for. We could've chosen this product via a --platforms flag, +# or transitioned into it. This is used to select() on the current product in the product_vars +# target below. Note that this represents the current android _product_ as defined in pre-bazel +# terms. There are several bazel platforms that can resolve to the same product, for example the +# host platform and the device platform. constraint_setting(name = "current_product") # This target can be used to read product variables that aren't represented by other constraint @@ -33,7 +32,12 @@ constraint_setting(name = "current_product") # This method of accessing product variables can't be used from macros / the bazel loading phase. # This is intentional, because if you could read them during the loading phase, you wouldn't be # able to transition into new values. Instead, please defer accesses to the analysis phase. +# +# All android_product()s must register their label here. alias( name = "product_vars", - actual = "@soong_injection//product_config_platforms:product_vars", + actual = select({ + label + "_constraint_value": label + "_product_vars" + for label in all_android_product_labels + }), ) |