aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/bootstrap
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2017-06-14 15:46:05 +0200
committerGravatar Yun Peng <pcloudy@google.com>2017-06-14 16:21:05 +0200
commit03f78f55a50fe2a2202b0b2cc46697faa2869533 (patch)
tree184d6727e8c3916b670bb763b6a97f35eeceba0f /scripts/bootstrap
parentba69b39468954ed382dc50bc3fc22a1446c5f9d8 (diff)
Windows, bootstrapping: fix bootstrap_test
Compute the --host_jvm_args for the bazel.windows_unix_root JVM flag on Windows. After commit 9c54e2a764f0ddd2d3787aade1c530c5f43bd26c it's the Bazel client's job to compute this JVM flag and pass to the server, but during bootstrapping we run Bazel in a client-less mode. Fixes https://github.com/bazelbuild/bazel/issues/3186 Change-Id: I2facfdef7d301d8a96213b488728e3ae6aec1c33 PiperOrigin-RevId: 158972256
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-xscripts/bootstrap/compile.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 74b6e85986..3fcffba31e 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -302,6 +302,31 @@ function build_jni() {
fi
}
+# Computes the value of the bazel.windows_unix_root JVM flag.
+# Prints the JVM flag verbatim on Windows, ready to be passed to the JVM.
+# Prints an empty string on other platforms.
+function windows_unix_root_jvm_flag() {
+ if [ "${PLATFORM}" != "windows" ]; then
+ echo ""
+ return
+ fi
+ [ -n "${BAZEL_SH}" ] || fail "\$BAZEL_SH is not defined"
+ if [ "$(basename "$BAZEL_SH")" = "bash.exe" ]; then
+ local result="$(dirname "$BAZEL_SH")"
+ if [ "$(basename "$result")" = "bin" ]; then
+ result="$(dirname "$result")"
+ if [ "$(basename "$result")" = "usr" ]; then
+ result="$(dirname "$result")"
+ fi
+ # Print the JVM flag. Replace backslashes with forward slashes so the JVM
+ # and the shell won't believe that backslashes are escaping characters.
+ echo "-Dbazel.windows_unix_root=${result//\\//}"
+ return
+ fi
+ fi
+ fail "\$BAZEL_SH=${BAZEL_SH}, must end with \"bin\\bash.exe\" or \"usr\\bin\\bash.exe\""
+}
+
build_jni "${ARCHIVE_DIR}/_embedded_binaries"
cp src/main/tools/jdk.BUILD ${ARCHIVE_DIR}/_embedded_binaries/jdk.BUILD
@@ -341,6 +366,7 @@ function run_bazel_jar() {
"${JAVA_HOME}/bin/java" \
-XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Dfile.encoding=ISO-8859-1 \
-XX:HeapDumpPath=${OUTPUT_DIR} \
+ $(windows_unix_root_jvm_flag) \
-Djava.util.logging.config.file=${OUTPUT_DIR}/javalog.properties \
${JNI_FLAGS} \
-jar ${ARCHIVE_DIR}/libblaze.jar \