summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGeorge Fraser <george@fivetran.com>2018-12-28 19:52:31 -0800
committerGeorge Fraser <george@fivetran.com>2018-12-28 19:52:31 -0800
commit064aa8a19eae058384ba7d9c2c8d2e4bfde3ed18 (patch)
tree6df41f6f9452a4c6578663e80f2463ab51d4059d /scripts
parent9a02922e98d84bb1ea0b19ff8d2259b5cb7b0e9c (diff)
downloadjava-language-server-064aa8a19eae058384ba7d9c2c8d2e4bfde3ed18.zip
Build for windows
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh3
-rwxr-xr-xscripts/link_mac.sh (renamed from scripts/link.sh)11
-rwxr-xr-xscripts/link_windows.sh38
3 files changed, 44 insertions, 8 deletions
diff --git a/scripts/build.sh b/scripts/build.sh
index c93246d..1768be3 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -9,7 +9,8 @@ JAVA_HOME=$(/usr/libexec/java_home -v 11)
npm install
# Build fat jar
-./scripts/link.sh
+./scripts/link_mac.sh
+./scripts/link_windows.sh
# Build vsix
vsce package -o build.vsix
diff --git a/scripts/link.sh b/scripts/link_mac.sh
index 07ae214..cbe8870 100755
--- a/scripts/link.sh
+++ b/scripts/link_mac.sh
@@ -15,13 +15,10 @@ if [ ! -e modules/gson.jar ]; then
fi
# Build using jlink
-rm -rf dist
+rm -rf dist/mac
$JAVA_HOME/bin/jlink \
--module-path modules/gson.jar:target/classes \
--add-modules gson,javacs \
- --launcher javacs=javacs/org.javacs.Main \
- --output dist \
- --compress 2
-
-# TODO: need to run this again with windows jdk!
-# https://stackoverflow.com/questions/47593409/create-java-runtime-image-on-one-platform-for-another-using-jlink \ No newline at end of file
+ --launcher launcher=javacs/org.javacs.Main \
+ --output dist/mac \
+ --compress 2 \ No newline at end of file
diff --git a/scripts/link_windows.sh b/scripts/link_windows.sh
new file mode 100755
index 0000000..be9f7dc
--- /dev/null
+++ b/scripts/link_windows.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+# Links everything into a self-contained executable using jlink.
+
+set -e
+
+# Needed if you have a java version other than 11 as default
+JAVA_HOME=$(/usr/libexec/java_home -v 11)
+
+# Compile sources
+mvn compile
+
+# Patch gson
+if [ ! -e modules/gson.jar ]; then
+ ./scripts/patch_gson.sh
+fi
+
+# Download windows jdk
+if [ ! -e jdks/windows/jdk-11.0.1 ]; then
+ mkdir -p jdks/windows
+ cd jdks/windows
+ curl https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_windows-x64_bin.zip > windows.zip
+ unzip windows.zip
+ rm windows.zip
+ cd ../..
+fi
+
+# Set env variables to build with mac toolchain but windows target
+JAVA_HOME="./jdks/windows/jdk-11.0.1"
+REAL_JAVA_HOME=$(/usr/libexec/java_home -v 11)
+
+# Build in dist/windows
+rm -rf dist/windows
+$REAL_JAVA_HOME/bin/jlink \
+ --module-path $JAVA_HOME/jmods:modules/gson.jar:target/classes \
+ --add-modules gson,javacs \
+ --launcher launcher=javacs/org.javacs.Main \
+ --output dist/windows \
+ --compress 2 \ No newline at end of file