Move --repo_env to common options
Move --repo_env into common options and inject the value through CommandEnvironment since CommonCommandOptions cannot be accessed in SkyframeExecutor directly due to a circular dependency in the build.
Addresses https://github.com/bazelbuild/bazel/issues/12689
Closes #13003.
PiperOrigin-RevId: 365035772
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
index 98e7f9e..03bb561 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
@@ -491,6 +491,20 @@
+ "one.")
public boolean keepStateAfterBuild;
+ @Option(
+ name = "repo_env",
+ converter = Converters.OptionalAssignmentConverter.class,
+ allowMultiple = true,
+ defaultValue = "null",
+ documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
+ effectTags = {OptionEffectTag.ACTION_COMMAND_LINES},
+ help =
+ "Specifies additional environment variables to be available only for repository rules."
+ + " Note that repository rules see the full environment anyway, but in this way"
+ + " configuration information can be passed to repositories through options without"
+ + " invalidating the action graph.")
+ public List<Map.Entry<String, String>> repositoryEnvironment;
+
/** The option converter to check that the user can only specify legal profiler tasks. */
public static class ProfilerTaskConverter extends EnumConverter<ProfilerTask> {
public ProfilerTaskConverter() {