Remove --noexperimental_platform_in_output_dir
This is a followup to aosp/2606989.
This flag is not necessary now that we're using one platform name
for all of mixed builds.
Also rename current_product to mixed_builds_product so that it's clear
that that this platform should only be used for mixed builds.
In addition, make the bazelrc files point to the named products again
instead of the mixed build product so that b builds will still have
qualified outputs, but mixed builds won't.
Test: Presubmit and kernel build tools abtd run
Change-Id: I7f764cf42cd1323f4b495d1320931f59a076ac63
diff --git a/bp2build/bp2build_product_config.go b/bp2build/bp2build_product_config.go
index 66d0cc5..7224496 100644
--- a/bp2build/bp2build_product_config.go
+++ b/bp2build/bp2build_product_config.go
@@ -72,8 +72,13 @@
load("//{PRODUCT_FOLDER}:soong.variables.bzl", _soong_variables = "variables")
load("@//build/bazel/product_config:android_product.bzl", "android_product")
+# Bazel will qualify its outputs by the platform name. When switching between products, this
+# means that soong-built files that depend on bazel-built files will suddenly get different
+# dependency files, because the path changes, and they will be rebuilt. In order to avoid this
+# extra rebuilding, make mixed builds always use a single platform so that the bazel artifacts
+# are always under the same path.
android_product(
- name = "current_product-{VARIANT}",
+ name = "mixed_builds_product-{VARIANT}",
soong_variables = _soong_variables,
)
`)),
@@ -86,7 +91,7 @@
# TODO: When we start generating the platforms for more than just the
# currently lunched product, they should all be listed here
product_labels = [
- "@soong_injection//product_config_platforms:current_product-{VARIANT}",
+ "@soong_injection//product_config_platforms:mixed_builds_product-{VARIANT}",
"@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}"
]
`)),
@@ -94,38 +99,25 @@
"product_config_platforms",
"common.bazelrc",
productReplacer.Replace(`
-# current_product refers to the current TARGET_PRODUCT set, usually through
-# 'lunch' or 'banchan'. Every build will have a primary TARGET_PRODUCT, but
-# bazel supports using other products in tests or configuration transitions. The
-# other products can be found in
-# @soong_injection//product_config_platforms/products/...
-build --platforms @soong_injection//product_config_platforms:current_product-{VARIANT}_linux_x86_64
+build --platforms @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_x86_64
-build:android --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}
-build:linux_x86_64 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_x86_64
-build:linux_bionic_x86_64 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_bionic_x86_64
-build:linux_musl_x86 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_musl_x86
-build:linux_musl_x86_64 --platforms=@soong_injection//product_config_platforms:current_product-{VARIANT}_linux_musl_x86_64
+build:android --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}
+build:linux_x86_64 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_x86_64
+build:linux_bionic_x86_64 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_bionic_x86_64
+build:linux_musl_x86 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_musl_x86
+build:linux_musl_x86_64 --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_musl_x86_64
`)),
newFile(
"product_config_platforms",
"linux.bazelrc",
productReplacer.Replace(`
-build --host_platform @soong_injection//product_config_platforms:current_product-{VARIANT}_linux_x86_64
+build --host_platform @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_x86_64
`)),
newFile(
"product_config_platforms",
"darwin.bazelrc",
productReplacer.Replace(`
-build --host_platform product_config_platforms:current_product-{VARIANT}_darwin_x86_64
-`)),
- newFile(
- "product_config_platforms",
- "platform_mappings",
- productReplacer.Replace(`
-flags:
- --cpu=k8
- @soong_injection//product_config_platforms:current_product-{VARIANT}
+build --host_platform @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_darwin_x86_64
`)),
}