Skip to content

Commit 58e3cad

Browse files
authoredMay 18, 2020
Merge pull request #1 from HanSolo/master
a
2 parents 0021106 + d605a04 commit 58e3cad

File tree

5 files changed

+125
-6
lines changed

5 files changed

+125
-6
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
@echo off
2+
REM VRL distribution script (creates app bundles and installers).
3+
REM (c) 2020 by Michael Hoffer <info@michaelhoffer.de>
4+
REM This script can easily be adapted for other applications as well.
5+
6+
REM App distribution configuration:
7+
REM - specify app name, jar file and desired app type (msi, app-bundle, etc.)
8+
REM - since jpackage is still in preview, we download a recent JDK installation that
9+
REM is used locally to build the application package
10+
SET APP_NAME="SpaceFX"
11+
SET APP_JAR="SpaceFX-1.0-SNAPSHOT.jar"
12+
SET APP_TYPE="msi"
13+
SET JPACKAGE_JVM="https://download.java.net/java/GA/jdk14/076bab302c7b4508975440c56f6cc26a/36/GPL/openjdk-14_windows-x64_bin.zip"
14+
REM App version is passed as argument by github action workflow
15+
SET APP_VERSION=%1
16+
17+
REM Please don't change the rest of the script. If something doesn't work
18+
REM then create an issue where we can discuss potential changes.
19+
set DIR="%~dp0"
20+
echo Building distribution in dir: %DIR%
21+
cd %DIR%
22+
23+
REM Check for 7zip and curl which are used to download and unpack the local Java distribution.
24+
for %%X in (7z.exe) do (set FOUND7Z=%%~$PATH:X)
25+
for %%X in (curl.exe) do (set FOUNDCURL=%%~$PATH:X)
26+
if not defined FOUND7Z (
27+
echo "ERROR: please make sure that 7Zip is installed and on the path."
28+
)
29+
if not defined FOUNDCURL (
30+
echo "ERROR: please make sure that Curl is installed and on the path."
31+
)
32+
33+
REM Do not create the local JDK if it already exists
34+
if exist ".tmp-runtime\jdk-14\" (
35+
echo "> jdk 14 for package generation already downloaded"
36+
) else (
37+
REM If it doesn't exist, however, download and unpack the local JDK
38+
REM and create runtime image with the runtime JDK
39+
REM (JAVA_HOME is expected to be set correctly)
40+
mkdir .tmp-runtime\
41+
cd .tmp-runtime
42+
echo "> downloading jdk 14"
43+
curl -o jdk14.zip %JPACKAGE_JVM%
44+
echo "> unpacking jdk 14"
45+
7z x jdk14.zip
46+
echo "> creating runtime image"
47+
"%JAVA_HOME%\bin\jlink" -p "%JAVA_HOME%\jmods" ^
48+
--add-modules java.desktop ^
49+
--strip-debug ^
50+
--no-header-files ^
51+
--no-man-pages ^
52+
--strip-native-commands ^
53+
--vm=server ^
54+
--compress=2 ^
55+
--output runtime
56+
)
57+
58+
REM Change to distribution directory (script location) where
59+
REM we will create the final application package
60+
cd %DIR%
61+
62+
REM Finally, invoke the jpackage CLI program from the local JDK that
63+
REM has been downloaded earlier.
64+
set JPKG_HOME=.tmp-runtime\jdk-14\
65+
set JPKG_EXECUTABLE=%JPKG_HOME%\bin\jpackage
66+
%JPKG_EXECUTABLE% --input ..\..\build\libs\ ^
67+
--name %APP_NAME% ^
68+
--main-jar %APP_JAR% ^
69+
--type %APP_TYPE% ^
70+
--runtime-image .tmp-runtime\runtime ^
71+
--app-version 0.0.0 ^
72+
--win-per-user-install ^
73+
--win-menu ^
74+
--win-menu-group SpaceFX
75+
76+
REM Rename the application MSI
77+
move SpaceFX-0.0.0.msi SpaceFX-%APP_VERSION%-windows-x64.msi
78+
79+
REM Show final MSI package
80+
dir *.msi

‎.github/workflows/create-snapshot.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: create-snapshot
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build-windows:
7+
8+
runs-on: [windows-latest]
9+
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Set up JDK 13
13+
uses: actions/setup-java@v1
14+
with:
15+
java-version: 13
16+
architecture: x64
17+
- name: Build with Gradle
18+
run: .\gradlew.bat assemble
19+
- name: Create Distribution
20+
run: .\.github\workflows\create-distribution-SNAPSHOT-windows-x64.bat "SNAPSHOT-$(([datetime]::now).tostring("yyyy-MM-dd_HH-mm-ss"))"
21+
- uses: AButler/upload-release-assets@v2.0
22+
with:
23+
files: './.github/workflows/SpaceFX-SNAPSHOT-*-windows-x64.msi'
24+
release-tag: SNAPSHOT
25+
repo-token: ${{ secrets.GITHUB_TOKEN }}
26+

‎.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@
1212
/tmp
1313
*.class
1414
spacefx.iml
15+
16+
/.vscode
17+
/.classpath
18+
/.project
19+
/.settings
20+
/.github/workflows/.tmp-runtime/
21+
/.github/workflows/*.msi
22+
/bin/
23+

‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Donations are welcome at [Paypal](https://paypal.me/hans0l0)
1515
<p>Web<br><img src="https://raw.githubusercontent.com/HanSolo/SpaceFX/master/SpaceFX_Web.jpg" width=50%></img></p>
1616

1717
### Youtube video
18-
I've recorded a little [video](https://youtu.be/IS71geUu9RE) that shows the game in action.
18+
I've recorded a little [video](https://youtu.be/Kc0lv3R5VG0) that shows the game in action.
1919

2020

2121
### Requirements for building a native package
@@ -178,4 +178,4 @@ cd /PATH/TO/SpaceFX
178178
./gradlew jproRun
179179
```
180180

181-
Open a browser and go to ```localhost:8080```
181+
Open a browser and go to ```localhost:8080```

‎build.gradle

+8-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ buildscript {
1212
classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.2'
1313
classpath 'org.javamodularity:moduleplugin:1.6.0'
1414
classpath 'org.beryx:badass-jlink-plugin:2.16.4'
15-
classpath 'com.sandec.jpro:jpro-plugin-gradle:2019.2.2'
15+
classpath 'com.sandec.jpro:jpro-plugin-gradle:2019.2.3'
1616
}
1717
}
1818

@@ -43,13 +43,17 @@ dependencies {
4343
implementation "org.openjfx:javafx-graphics:11:$platform"
4444
implementation "org.openjfx:javafx-controls:11:$platform"
4545
implementation "org.openjfx:javafx-media:11:$platform"
46-
implementation "com.sandec.jpro:jpro-webapi:2019.2.2"
46+
implementation "com.sandec.jpro:jpro-webapi:2019.2.3"
4747
}
4848

4949
mainClassName = "$moduleName/eu.hansolo.spacefx.SpaceFX"
5050

5151
// To run SpaceFX in the browser with jPro use:
52-
//mainClassName = "eu.hansolo.spacefx.SpaceFX"
52+
task web() {
53+
mainClassName = "eu.hansolo.spacefx.SpaceFX"
54+
dependsOn jproRun
55+
}
56+
5357

5458
jar {
5559
from {
@@ -79,6 +83,6 @@ jpro {
7983
JVMArgs << '-Xmx1000m'
8084
visible = false // Debug mode can also be used to create images via canvas and snapshot
8185
noRenderJobs = true // false to enable snapshot support
82-
jproVersion = "2019.2.2"
86+
jproVersion = "2019.2.3"
8387
openURLOnStartup = false
8488
}

0 commit comments

Comments
 (0)
Please sign in to comment.