diff options
Diffstat (limited to 'scripts/bootstrap')
-rwxr-xr-x | scripts/bootstrap/bootstrap.sh | 3 | ||||
-rwxr-xr-x | scripts/bootstrap/buildenv.sh | 14 | ||||
-rwxr-xr-x | scripts/bootstrap/compile.sh | 20 |
3 files changed, 20 insertions, 17 deletions
diff --git a/scripts/bootstrap/bootstrap.sh b/scripts/bootstrap/bootstrap.sh index 3832692d38..c50afc249a 100755 --- a/scripts/bootstrap/bootstrap.sh +++ b/scripts/bootstrap/bootstrap.sh @@ -62,7 +62,8 @@ if [ -z "${BAZEL-}" ]; then --javacopt="-g -source ${JAVA_VERSION} -target ${JAVA_VERSION}" "${@}" } else - function _run_bootstrapping_bazel() { local command=$1 + function _run_bootstrapping_bazel() { + local command=$1 shift ${BAZEL} --bazelrc=${BAZELRC} ${BAZEL_DIR_STARTUP_OPTIONS} $command \ ${_BAZEL_ARGS} --verbose_failures \ diff --git a/scripts/bootstrap/buildenv.sh b/scripts/bootstrap/buildenv.sh index 39a15c4c37..197eef981d 100755 --- a/scripts/bootstrap/buildenv.sh +++ b/scripts/bootstrap/buildenv.sh @@ -77,22 +77,22 @@ darwin) fi ;; -msys*|mingw*) +msys*|mingw*|cygwin*) # Use a simplified platform string. - PLATFORM="mingw" + PLATFORM="windows" PATHSEP=";" # Find the latest available version of the SDK. - JAVA_HOME="${JAVA_HOME:-$(ls -d /c/Program\ Files/Java/jdk* | sort | tail -n 1)}" + 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="" -if [ "${PLATFORM}" == "mingw" ]; then +if [ "${PLATFORM}" == "windows" ]; then # Extension for executables. EXE_EXT=".exe" - # Fix TMPDIR on msys + # Fix TMPDIR on windows default_tmp=${TMP:-$(cygpath -mO)/Temp} TMPDIR=$(cygpath -ml "${TMPDIR:-$default_tmp}") fi @@ -235,13 +235,13 @@ function new_step() { } function git_sha1() { - if [ -x "$(which git || true)" ] && [ -d .git ]; then + if [ -x "$(which git 2>/dev/null)" ] && [ -d .git ]; then git rev-parse --short HEAD 2>/dev/null || true fi } function git_date() { - if [ -x "$(which git || true)" ] && [ -d .git ]; then + if [ -x "$(which git 2>/dev/null)" ] && [ -d .git ]; then git log -1 --pretty=%ai | cut -d " " -f 1 || true fi } diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh index 08687ac1c1..eec6123867 100755 --- a/scripts/bootstrap/compile.sh +++ b/scripts/bootstrap/compile.sh @@ -272,8 +272,7 @@ chmod 0755 ${ARCHIVE_DIR}/_embedded_binaries/process-wrapper${EXE_EXT} function build_jni() { local -r output_dir=$1 - case "${PLATFORM}" in - msys*|mingw*) + if [ "${PLATFORM}" = "windows" ]; then # We need JNI on Windows because some filesystem operations are not (and # cannot be) implemented in native Java. log "Building Windows JNI library..." @@ -297,13 +296,10 @@ function build_jni() { chmod 0555 "$output" JNI_FLAGS="-Dio.bazel.EnableJni=1 -Djava.library.path=${output_dir}" - ;; - - *) + else # We don't need JNI on other platforms. JNI_FLAGS="-Dio.bazel.EnableJni=0" - ;; - esac + fi } build_jni "${ARCHIVE_DIR}/_embedded_binaries" @@ -319,6 +315,12 @@ else cp tools/osx/xcode_locator_stub.sh ${ARCHIVE_DIR}/_embedded_binaries/xcode-locator fi +function get_cwd() { + local result=${PWD} + [ "$PLATFORM" = "windows" ] && result="$(cygpath -m "$result")" + echo "$result" +} + function run_bazel_jar() { local command=$1 shift @@ -369,7 +371,7 @@ function run_bazel_jar() { --install_base=${ARCHIVE_DIR} \ --output_base=${OUTPUT_DIR}/out \ --install_md5= \ - --workspace_directory=${PWD} \ + --workspace_directory="$(get_cwd)" \ --nofatal_event_bus_exceptions \ ${BAZEL_DIR_STARTUP_OPTIONS} \ ${BAZEL_BOOTSTRAP_STARTUP_OPTIONS:-} \ @@ -378,6 +380,6 @@ function run_bazel_jar() { --startup_time=329 --extract_data_time=523 \ --rc_source=/dev/null --isatty=1 \ "${client_env[@]}" \ - --client_cwd=${PWD} \ + --client_cwd="$(get_cwd)" \ "${@}" } |