summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeigh McCulloch <leigh@mcchouse.com>2019-02-17 07:23:18 +0000
committerGeorge Fraser <george@fivetran.com>2019-02-18 15:15:11 -0800
commit6d65d0e987fb8be8f22feb2ad9f2be7e48fc9b2b (patch)
tree4d54d6998325dd80775e6ab3d80a8f3c2feef914
parentb9b74cc01be266ce21c352cd2be0cd4499361407 (diff)
downloadjava-language-server-6d65d0e987fb8be8f22feb2ad9f2be7e48fc9b2b.zip
Add a script for linking for debian
What === Add a script for linking for debian. Why === The location of java home is different on mac and debian, and on debian there is no java_home variable to select version 11 of java. The default jdk installation on debian is currently version 11 and the script uses that. In the event it is not installed mvn will error because the JAVA_HOME is pointing to an invalid path. In the event multiple version of java are installed version 11 will be used regardless of which is set as the default. The patch script has been updated to use the JAVA_HOME path explicitly for each command to ensure it uses the correct version of java when multiple versions are installed. This is consistent with the link scripts.
-rwxr-xr-xscripts/link_debian.sh24
-rwxr-xr-xscripts/patch_gson.sh13
2 files changed, 32 insertions, 5 deletions
diff --git a/scripts/link_debian.sh b/scripts/link_debian.sh
new file mode 100755
index 0000000..183cb99
--- /dev/null
+++ b/scripts/link_debian.sh
@@ -0,0 +1,24 @@
+#!/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/lib/jvm/java-11-openjdk-amd64'
+
+# Compile sources
+mvn compile
+
+# Patch gson
+if [ ! -e modules/gson.jar ]; then
+ ./scripts/patch_gson.sh
+fi
+
+# Build using jlink
+rm -rf dist/debian
+$JAVA_HOME/bin/jlink \
+ --module-path modules/gson.jar:target/classes \
+ --add-modules gson,javacs \
+ --launcher launcher=javacs/org.javacs.Main \
+ --output dist/debian \
+ --compress 2
diff --git a/scripts/patch_gson.sh b/scripts/patch_gson.sh
index d2981ea..348f01f 100755
--- a/scripts/patch_gson.sh
+++ b/scripts/patch_gson.sh
@@ -6,7 +6,10 @@
set -e
# Needed if you have a java version other than 11 as default
-JAVA_HOME=$(/usr/libexec/java_home -v 11)
+# and used if java_home is available
+if [ -f /usr/libexec/java_home ] ; then
+ JAVA_HOME=$(/usr/libexec/java_home -v 11)
+fi
# Download Gson jar
cd modules
@@ -15,15 +18,15 @@ curl https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.j
# Unpack jar into modules/classes
mkdir classes
cd classes
-jar xf ../gson.jar
+$JAVA_HOME/bin/jar xf ../gson.jar
cd ..
# Compile module-info.java to module-info.class
-javac -p com.google.gson -d classes module-info.java
+$JAVA_HOME/bin/javac -p com.google.gson -d classes module-info.java
# Update gson.jar with module-info.class
-jar uf gson.jar -C classes module-info.class
+$JAVA_HOME/bin/jar uf gson.jar -C classes module-info.class
# Clean up
rm -rf classes
-cd .. \ No newline at end of file
+cd ..