aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java1
-rwxr-xr-xsrc/test/shell/bazel/runfiles_test.sh39
-rwxr-xr-xsrc/test/shell/integration/runfiles_test.sh29
3 files changed, 68 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java b/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java
index 73e8c40b7f..36f3b50d48 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/SourceManifestAction.java
@@ -193,6 +193,7 @@ public final class SourceManifestAction extends AbstractFileWriteAction {
Fingerprint f = new Fingerprint();
f.addString(GUID);
f.addBoolean(runfiles.getLegacyExternalRunfiles());
+ f.addPath(runfiles.getSuffix());
Map<PathFragment, Artifact> symlinks = runfiles.getSymlinksAsMap(null);
f.addInt(symlinks.size());
for (Map.Entry<PathFragment, Artifact> symlink : symlinks.entrySet()) {
diff --git a/src/test/shell/bazel/runfiles_test.sh b/src/test/shell/bazel/runfiles_test.sh
index 33205b86d2..ded1184fcb 100755
--- a/src/test/shell/bazel/runfiles_test.sh
+++ b/src/test/shell/bazel/runfiles_test.sh
@@ -53,4 +53,43 @@ EOF
[[ -x bazel-bin/foo/foo.runfiles/$name/foo/foo ]] || fail "No foo executable under $name"
}
+function test_legacy_runfiles_change() {
+ cat > WORKSPACE <<EOF
+workspace(name = "foo")
+
+new_local_repository(
+ name = "bar",
+ path = ".",
+ build_file = "BUILD",
+)
+EOF
+
+ cat > BUILD <<EOF
+exports_files(glob(["*"]))
+
+cc_binary(
+ name = "thing",
+ srcs = ["thing.cc"],
+ data = ["@bar//:thing.cc"],
+)
+EOF
+ cat > thing.cc <<EOF
+int main() { return 0; }
+EOF
+ bazel build --legacy_external_runfiles //:thing &> $TEST_log \
+ || fail "Build failed"
+ [[ -d bazel-bin/thing.runfiles/foo/external/bar ]] \
+ || fail "bar not found"
+
+ bazel build --nolegacy_external_runfiles //:thing &> $TEST_log \
+ || fail "Build failed"
+ [[ ! -d bazel-bin/thing.runfiles/foo/external/bar ]] \
+ || fail "Old bar still found"
+
+ bazel build --legacy_external_runfiles //:thing &> $TEST_log \
+ || fail "Build failed"
+ [[ -d bazel-bin/thing.runfiles/foo/external/bar ]] \
+ || fail "bar not recreated"
+}
+
run_suite "runfiles tests"
diff --git a/src/test/shell/integration/runfiles_test.sh b/src/test/shell/integration/runfiles_test.sh
index 6821b30dcd..8cd6ff5ca4 100755
--- a/src/test/shell/integration/runfiles_test.sh
+++ b/src/test/shell/integration/runfiles_test.sh
@@ -148,5 +148,32 @@ EOF
diff -u <(sort MANIFEST) <(sort MANIFEST2)
}
-run_suite "runfiles"
+function test_workspace_name_change() {
+ cat > WORKSPACE <<EOF
+workspace(name = "foo")
+EOF
+
+ cat > BUILD <<EOF
+cc_binary(
+ name = "thing",
+ srcs = ["thing.cc"],
+ data = ["BUILD"],
+)
+EOF
+ cat > thing.cc <<EOF
+int main() { return 0; }
+EOF
+ bazel build //:thing &> $TEST_log || fail "Build failed"
+ [[ -d ${PRODUCT_NAME}-bin/thing.runfiles/foo ]] || fail "foo not found"
+ cat > WORKSPACE <<EOF
+workspace(name = "bar")
+EOF
+ bazel build //:thing &> $TEST_log || fail "Build failed"
+ [[ -d ${PRODUCT_NAME}-bin/thing.runfiles/bar ]] || fail "bar not found"
+ [[ ! -d ${PRODUCT_NAME}-bin/thing.runfiles/foo ]] \
+ || fail "Old foo still found"
+}
+
+
+run_suite "runfiles"