Add an info item to show the currently inherited client environment
Add 'bazel info client-env' which outputs entries for the configuration
file that would freeze the current client environment. The main intended use case
is to use 'bazel info client-env >> .bazelrc' to keep the project reproducible
once a suitable value for the environment variables that used to be taken from the
client environment has been found.
--
Change-Id: Ib4d14dd824d223f335a4d4de04ee21c4a3ec4d83
Reviewed-on: https://bazel-review.googlesource.com/#/c/6112
MOS_MIGRATED_REVID=133699234
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
index 73c00d3..1208995 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommandEnvironment.java
@@ -166,10 +166,10 @@
}
/**
- * Return an ordered version of the client environment restricted to those variables
- * whitelisted by the command-line options to be inheritable by actions.
+ * Return an ordered version of the client environment restricted to those variables whitelisted
+ * by the command-line options to be inheritable by actions.
*/
- private Map<String, String> getCommandlineWhitelistedClientEnv() {
+ public Map<String, String> getWhitelistedClientEnv() {
Map<String, String> visibleEnv = new TreeMap<>();
for (String var : visibleClientEnv) {
String value = clientEnv.get(var);
@@ -426,7 +426,7 @@
getCommandId(),
// TODO(bazel-team): this optimization disallows rule-specified additional dependencies
// on the client environment!
- getCommandlineWhitelistedClientEnv(),
+ getWhitelistedClientEnv(),
timestampGranularityMonitor);
}