aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xscripts/ci/windows/compile_windows.sh2
-rw-r--r--src/main/cpp/blaze_util.cc3
-rwxr-xr-xsrc/test/shell/bazel/test-setup.sh17
3 files changed, 20 insertions, 2 deletions
diff --git a/scripts/ci/windows/compile_windows.sh b/scripts/ci/windows/compile_windows.sh
index ae94928068..15b091f152 100755
--- a/scripts/ci/windows/compile_windows.sh
+++ b/scripts/ci/windows/compile_windows.sh
@@ -33,7 +33,7 @@ if [[ "$JAVA_HOME" == "" ]]; then
fi
# These variables are temporarily needed for Bazel
-export BAZEL_SH="c:/tools/msys64/usr/bin/bash.exe"
+export BAZEL_SH="$(cygpath --windows /bin/bash)"
export TMPDIR=${TMPDIR:-c:/bazel_ci/temp}
mkdir -p "${TMPDIR}" # mkdir does work with a path starting with 'c:/', wow
diff --git a/src/main/cpp/blaze_util.cc b/src/main/cpp/blaze_util.cc
index f1126db5bc..912f825680 100644
--- a/src/main/cpp/blaze_util.cc
+++ b/src/main/cpp/blaze_util.cc
@@ -63,9 +63,10 @@ string GetUserName() {
// If called from working directory "/bar":
// MakeAbsolute("foo") --> "/bar/foo"
// MakeAbsolute("/foo") ---> "/foo"
+// MakeAbsolute("C:/foo") ---> "C:/foo"
string MakeAbsolute(const string &path) {
// Check if path is already absolute.
- if (path.empty() || path[0] == '/') {
+ if (path.empty() || path[0] == '/' || (isalpha(path[0]) && path[1] == ':')) {
return path;
}
diff --git a/src/test/shell/bazel/test-setup.sh b/src/test/shell/bazel/test-setup.sh
index 8ed875b2cf..e93fa4a814 100755
--- a/src/test/shell/bazel/test-setup.sh
+++ b/src/test/shell/bazel/test-setup.sh
@@ -32,8 +32,22 @@ echo "bazel binary is at $bazel"
# Here we unset variable that were set by the invoking Blaze instance
unset JAVA_RUNFILES
+function is_windows() {
+ # On windows, the shell test actually running on msys
+ if [ "${PLATFORM}" == "msys_nt-6.1" ]; then
+ true
+ else
+ false
+ fi
+}
+
function setup_bazelrc() {
+ # enable batch mode when running on windows
+ if is_windows; then
+ BATCH_MODE="startup --batch"
+ fi
cat >$TEST_TMPDIR/bazelrc <<EOF
+${BATCH_MODE:-}
startup --output_user_root=${bazel_root}
startup --host_javabase=${bazel_javabase}
build -j 8
@@ -380,6 +394,9 @@ function setup_clean_workspace() {
export BAZEL_INSTALL_BASE=$(bazel info install_base)
export BAZEL_GENFILES_DIR=$(bazel info bazel-genfiles)
export BAZEL_BIN_DIR=$(bazel info bazel-bin)
+ if is_windows; then
+ export BAZEL_SH="$(cygpath --windows /bin/bash)"
+ fi
}
# Clean up all files that are not in tools directories, to restart