diff options
author | Yun Peng <pcloudy@google.com> | 2016-09-28 14:22:34 +0000 |
---|---|---|
committer | Yun Peng <pcloudy@google.com> | 2016-09-28 16:06:26 +0000 |
commit | eb87208599cdb9ede31efe793485e9096ab4a773 (patch) | |
tree | d7b7f80537932f689d8a4c7a7545a58951b3edbc /src/main/native/build_windows_jni.sh | |
parent | 8b88f64e92679543b48770bf530ca724a4d7214d (diff) |
Make cc_configure on Windows more robust
1. Throw an error if Bash-on-Windows is found instead of MSYS bash
2. Introduce BAZEL_VS environment variable
3. Output more information
Fix https://github.com/bazelbuild/bazel/issues/1847
--
Change-Id: Ic4571c6c792d9b81df4cd800b8f19d121cc44c33
Reviewed-on: https://bazel-review.googlesource.com/#/c/6330
MOS_MIGRATED_REVID=134531295
Diffstat (limited to 'src/main/native/build_windows_jni.sh')
-rwxr-xr-x | src/main/native/build_windows_jni.sh | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/native/build_windows_jni.sh b/src/main/native/build_windows_jni.sh index 6021732ffd..0122b3d3e0 100755 --- a/src/main/native/build_windows_jni.sh +++ b/src/main/native/build_windows_jni.sh @@ -29,12 +29,15 @@ trap "rm -fr \"$VSTEMP\"" EXIT # Find Visual Studio. We don't have any regular environment variables available # so this is the best we can do. -VSVERSION="$(ls "C:/Program Files (x86)" | grep -E "Microsoft Visual Studio [0-9]+" | sort | tail -n 1)" -if [[ "$VSVERSION" == "" ]]; then - echo "Visual Studio not found" - exit 1 +if [ -z "${BAZEL_VS+set}" ]; then + VSVERSION="$(ls "C:/Program Files (x86)" | grep -E "Microsoft Visual Studio [0-9]+" | sort --version-sort | tail -n 1)" + if [[ "$VSVERSION" == "" ]]; then + echo "Visual Studio not found" + exit 1 + fi + BAZEL_VS="C:/Program Files (x86)/$VSVERSION" fi -VSVARS="C:/Program Files (x86)/$VSVERSION/VC/VCVARSALL.BAT" +VSVARS="${BAZEL_VS}/VC/VCVARSALL.BAT" # Find Java. $(JAVA) in the BUILD file points to external/local_jdk/..., which # is not very useful for anything not MSYS-based. |