-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
Fixes #11301 PiperOrigin-RevId: 312470710
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
|
||
package com.google.devtools.build.lib.runtime; | ||
|
||
import static com.google.common.collect.ImmutableList.toImmutableList; | ||
import static com.google.devtools.build.lib.analysis.config.CoreOptionConverters.BUILD_SETTING_CONVERTERS; | ||
import static com.google.devtools.build.lib.packages.RuleClass.Builder.STARLARK_BUILD_SETTING_DEFAULT_ATTR_NAME; | ||
import static com.google.devtools.build.lib.packages.Type.BOOLEAN; | ||
|
@@ -216,6 +217,24 @@ private Target loadBuildSetting( | |
return buildSetting; | ||
} | ||
|
||
/** | ||
* Separates out any Starlark options from the given list | ||
* | ||
* @param list List of strings from which to parse out starlark options | ||
* @return Returns a pair of string lists. The first item contains the list of starlark options | ||
* that were removed; the second contains the remaining string from the original list. | ||
*/ | ||
public static Pair<ImmutableList<String>, ImmutableList<String>> removeStarlarkOptions( | ||
List<String> list) { | ||
ImmutableList<String> removed = | ||
list.stream() | ||
.filter(r -> r.startsWith("--//") || r.startsWith("--no//")) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
juliexxia
Author
Contributor
|
||
.collect(toImmutableList()); | ||
ImmutableList<String> kept = | ||
list.stream().filter(r -> !removed.contains(r)).collect(toImmutableList()); | ||
return Pair.of(removed, kept); | ||
} | ||
|
||
@VisibleForTesting | ||
public static StarlarkOptionsParser newStarlarkOptionsParserForTesting( | ||
SkyframeExecutor skyframeExecutor, | ||
|
@juliexxia this doesn't include starlark options from external repositories, right? e.g. in rules_jvm_external, users can set
--@rules_jvm_external//setting:stamp_manifest
(bazel-contrib/rules_jvm_external#355)