From 68de436955c1f2f906c30199a84d7d1858b52bdf Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Tue, 17 Oct 2017 10:38:35 +0200 Subject: build_windows_jni: fix @cd call In cmd.exe it's not enough to `cd` into a directory to change the shell's current working directory: you also have to change to the right drive. Fixes https://github.com/bazelbuild/bazel/issues/3906 Change-Id: I4dd1a17e8b6b4a0db8fb7a56239ed78de3efae95 PiperOrigin-RevId: 172437822 --- src/main/native/windows/build_windows_jni.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main') diff --git a/src/main/native/windows/build_windows_jni.sh b/src/main/native/windows/build_windows_jni.sh index ad52518ea2..60b8b2ff2d 100644 --- a/src/main/native/windows/build_windows_jni.sh +++ b/src/main/native/windows/build_windows_jni.sh @@ -94,10 +94,16 @@ cp -f "$JAVAINCLUDES/win32/jni_md.h" "$JNI_HEADERS_DIR/" # CL.EXE needs a bunch of environment variables whose official location is a # batch file. We can't make that have an effect on a bash instance, so # generate a batch file that invokes it. +# As for `abs_pwd` and `pwd_drive`: in cmd.exe, it's not enough to `cd` into a +# directory. You must also change to its drive to truly set the cwd to that +# directory. See https://github.com/bazelbuild/bazel/issues/3906 +abs_pwd="$(cygpath -a -w "${PWD}")" +pwd_drive="$(echo "$abs_pwd" | head -c2)" cat > "${VSTEMP}/windows_jni.bat" <