Skip to content

Commit

Permalink
Create platform-independent bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
dhadka committed Dec 25, 2023
1 parent d52ed66 commit 871419a
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 63 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,35 @@ jobs:
java-package: 'jdk+fx'
cache: 'maven'

- name: Maven build
- name: Build native installer
run: mvn clean install

- name: Upload release
- name: Upload native installer
uses: actions/upload-artifact@v4
with:
name: J3-${{ runner.os }}
path: |
./target/*.msi
./target/*.dmg
./target/*.deb
- name: Create platform-independent bundle
if: runner.os == 'Linux'
run: |
pushd target
mkdir J3
cp -r lib/ J3
cp -r runtime/ J3
cp -r ../data J3
cp -r ../animations J3
cp ../src/packaging/j3.bat J3
cp ../src/packaging/j3 J3
chmod +x J3/j3
- name: Upload platform-independent bundle
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: J3
path: |
./target/J3
59 changes: 11 additions & 48 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<artifactId>j3</artifactId>
<version>2.0.0</version>
<description>J3 - Java 3D Visualization Tool</description>

<!-- This file is based on https://github.com/wiverson/maven-jpackage-template -->

<properties>
Expand All @@ -15,16 +15,17 @@

<app.name>J3</app.name>
<app.version>${project.version}</app.version>
<app.copyright>Copyright 2009-2023</app.copyright>
<app.vendor>Project-Platypus</app.vendor>
<main.class>j3.GUI</main.class>

<!-- Leave blank if JavaFX is included in the JDK -->
<javafx.home></javafx.home>
<jvm.modules>javafx.controls,java.logging,java.prefs</jvm.modules>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<windows.upgrade.uuid>e110edba-dbba-4f28-9c9b-ec09ad39522c</windows.upgrade.uuid>
<windows.vendor>Project-Platypus</windows.vendor>

<!-- Empty properties to skip signing by default. Set with the macos-sign Maven profile -->
<macos.sign></macos.sign>
Expand Down Expand Up @@ -84,7 +85,7 @@
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
<version>1.7.1</version>
</extension>
</extensions>
<resources>
Expand All @@ -102,15 +103,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
<version>3.1.1</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.3.0</version>
<version>3.6.1</version>
<executions>
<execution>
<phase>prepare-package</phase>
Expand All @@ -127,7 +128,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.2</version>
<version>3.3.0</version>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
Expand All @@ -153,10 +154,10 @@
</goals>
<configuration>
<toolName>jlink</toolName>
<removeDirectories>${project.build.directory}/jvm-image/</removeDirectories>
<removeDirectories>${project.build.directory}/runtime/</removeDirectories>
<modulePath>${javafx.home}</modulePath>
<addModules>${jvm.modules}</addModules>
<output>${project.build.directory}/jvm-image</output>
<output>${project.build.directory}/runtime</output>
<args>
<arg>--strip-native-commands</arg>
<arg>--no-header-files</arg>
Expand Down Expand Up @@ -186,46 +187,8 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<version>3.12.1</version>
</plugin>
</plugins>
</build>

<profiles>
<profile>
<id>desktop</id>
<properties>
<gluonfx.target>host</gluonfx.target>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>android</id>
<properties>
<gluonfx.target>android</gluonfx.target>
</properties>
</profile>
<profile>
<id>ios</id>
<properties>
<gluonfx.target>ios</gluonfx.target>
</properties>
</profile>
<profile>
<id>web</id>
<properties>
<gluonfx.target>web</gluonfx.target>
</properties>
</profile>
</profiles>

<repositories>
<repository>
<id>gluon-releases</id>
<url>https://nexus.gluonhq.com/nexus/content/repositories/releases/</url>
</repository>
</repositories>

</project>
9 changes: 9 additions & 0 deletions src/packaging/j3
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

pushd runtime
JAVA_HOME=$(pwd)
popd

PATH=${JAVA_HOME}/bin:${PATH}

java --class-path "lib/*" j3.GUI
11 changes: 11 additions & 0 deletions src/packaging/j3.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@echo off

set JAVA_HOME=

pushd runtime
set JAVA_HOME=%cd%
popd

set PATH=%JAVA_HOME%\bin;%PATH%

java --class-path "lib/*" j3.GUI
7 changes: 6 additions & 1 deletion src/packaging/linux-jpackage.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
--type deb
--name ${app.name}
--icon "${project.basedir}/src/packaging/appicon.png"
--description "${project.description}"
--copyright "${app.copyright} ${app.vendor}"
--license-file ${project.basedir}/COPYING
--vendor ${app.vendor}
--dest "${project.build.directory}"
--main-jar ${project.build.finalName}.jar
--main-class ${main-class}
--input "${project.build.directory}/lib"
--app-version ${app.version}
--runtime-image "${project.build.directory}/jvm-image"
--runtime-image "${project.build.directory}/runtime"
--temp "${project.build.directory}/installer-work"
--app-content "${project.basedir}/data"
--app-content "${project.basedir}/animations"
7 changes: 6 additions & 1 deletion src/packaging/osx-jpackage.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
--type dmg
--name ${app.name}
--icon "${project.basedir}/src/packaging/appicon.icns"
--description "${project.description}"
--copyright "${app.copyright} ${app.vendor}"
--license-file ${project.basedir}/COPYING
--vendor ${app.vendor}
--dest "${project.build.directory}"
--main-jar ${project.build.finalName}.jar
--main-class ${main-class}
--input "${project.build.directory}/lib"
--app-version ${app.version}
--runtime-image "${project.build.directory}/jvm-image"
--runtime-image "${project.build.directory}/runtime"
--temp "${project.build.directory}/installer-work"
--app-content "${project.basedir}/data"
--app-content "${project.basedir}/animations"
Expand Down
23 changes: 12 additions & 11 deletions src/packaging/windows-jpackage.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
--type msi
--name ${app.name}
--win-menu
--win-menu-group ${windows.vendor}
--win-dir-chooser
--win-shortcut
--license-file ${project.basedir}/COPYING
--vendor ${windows.vendor}
--icon "${project.basedir}/src/packaging/appicon.ico"
--description "${project.description}"
--copyright "${app.copyright} ${app.vendor}"
--license-file ${project.basedir}/COPYING
--vendor ${app.vendor}
--dest "${project.build.directory}"
--main-jar ${project.build.finalName}.jar
--main-class ${main.class}
--input "${project.build.directory}/lib"
--app-version ${app.version}
--runtime-image "${project.build.directory}/jvm-image"
--runtime-image "${project.build.directory}/runtime"
--temp "${project.build.directory}/installer-work"
--win-upgrade-uuid ${windows.upgrade.uuid}
--description "${project.description}"
--copyright "Copyright ${windows.vendor}"
--app-content "${project.basedir}/data"
--app-content "${project.basedir}/animations"
--app-content "${project.basedir}/animations"
--win-menu
--win-menu-group ${vendor}
--win-dir-chooser
--win-shortcut
--win-shortcut-prompt
--win-upgrade-uuid ${windows.upgrade.uuid}

0 comments on commit 871419a

Please sign in to comment.