aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/bootstrap/buildenv.sh
diff options
context:
space:
mode:
authorGravatar László Csomor <laszlocsomor@google.com>2017-02-13 15:46:28 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2017-02-14 14:18:14 +0000
commit3c0c2624e1b64cee51d00dfbe403689a4c2bbf46 (patch)
tree4992c7dc223b6255bc002648f047b70844b22677 /scripts/bootstrap/buildenv.sh
parente49886c55a7e2cfd6dd1fc52b037dc2d5a6ca019 (diff)
Windows: fix bootstrapping bugs with 0.4.4
Fix 3 bugs to get bootstrapping working on Windows after it was broken in bazel-0.4.4: * Move the definition of PATHSEP to before the code that overrides it for Windows * Fix the Java code processing the --javahome flag to recognize absolute Windows paths as absolute. See: https://github.com/bazelbuild/bazel/issues/2520 * Do not propagate the JAVA_HOME value in variables, because it contains spaces on Windows, and when we pass the variable to Bazel, and it's expanded to e.g. ... --foo=C:/Program Files, these are interpreted as two args instead of one. Also fix a bug that is just annoying, not causing any trouble (on Windows): * Silently swallow errors from the "rm -rf" in the atexit functions Also do some refactoring: * Rename a variable (BAZEL_ARGS) and a method to indicate they're private. They are not used from anywhere else as far as I know -- no occurrences in either the bazel or the continuous-integration repos. Fixes: https://github.com/bazelbuild/bazel/issues/2473 -- Change-Id: I309752cd7bbff0b5dd683ddb5573f3061350043c Reviewed-on: https://cr.bazel.build/8797 PiperOrigin-RevId: 147345194 MOS_MIGRATED_REVID=147345194
Diffstat (limited to 'scripts/bootstrap/buildenv.sh')
-rwxr-xr-xscripts/bootstrap/buildenv.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh
index 62ebc111f7..39a15c4c37 100755
--- a/scripts/bootstrap/buildenv.sh
+++ b/scripts/bootstrap/buildenv.sh
@@ -58,6 +58,7 @@ if [ "${MACHINE_TYPE}" = 'ppc64' -o "${MACHINE_TYPE}" = 'ppc64le' ]; then
MACHINE_IS_64BIT='yes'
fi
+PATHSEP=":"
case "${PLATFORM}" in
linux)
# JAVA_HOME must point to a Java installation.
@@ -82,6 +83,8 @@ msys*|mingw*)
PATHSEP=";"
# Find the latest available version of the SDK.
JAVA_HOME="${JAVA_HOME:-$(ls -d /c/Program\ Files/Java/jdk* | sort | tail -n 1)}"
+ # Replace backslashes with forward slashes.
+ JAVA_HOME="${JAVA_HOME//\\//}"
esac
EXE_EXT=""
@@ -150,7 +153,7 @@ function tempdir() {
local DIR="$(mktemp -d "${tmp%%/}/bazel_XXXXXXXX")"
mkdir -p "${DIR}"
local DIRBASE=$(basename "${DIR}")
- eval "cleanup_tempdir_${DIRBASE}() { rm -rf '${DIR}'; }"
+ eval "cleanup_tempdir_${DIRBASE}() { rm -rf '${DIR}' >&/dev/null || true ; }"
atexit cleanup_tempdir_${DIRBASE}
NEW_TMPDIR="${DIR}"
}