From 4fd23fe0481e477bae846db57aaad096473a0ec5 Mon Sep 17 00:00:00 2001 From: Quentin PARIS Date: Sun, 14 Jun 2020 19:50:20 +0200 Subject: [PATCH 1/3] Jpackage: Java 14 on macOS --- ....sh => phoenicis-create-package-java14.sh} | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) rename phoenicis-dist/src/scripts/{phoenicis-create-package-java12.sh => phoenicis-create-package-java14.sh} (77%) diff --git a/phoenicis-dist/src/scripts/phoenicis-create-package-java12.sh b/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh similarity index 77% rename from phoenicis-dist/src/scripts/phoenicis-create-package-java12.sh rename to phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh index cce0174699f..a8c87bfd2db 100755 --- a/phoenicis-dist/src/scripts/phoenicis-create-package-java12.sh +++ b/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh @@ -8,6 +8,8 @@ # VERSION="$1" +JAVA_VERSION="$(java -version 2>&1 | head -1 | cut -d'"' -f2 | sed '/^1\./s///' | cut -d'.' -f1)" + if [ "$VERSION" = "" ]; then echo "Warning: Version not specified. Reading from pom.xml" @@ -20,6 +22,9 @@ cd "$SCRIPT_PATH" SCRIPT_PATH="$PWD" [ "$JAVA_HOME" = "" ] && echo "Please set JAVA_HOME" && exit 0 +[ ! "$JAVA_VERSION" = "14" ] && (echo "Java 14 is required to run this script" ; exit 1) +which jpackage || (echo "jpackage is required to run this script" ; exit 1) + PHOENICIS_OPERATING_SYSTEM="$(uname)" @@ -40,34 +45,19 @@ PHOENICIS_JPACKAGER="$SCRIPT_PATH/../../target/jpackager" PHOENICIS_RESOURCES="$SCRIPT_PATH/../resources" PHOENICIS_MODULES="jdk.crypto.ec,java.base,javafx.base,javafx.web,javafx.media,javafx.graphics,javafx.controls,java.naming,java.sql,java.scripting,jdk.internal.vm.ci,jdk.internal.vm.compiler,org.graalvm.truffle,jdk.jsobject,jdk.xml.dom" PHOENICIS_RUNTIME_OPTIONS="-XX:G1PeriodicGCInterval=5000 -XX:G1PeriodicGCSystemLoadThreshold=0 -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:-ShrinkHeapInSteps -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --upgrade-module-path=$JAR_RELATIVE_PATH/compiler.jar --module-path=../Java --add-modules=$PHOENICIS_MODULES" -PHOENICIS_JPACKAGER_ARGUMENTS=("-i" "$PHOENICIS_TARGET/lib" "--main-jar" "phoenicis-javafx-$VERSION.jar" "-n" "$PHOENICIS_APPTITLE" "--output" "$PHOENICIS_TARGET/packages/" "--add-modules" "$PHOENICIS_MODULES" "-p" "$PHOENICIS_TARGET/lib/" "--app-version" "$VERSION" "--java-options" "$PHOENICIS_RUNTIME_OPTIONS") - - -_download_jpackager() { - mkdir -p "$PHOENICIS_JPACKAGER" - cd "$PHOENICIS_JPACKAGER" - wget https://download.java.net/java/early_access/jpackage/49/openjdk-13-jpackage+49_osx-x64_bin.tar.gz - tar -xvf openjdk-13-jpackage+49_osx-x64_bin.tar.gz -} - +PHOENICIS_JPACKAGER_ARGUMENTS=("--type" "app-image" "--input" "$PHOENICIS_TARGET/lib" "--main-jar" "phoenicis-javafx-$VERSION.jar" "-n" "$PHOENICIS_APPTITLE" "--dest" "$PHOENICIS_TARGET/packages/" "--add-modules" "$PHOENICIS_MODULES" "-p" "$PHOENICIS_TARGET/lib/" "--app-version" "$VERSION" "--java-options" "$PHOENICIS_RUNTIME_OPTIONS") -jpackager() { - if [ ! -e "$PHOENICIS_JPACKAGER/jdk-13.jdk/Contents/Home/bin" ]; then - _download_jpackager - fi - "$PHOENICIS_JPACKAGER/jdk-13.jdk/Contents/Home/bin/jpackage" "$@" -} cd "$PHOENICIS_TARGET" if [ "$PHOENICIS_OPERATING_SYSTEM" == "Darwin" ]; then rm -rf "$PHOENICIS_TARGET/packages/Phoenicis PlayOnMac.app" - jpackager create-app-image --icon "$PHOENICIS_RESOURCES/Phoenicis PlayOnMac.icns" "${PHOENICIS_JPACKAGER_ARGUMENTS[@]}" + jpackage --icon "$PHOENICIS_RESOURCES/Phoenicis PlayOnMac.icns" "${PHOENICIS_JPACKAGER_ARGUMENTS[@]}" fi if [ "$PHOENICIS_OPERATING_SYSTEM" == "Linux" ]; then - jpackager create-image "${PHOENICIS_JPACKAGER_ARGUMENTS[@]}" --linux-bundle-name "phoenicis-playonlinux" + jpackage --image "${PHOENICIS_JPACKAGER_ARGUMENTS[@]}" --linux-bundle-name "phoenicis-playonlinux" packageName="Phoenicis_$VERSION" cd "$PHOENICIS_TARGET" From 3101397d3a5fcabed4f0a0d0f743d12f2bf1010b Mon Sep 17 00:00:00 2001 From: plata Date: Sun, 27 Sep 2020 00:20:00 +0200 Subject: [PATCH 2/3] Remove invalid options on Linux --- phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh b/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh index a8c87bfd2db..51f4a080e9f 100755 --- a/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh +++ b/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh @@ -57,7 +57,7 @@ if [ "$PHOENICIS_OPERATING_SYSTEM" == "Darwin" ]; then fi if [ "$PHOENICIS_OPERATING_SYSTEM" == "Linux" ]; then - jpackage --image "${PHOENICIS_JPACKAGER_ARGUMENTS[@]}" --linux-bundle-name "phoenicis-playonlinux" + jpackage "${PHOENICIS_JPACKAGER_ARGUMENTS[@]}" packageName="Phoenicis_$VERSION" cd "$PHOENICIS_TARGET" From 9f10dcfae423339e7de367ac05c51662ab074393 Mon Sep 17 00:00:00 2001 From: plata Date: Sun, 27 Sep 2020 00:21:23 +0200 Subject: [PATCH 3/3] Set type --- phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh b/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh index 51f4a080e9f..36c41de522e 100755 --- a/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh +++ b/phoenicis-dist/src/scripts/phoenicis-create-package-java14.sh @@ -32,12 +32,14 @@ if [ "$PHOENICIS_OPERATING_SYSTEM" == "Darwin" ]; then PHOENICIS_APPTITLE="Phoenicis PlayOnMac" JPACKAGER_OS="osx" JAR_RELATIVE_PATH="../Java" + TYPE="DMG" fi if [ "$PHOENICIS_OPERATING_SYSTEM" == "Linux" ]; then PHOENICIS_APPTITLE="Phoenicis PlayOnLinux" JPACKAGER_OS="linux" JAR_RELATIVE_PATH="/usr/share/phoenicis/app" + TYPE="DEB" fi PHOENICIS_TARGET="$SCRIPT_PATH/../../target" @@ -45,7 +47,7 @@ PHOENICIS_JPACKAGER="$SCRIPT_PATH/../../target/jpackager" PHOENICIS_RESOURCES="$SCRIPT_PATH/../resources" PHOENICIS_MODULES="jdk.crypto.ec,java.base,javafx.base,javafx.web,javafx.media,javafx.graphics,javafx.controls,java.naming,java.sql,java.scripting,jdk.internal.vm.ci,jdk.internal.vm.compiler,org.graalvm.truffle,jdk.jsobject,jdk.xml.dom" PHOENICIS_RUNTIME_OPTIONS="-XX:G1PeriodicGCInterval=5000 -XX:G1PeriodicGCSystemLoadThreshold=0 -XX:MaxHeapFreeRatio=10 -XX:MinHeapFreeRatio=5 -XX:-ShrinkHeapInSteps -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI --upgrade-module-path=$JAR_RELATIVE_PATH/compiler.jar --module-path=../Java --add-modules=$PHOENICIS_MODULES" -PHOENICIS_JPACKAGER_ARGUMENTS=("--type" "app-image" "--input" "$PHOENICIS_TARGET/lib" "--main-jar" "phoenicis-javafx-$VERSION.jar" "-n" "$PHOENICIS_APPTITLE" "--dest" "$PHOENICIS_TARGET/packages/" "--add-modules" "$PHOENICIS_MODULES" "-p" "$PHOENICIS_TARGET/lib/" "--app-version" "$VERSION" "--java-options" "$PHOENICIS_RUNTIME_OPTIONS") +PHOENICIS_JPACKAGER_ARGUMENTS=("--type" "$TYPE" "--input" "$PHOENICIS_TARGET/lib" "--main-jar" "phoenicis-javafx-$VERSION.jar" "-n" "$PHOENICIS_APPTITLE" "--dest" "$PHOENICIS_TARGET/packages/" "--add-modules" "$PHOENICIS_MODULES" "-p" "$PHOENICIS_TARGET/lib/" "--app-version" "$VERSION" "--java-options" "$PHOENICIS_RUNTIME_OPTIONS")