aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Brian Silverman <brian@peloton-tech.com>2016-04-11 14:31:31 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-04-12 13:57:34 +0000
commit93c0fbb812d3a3a68d3870954a8fbf4cd51d682e (patch)
tree1a082014f54db1d6d0ab9d3ab5aaf0e837b621b0 /src/main/java/com/google/devtools/build
parentbf066be6d1f8166101807ff94772bbeffe0252da (diff)
Don't make racy changes to the global Environment.Frame
6f15335 Make labels in .bzl files in remote repos resolve relative [...] introduced a Frame#setLabel which is documented to create a new Frame but instead modifies the existing one. This results in the global environment being modified in-place. I've been seeing some strange errors about not finding various packages in the wrong repositories which seems to be fixed by this change. -- Change-Id: I9b8521e50f45cfd385b20491315904ff0e24dcf6 Reviewed-on: https://bazel-review.googlesource.com/#/c/3300 MOS_MIGRATED_REVID=119529142
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/syntax/Environment.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
index 2338b3183f..8c1def42b2 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/Environment.java
@@ -121,8 +121,9 @@ public final class Environment implements Freezable {
* @return a new Frame with the existing frame's properties plus the label.
*/
public Frame setLabel(Label label) {
- this.label = label;
- return this;
+ Frame result = new Frame(mutability, this);
+ result.label = label;
+ return result;
}
/**