From 2943cbd16f19a16fb48a34a16120dd8bdd7de9a3 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Wed, 29 Mar 2023 14:23:56 -0700 Subject: 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 --- tests/products/BUILD | 52 +++++++++++++++++++++++++++++++++++---- tests/products/product_labels.bzl | 7 ++++++ 2 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 tests/products/product_labels.bzl (limited to 'tests') 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_ 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_ 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", +] -- cgit v1.2.3