From 2f5048d3992b0815dcce2dda8ceceb1147e78e8f Mon Sep 17 00:00:00 2001 From: gregce Date: Mon, 22 Nov 2021 17:31:03 -0800 Subject: [PATCH 1/3] Support select() on constraint_value for aliases. This implements approach #4 of https://github.com/bazelbuild/bazel/issues/13047#issuecomment-805309450. The basic change adds a new toolchain resolution mode: "resolve iff the target has a select()". It then sets alias() to that mode. We could remove this special casing if we ever ubiquitously provide platfrom info to *all* rules (https://github.com/bazelbuild/bazel/issues/12899#issuecomment-767759147). RELNOTES: alias() can now select() directly on constraint_value() Fixes https://github.com/bazelbuild/bazel/issues/13047. PiperOrigin-RevId: 411684872 Change-Id: I998ef9bba3226871651fc14bd9ed268e9a3de82c --- .../devtools/build/lib/packages/Rule.java | 26 +++++++++++ .../build/lib/packages/RuleClass.java | 27 ++++++++++-- .../cquery/ConfiguredTargetAccessor.java | 2 +- .../devtools/build/lib/rules/Alias.java | 5 ++- .../skyframe/ConfiguredTargetFunction.java | 2 +- .../lib/skyframe/PlatformLookupUtil.java | 12 +++--- .../analysis/ConfigurableAttributesTest.java | 43 +++++++++++++++++++ 7 files changed, 105 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/packages/Rule.java b/src/main/java/com/google/devtools/build/lib/packages/Rule.java index 1c9ba345b37619..59598f282b89e2 100644 --- a/src/main/java/com/google/devtools/build/lib/packages/Rule.java +++ b/src/main/java/com/google/devtools/build/lib/packages/Rule.java @@ -35,6 +35,7 @@ import com.google.devtools.build.lib.packages.ImplicitOutputsFunction.StarlarkImplicitOutputsFunction; import com.google.devtools.build.lib.packages.License.DistributionType; import com.google.devtools.build.lib.packages.Package.ConfigSettingVisibilityPolicy; +import com.google.devtools.build.lib.packages.RuleClass.ToolchainResolutionMode; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; @@ -942,6 +943,31 @@ public Collection