From c602cec7887470db3e8ed69600f5bd2f38e160d5 Mon Sep 17 00:00:00 2001 From: Googler Date: Fri, 10 Mar 2023 14:38:08 -0800 Subject: [PATCH] Allow --extra_execution_platforms to support overrides by making it no longer "allowMultiple". RELNOTES: Subsequent settings of --extra_execution_platforms now override previous settings, instead of adding them to a list. If you currently set --extra_execution_platforms more than once, please migrate by passing a list of values to --extra_execution_platforms instead so that earlier values aren't overwritten. current --extra_execution_platforms=platform1 --extra_execution_platforms=platform2 future --extra_execution_platforms=platform1,platform2 PiperOrigin-RevId: 515741836 Change-Id: I435f6a18482b1890d401ef31d5c4c94fde7e9ff3 --- site/en/docs/user-manual.md | 2 ++ .../google/devtools/build/lib/analysis/PlatformOptions.java | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/site/en/docs/user-manual.md b/site/en/docs/user-manual.md index 7a567bc2f31f41..75aa2d974f8d99 100644 --- a/site/en/docs/user-manual.md +++ b/site/en/docs/user-manual.md @@ -1326,6 +1326,8 @@ The platforms that are available as execution platforms to run actions. Platforms can be specified by exact target, or as a target pattern. These platforms will be considered before those declared in the WORKSPACE file by [register_execution_platforms()](/rules/lib/globals#register_execution_platforms). +This option accepts a comma-separated list of platforms in order of priority. +If the flag is passed multiple times, the most recent overrides. #### `--extra_toolchains={{ "" }}labels{{ "" }}` {:#extra-toolchains} 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 a217fc85bf4bf3..6d1c021fa8e15c 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 @@ -76,15 +76,15 @@ public static boolean platformIsDefault(Label platform) { @Option( name = "extra_execution_platforms", converter = CommaSeparatedOptionListConverter.class, - defaultValue = "null", + defaultValue = "", documentationCategory = OptionDocumentationCategory.TOOLCHAIN, - allowMultiple = true, effectTags = {OptionEffectTag.EXECUTION}, help = "The platforms that are available as execution platforms to run actions. " + "Platforms can be specified by exact target, or as a target pattern. " + "These platforms will be considered before those declared in the WORKSPACE file by " - + "register_execution_platforms().") + + "register_execution_platforms(). This option may only be set once; later " + + "instances will override earlier flag settings.") public List extraExecutionPlatforms; @Option(