From 17d8c492c999d7d08663642a213a7733fe698a4c Mon Sep 17 00:00:00 2001 From: Luca Di Grazia Date: Sun, 4 Sep 2022 20:15:56 +0200 Subject: [PATCH] Add platform mapping function. Introduces a new SkyFunction which reads a platform mapping file, parses its contents and produces a platform mapping sky value which can then be used to apply the mapping to configurations (in the form of BuildConfigurationValue.Key). The file's location is obtained from the newly introduced flag --platform_mappings and defaults to //:platform_mappings. Note that this logic is not in use anywhere yet because the key mapping has not been applied. This will follow in a future CL. Step 4/N towards the platforms mapping functionality for https://github.com/bazelbuild/bazel/issues/6426 RELNOTES: None. PiperOrigin-RevId: 239043475 --- .../build/lib/analysis/PlatformOptions.java | 26 ++----- .../lib/skyframe/PlatformMappingFunction.java | 36 ++++------ .../lib/skyframe/PlatformMappingValue.java | 26 ++----- .../build/lib/skyframe/SkyFunctions.java | 2 - .../build/lib/skyframe/SkyframeExecutor.java | 24 +++---- .../PlatformMappingFunctionParserTest.java | 70 ++++--------------- .../skyframe/PlatformMappingFunctionTest.java | 5 +- .../skyframe/PlatformMappingValueTest.java | 7 +- 8 files changed, 50 insertions(+), 146 deletions(-) diff --git a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java index 926f69b0898..391aae39f8f 100644 --- a/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java +++ b/dataset/GitHub_Java/bazelbuild.bazel/src/main/java/com/google/devtools/build/lib/analysis/PlatformOptions.java @@ -38,6 +38,8 @@ 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 @@ -90,21 +92,6 @@ public class PlatformOptions extends FragmentOptions { + "command.") public List