diff options
author | 2017-06-28 11:32:07 +0200 | |
---|---|---|
committer | 2017-06-28 15:26:37 +0200 | |
commit | 6e940e573d20a3220ac433901c5650ee74226a17 (patch) | |
tree | 0042dced8f717911d50d6ae9f3f926deceaf5784 /src/main/java/com/google/devtools/build/lib/exec | |
parent | 0a0d7a48095a893efe41a6e54deb57f47d750594 (diff) |
Add ActionEnvironment, which is a wrapper class for a fixed+inherited env
We are currently tracking the action environment (computed from --action_env),
and the test action environment (computed from --test_env, and not including
the action env) as two pairs of fields, and a lot of callers haven't been
updated to handle both parts (TestRunnerAction does, but many 'normal' actions
don't). However, both parts have always both be handled, and moving them into
a single abstraction makes it harder to accidentally miss one part.
We'll subsequently need to update all the action implementations to use the
new abstraction, and also update the Skylark API (or bypass it and always apply
the action environment for all actions, except we don't know which
configuration to use).
PiperOrigin-RevId: 160386181
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/exec')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/exec/TestPolicy.java | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/exec/TestPolicy.java b/src/main/java/com/google/devtools/build/lib/exec/TestPolicy.java index 5685601008..09bf0e04b3 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/TestPolicy.java +++ b/src/main/java/com/google/devtools/build/lib/exec/TestPolicy.java @@ -88,22 +88,10 @@ public class TestPolicy { env.putAll(testAction.getExtraTestEnv()); // Overwrite with the environment common to all actions, see --action_env. - env.putAll(testAction.getConfiguration().getLocalShellEnvironment()); - for (String key : testAction.getConfiguration().getVariableShellEnvironment()) { - String value = clientEnv.get(key); - if (value != null) { - env.put(key, value); - } - } + testAction.getConfiguration().getActionEnvironment().resolve(env, clientEnv); // Overwrite with the environment common to all tests, see --test_env. - env.putAll(testAction.getConfiguration().getTestEnv()); - for (String key : testAction.getConfiguration().getInheritedTestEnv()) { - String value = clientEnv.get(key); - if (value != null) { - env.put(key, value); - } - } + testAction.getConfiguration().getTestActionEnvironment().resolve(env, clientEnv); // Setup any test-specific env variables; note that this does not overwrite existing values for // TEST_RANDOM_SEED or TEST_SIZE if they're already set. |