aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/BUILD5
-rw-r--r--src/main/tools/build-runfiles.cc7
2 files changed, 10 insertions, 2 deletions
diff --git a/src/BUILD b/src/BUILD
index 7ff67d458f..98460b1868 100644
--- a/src/BUILD
+++ b/src/BUILD
@@ -155,7 +155,10 @@ genrule(
"package-zip" + suffix,
],
outs = ["bazel" + suffix],
- cmd = "cat $(location //src/main/cpp:client) $(location :package-zip" + suffix + ") > $@ && zip -qA $@",
+ # In msys, a file path without .exe suffix(say foo), refers to a file with .exe
+ # suffix(say foo.exe), if foo.exe exists and foo doesn't. So, on windows, we
+ # need to remove bazel.exe first, so that cat to bazel won't fail.
+ cmd = "rm -f $@; cat $(location //src/main/cpp:client) $(location :package-zip" + suffix + ") > $@ && zip -qA $@",
executable = 1,
output_to_bindir = 1,
visibility = [
diff --git a/src/main/tools/build-runfiles.cc b/src/main/tools/build-runfiles.cc
index 935568f660..cbf096d648 100644
--- a/src/main/tools/build-runfiles.cc
+++ b/src/main/tools/build-runfiles.cc
@@ -260,8 +260,13 @@ class RunfilesCreator {
}
FileInfoMap::iterator expected_it = manifest_.find(entry_path);
+ // When windows_compatible is enabled, if the hard link already existing
+ // is still
+ // in the mainifest, no need to recreate it.
+ // Note: here we assume the content won't change, which might not be true
+ // in some rare cases.
if (expected_it == manifest_.end() ||
- expected_it->second != actual_info) {
+ (!windows_compatible_ && expected_it->second != actual_info)) {
DelTree(entry_path, actual_info.type);
} else {
manifest_.erase(expected_it);