aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Brian Silverman <bsilver16384@gmail.com>2015-10-14 18:35:02 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2015-10-15 10:59:19 +0000
commit636d2c6b3fe19ca661ffcc80e7950dde981abe9a (patch)
tree9ea9186173540418ad51b68d16b289b269a59f5b /src/main
parent6afd4167fabf9fb292167f70b20b674829c0739a (diff)
Fix changing the build_file for new_* rules
It used to not change the symlink to point to the new one. The failure modes were different when the old file existed vs not, so there are tests for both. -- Change-Id: I6328c56a90254c5da78ccf827d377900bde06e90 Reviewed-on: https://bazel-review.googlesource.com/#/c/2131/ MOS_MIGRATED_REVID=105432042
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java
index d3880912cc..87c28d56d5 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/RepositoryFunction.java
@@ -223,9 +223,11 @@ public abstract class RepositoryFunction implements SkyFunction {
private static FileValue createSymbolicLink(Path from, Path to, Environment env)
throws RepositoryFunctionException {
try {
- if (!from.exists()) {
- from.createSymbolicLink(to);
+ // Remove not-symlinks that are already there.
+ if (from.exists()) {
+ from.delete();
}
+ FileSystemUtils.ensureSymbolicLink(from, to);
} catch (IOException e) {
throw new RepositoryFunctionException(
new IOException(String.format("Error creating symbolic link from %s to %s: %s",