aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2023-03-29 14:23:56 -0700
committerCole Faust <colefaust@google.com>2023-03-30 11:32:02 -0700
commit2943cbd16f19a16fb48a34a16120dd8bdd7de9a3 (patch)
tree4aa1ff34f64ad6ab160b2d62380d8705e05e1d5e /tests
parente56079c25a5a6496303b20a65d7f6233716610ee (diff)
downloadbazel-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 'tests')
-rw-r--r--tests/products/BUILD52
-rw-r--r--tests/products/product_labels.bzl7
2 files changed, 54 insertions, 5 deletions
diff --git a/tests/products/BUILD b/tests/products/BUILD
index b535fe5e..bb29788b 100644
--- a/tests/products/BUILD
+++ b/tests/products/BUILD
@@ -1,5 +1,47 @@
-# This package contains pregenerated soong.variables files for the aosp_<arch> products.
-# They're used to make platforms for testing in soong_injection. This is an optimization, we could
-# generate these directly from source at build time but it would add time to every `m nothing`.
-# Converting the product config makefiles to starlark and checking them in would also solve this
-# performance issue.
+load("@//build/bazel/product_config:android_product.bzl", "android_product")
+load("@//build/bazel/tests/products:aosp_arm.variables.bzl", _soong_variables_arm = "variables")
+load("@//build/bazel/tests/products:aosp_arm64.variables.bzl", _soong_variables_arm64 = "variables")
+load("@//build/bazel/tests/products:aosp_x86.variables.bzl", _soong_variables_x86 = "variables")
+load("@//build/bazel/tests/products:aosp_x86_64.variables.bzl", _soong_variables_x86_64 = "variables")
+load("@bazel_skylib//lib:dicts.bzl", "dicts")
+
+package(default_visibility = [
+ "@//build/bazel/product_config:__subpackages__",
+])
+
+# This package contains pregenerated soong.variables files for the aosp_<arch> products, used to
+# make platforms for testing. This is an optimization, we could generate these directly from source
+# at build time but it would add time to every `m nothing`. Converting the product config makefiles
+# to starlark and checking them in would also solve this performance issue.
+#
+# This is also where we can define platforms that have set product config variables to certain
+# values for testing. Unfortunately we cannot just transition on a single product config variable
+# due to limitations in bazel.
+
+android_product(
+ name = "aosp_arm_for_testing",
+ soong_variables = _soong_variables_arm,
+)
+
+android_product(
+ name = "aosp_arm64_for_testing",
+ soong_variables = _soong_variables_arm64,
+)
+
+android_product(
+ name = "aosp_x86_for_testing",
+ soong_variables = _soong_variables_x86,
+)
+
+android_product(
+ name = "aosp_x86_64_for_testing",
+ soong_variables = _soong_variables_x86_64,
+)
+
+android_product(
+ name = "aosp_arm64_for_testing_no_compression",
+ soong_variables = dicts.add(
+ _soong_variables_arm64,
+ {"CompressedApex": False},
+ ),
+)
diff --git a/tests/products/product_labels.bzl b/tests/products/product_labels.bzl
new file mode 100644
index 00000000..94175317
--- /dev/null
+++ b/tests/products/product_labels.bzl
@@ -0,0 +1,7 @@
+product_labels = [
+ "@//build/bazel/tests/products:aosp_arm_for_testing",
+ "@//build/bazel/tests/products:aosp_arm64_for_testing",
+ "@//build/bazel/tests/products:aosp_x86_for_testing",
+ "@//build/bazel/tests/products:aosp_x86_64_for_testing",
+ "@//build/bazel/tests/products:aosp_arm64_for_testing_no_compression",
+]