From ad874816a8d323c71fae3a970a6826d3691628a7 Mon Sep 17 00:00:00 2001 From: schmitt Date: Fri, 29 Mar 2019 12:40:38 -0700 Subject: [PATCH] Remove explicitly set target platform value and replace it by fallback. The original value for the target platform was set at the dawn of time when we didn't have auto-calculation for it yet. Now that we do the explicit setting interferes with platform mapping which assumes that the target platform value is empty unless the user explicitly requests otherwise. This change introduces a new flag, --target_platform_fallsback which can be used to set the fallback in case there is no matching mapping. Because it uses the old defaults no behavioral change should be observed as long as no mappings exist. Step 5/N towards the platforms mapping functionality for https://github.com/bazelbuild/bazel/issues/6426 RELNOTES: None. PiperOrigin-RevId: 241031610 --- .../build/lib/analysis/PlatformOptions.java | 19 ++++++++++++++++--- .../skyframe/PlatformMappingFunctionTest.java | 5 +++-- .../skyframe/PlatformMappingValueTest.java | 7 ++++--- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java b/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java index 89d0b9056ad009..926f69b08982a4 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java @@ -38,8 +38,6 @@ public class PlatformOptions extends FragmentOptions { Label.parseAbsoluteUnchecked("@bazel_tools//platforms:host_platform"); public static final Label DEFAULT_HOST_PLATFORM = Label.parseAbsoluteUnchecked("@local_config_platform//:host"); - public static final Label LEGACY_DEFAULT_TARGET_PLATFORM = - Label.parseAbsoluteUnchecked("@bazel_tools//platforms:target_platform"); /** * Main workspace-relative location to use when the user does not explicitly set {@code @@ -92,6 +90,21 @@ public class PlatformOptions extends FragmentOptions { + "command.") public List