-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#27: adds basic macos app-image generation for macOsX based on JPacka…
…geScriptFx
- Loading branch information
1 parent
7cc066c
commit 792fc75
Showing
6 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package app.logorrr | ||
|
||
object LogoRRRAppLauncher { | ||
|
||
/** launcher for macos installer */ | ||
def main(args: Array[String]): Unit = { | ||
LogoRRRApp.main(args) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
#!/bin/bash | ||
|
||
# ------ ENVIRONMENT -------------------------------------------------------- | ||
# The script depends on various environment variables to exist in order to | ||
# run properly. The java version we want to use, the location of the java | ||
# binaries (java home), and the project version as defined inside the pom.xml | ||
# file, e.g. 1.0-SNAPSHOT. | ||
# | ||
# PROJECT_VERSION: version used in pom.xml, e.g. 1.0-SNAPSHOT | ||
# APP_VERSION: the application version, e.g. 1.0.0, shown in "about" dialog | ||
PROJECT_VERSION=21.3.1-SNAPSHOT | ||
APP_VERSION=23.3.1 | ||
JAVA_VERSION=16 | ||
MAIN_JAR="app-$PROJECT_VERSION.jar" | ||
|
||
# Set desired installer type: "app-image", "dmg", "pkg", "rpm" or "deb". | ||
INSTALLER_TYPE=app-image | ||
|
||
echo "java home: $JAVA_HOME" | ||
echo "project version: $PROJECT_VERSION" | ||
echo "app version: $APP_VERSION" | ||
echo "main JAR file: $MAIN_JAR" | ||
|
||
# ------ SETUP DIRECTORIES AND FILES ---------------------------------------- | ||
# Remove previously generated java runtime and installers. Copy all required | ||
# jar files into the input/libs folder. | ||
|
||
rm -rfd ./target/java-runtime/ | ||
rm -rfd target/installer/ | ||
|
||
mkdir -p target/installer/input/libs/ | ||
|
||
cp target/libs/* target/installer/input/libs/ | ||
#cp target/${MAIN_JAR} target/installer/input/libs/ | ||
|
||
# ------ REQUIRED MODULES --------------------------------------------------- | ||
# Use jlink to detect all modules that are required to run the application. | ||
# Starting point for the jdep analysis is the set of jars being used by the | ||
# application. | ||
|
||
echo "detecting required modules" | ||
detected_modules=`$JAVA_HOME/bin/jdeps \ | ||
-q \ | ||
--multi-release ${JAVA_VERSION} \ | ||
--ignore-missing-deps \ | ||
--print-module-deps \ | ||
--class-path "target/installer/input/libs/*" \ | ||
/Users/lad/gh/LogoRRR/app/target/classes/app/logorrr/LogoRRRApp.class` | ||
echo "detected modules: ${detected_modules}" | ||
|
||
|
||
# ------ MANUAL MODULES ----------------------------------------------------- | ||
# jdk.crypto.ec has to be added manually bound via --bind-services or | ||
# otherwise HTTPS does not work. | ||
# | ||
# See: https://bugs.openjdk.java.net/browse/JDK-8221674 | ||
# | ||
# In addition we need jdk.localedata if the application is localized. | ||
# This can be reduced to the actually needed locales via a jlink paramter, | ||
# e.g., --include-locales=en,de. | ||
|
||
manual_modules=jdk.crypto.ec,jdk.localedata | ||
echo "manual modules: ${manual_modules}" | ||
|
||
# ------ RUNTIME IMAGE ------------------------------------------------------ | ||
# Use the jlink tool to create a runtime image for our application. We are | ||
# doing this is a separate step instead of letting jlink do the work as part | ||
# of the jpackage tool. This approach allows for finer configuration and also | ||
# works with dependencies that are not fully modularized, yet. | ||
|
||
echo "creating java runtime image" | ||
$JAVA_HOME/bin/jlink \ | ||
--strip-native-commands \ | ||
--no-header-files \ | ||
--no-man-pages \ | ||
--compress=2 \ | ||
--strip-debug \ | ||
--add-modules "${detected_modules},${manual_modules}" \ | ||
--include-locales=en,de \ | ||
--output target/java-runtime | ||
|
||
# ------ PACKAGING ---------------------------------------------------------- | ||
# In the end we will find the package inside the target/installer directory. | ||
|
||
echo "Creating installer of type $INSTALLER_TYPE" | ||
|
||
$JAVA_HOME/bin/jpackage \ | ||
--type $INSTALLER_TYPE \ | ||
--dest target/installer \ | ||
--input target/installer/input/libs \ | ||
--name LogoRRR \ | ||
--main-class app.logorrr.LogoRRRAppLauncher \ | ||
--main-jar ${MAIN_JAR} \ | ||
--java-options -Xmx2048m \ | ||
--runtime-image target/java-runtime \ | ||
--icon src/main/resources/logorrr-icon-256.icns \ | ||
--app-version ${APP_VERSION} \ | ||
--vendor "app.logorrr" \ | ||
--copyright "Copyright © 2021 Logorrr.app" \ | ||
--mac-package-identifier app.logorrr \ | ||
--mac-package-name LogoRRR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>app.logorrr.dist.osx</groupId> | ||
<artifactId>dist-osx</artifactId> | ||
<version>${revision}${changelist}</version> | ||
</parent> | ||
|
||
<artifactId>installer-osx</artifactId> | ||
<name>app.logorrr.dist.osx.installer</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>app.logorrr</groupId> | ||
<artifactId>app</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.openjfx</groupId> | ||
<artifactId>javafx-maven-plugin</artifactId> | ||
<configuration> | ||
<mainClass>app.logorrr.LogoRRRApp</mainClass> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>copy-dependencies</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>copy-dependencies</goal> | ||
</goals> | ||
<configuration> | ||
<outputDirectory>${project.build.directory}/libs</outputDirectory> | ||
<overWriteReleases>false</overWriteReleases> | ||
<overWriteSnapshots>false</overWriteSnapshots> | ||
<overWriteIfNewer>true</overWriteIfNewer> | ||
<includeScope>compile</includeScope> | ||
<includeScope>runtime</includeScope> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>create osx-installer</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<workingDirectory>${project.basedir}</workingDirectory> | ||
<executable>./build_app.sh</executable> | ||
<environmentVariables> | ||
<APP_VERSION>21.3.1</APP_VERSION> | ||
<PROJECT_VERSION>${project.version}</PROJECT_VERSION> | ||
</environmentVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
|
||
<modules> | ||
<module>binary-osx</module> | ||
<module>installer-osx</module> | ||
</modules> | ||
|
||
</project> |