aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2016-09-02 11:53:16 +0000
committerGravatar Kristina Chodorow <kchodorow@google.com>2016-09-06 15:37:14 +0000
commit4a249b6962d32ed4cfd4165dfdae4a555b00bb69 (patch)
tree3ee3274df9f544dd75970fc26cd2989eeb98367d /scripts
parent80f21af764a4d2dc72d72a7152650eb620e46881 (diff)
Windows, JNI: use native isJunction method.
Fixes https://github.com/bazelbuild/bazel/issues/1680 -- MOS_MIGRATED_REVID=132051176
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/bootstrap/compile.sh42
1 files changed, 41 insertions, 1 deletions
diff --git a/scripts/bootstrap/compile.sh b/scripts/bootstrap/compile.sh
index 1948943e1f..03064e75d2 100755
--- a/scripts/bootstrap/compile.sh
+++ b/scripts/bootstrap/compile.sh
@@ -251,6 +251,45 @@ exit $?
EOF
chmod 0755 ${ARCHIVE_DIR}/_embedded_binaries/process-wrapper${EXE_EXT}
+function build_jni() {
+ local output_dir=$1
+ local jni_lib_name="windows_jni.dll"
+ local output="${output_dir}/${jni_lib_name}"
+ local tmp_output="${NEW_TMPDIR}/jni/${jni_lib_name}"
+ mkdir -p "$(dirname "$tmp_output")"
+
+ case "${PLATFORM}" in
+ msys*|mingw*)
+ log "Building Windows JNI library..."
+
+ # We have to enable JNI on Windows because some filesystem operations are
+ # not (and cannot be) implemented in Java.
+ ENABLE_JNI=1
+
+ # Let the JVM know where to find the JNI library. This flag overrides the
+ # default value for java.library.path, but since JNI is disabled by default,
+ # that path would be ignored anyway.
+ JNI_PATH="$output_dir"
+
+ # Keep this `find` command in sync with the `srcs` of
+ # //src/main/native:windows_jni
+ local srcs=$(find src/main/native \
+ -name 'windows_*.cc' -o -name 'windows_*.h')
+ [ -n "$srcs" ] || fail "Could not find sources for Windows JNI library"
+
+ # do not quote $srcs because we need to expand it to multiple args
+ src/main/native/build_windows_jni.sh "$tmp_output" ${srcs}
+
+ cp "$tmp_output" "$output"
+ chmod 0755 "$output"
+ ;;
+ esac
+}
+
+ENABLE_JNI=0
+JNI_PATH=""
+build_jni "${ARCHIVE_DIR}/_embedded_binaries"
+
cp src/main/tools/build_interface_so ${ARCHIVE_DIR}/_embedded_binaries/build_interface_so
cp src/main/tools/jdk.BUILD ${ARCHIVE_DIR}/_embedded_binaries/jdk.BUILD
cp $OUTPUT_DIR/libblaze.jar ${ARCHIVE_DIR}
@@ -269,7 +308,8 @@ function bootstrap_build() {
-XX:+HeapDumpOnOutOfMemoryError -Xverify:none -Dfile.encoding=ISO-8859-1 \
-XX:HeapDumpPath=${OUTPUT_DIR} \
-Djava.util.logging.config.file=${OUTPUT_DIR}/javalog.properties \
- -Dio.bazel.EnableJni=0 \
+ -Dio.bazel.EnableJni=${ENABLE_JNI} \
+ -Djava.library.path="$JNI_PATH" \
-jar ${ARCHIVE_DIR}/libblaze.jar \
--batch \
--install_base=${ARCHIVE_DIR} \