Allow passing a comma-separated list of strategies to the strategy flags.
Any strategy except the first one in a list is currently ignored. This
feature will be used in follow up changes to implement a new way of
specifying execution strategies and to improve the configurability of
execution fallback (e.g. remote to local, sandboxed to non-sandboxed).
RELNOTES: None.
PiperOrigin-RevId: 234849292
diff --git a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
index c8444fd..88e36d5 100644
--- a/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/exec/ExecutionOptions.java
@@ -24,7 +24,9 @@
import com.google.devtools.build.lib.util.ResourceConverter;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.common.options.BoolOrEnumConverter;
-import com.google.devtools.common.options.Converters.AssignmentConverter;
+import com.google.devtools.common.options.Converters.AssignmentToListOfValuesConverter;
+import com.google.devtools.common.options.Converters.CommaSeparatedNonEmptyOptionListConverter;
+import com.google.devtools.common.options.Converters.CommaSeparatedOptionListConverter;
import com.google.devtools.common.options.Option;
import com.google.devtools.common.options.OptionDocumentationCategory;
import com.google.devtools.common.options.OptionEffectTag;
@@ -58,6 +60,7 @@
@Option(
name = "spawn_strategy",
defaultValue = "",
+ converter = CommaSeparatedNonEmptyOptionListConverter.class,
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
@@ -65,23 +68,24 @@
+ "'standalone' means run all of them locally without any kind of sandboxing. "
+ "'sandboxed' means to run them in a sandboxed environment with limited privileges "
+ "(details depend on platform support).")
- public String spawnStrategy;
+ public List<String> spawnStrategy;
@Option(
name = "genrule_strategy",
defaultValue = "",
+ converter = CommaSeparatedOptionListConverter.class,
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
help =
"Specify how to execute genrules. This flag will be phased out. Instead, use "
+ "--spawn_strategy=<value> to control all actions or --strategy=Genrule=<value> "
+ "to control genrules only.")
- public String genruleStrategy;
+ public List<String> genruleStrategy;
@Option(
name = "strategy",
allowMultiple = true,
- converter = AssignmentConverter.class,
+ converter = AssignmentToListOfValuesConverter.class,
defaultValue = "",
documentationCategory = OptionDocumentationCategory.UNCATEGORIZED,
effectTags = {OptionEffectTag.UNKNOWN},
@@ -89,7 +93,7 @@
"Specify how to distribute compilation of other spawn actions. "
+ "Example: 'Javac=local' means to spawn Java compilation locally. "
+ "'JavaIjar=sandboxed' means to spawn Java Ijar actions in a sandbox. ")
- public List<Map.Entry<String, String>> strategy;
+ public List<Map.Entry<String, List<String>>> strategy;
@Option(
name = "strategy_regexp",
@@ -109,7 +113,7 @@
+ "Example: --strategy_regexp='Compiling.*/bar=local "
+ " --strategy_regexp=Compiling=sandboxed will run 'Compiling //foo/bar/baz' with "
+ "the 'local' strategy, but reversing the order would run it with 'sandboxed'. ")
- public List<Map.Entry<RegexFilter, String>> strategyByRegexp;
+ public List<Map.Entry<RegexFilter, List<String>>> strategyByRegexp;
@Option(
name = "materialize_param_files",