Skip to content

Commit 6cb51b8

Browse files
committed
🔨 Added a script to automatically package the JLink generated images (since for some reason using targetPlatform doesn't build the archives duh)
Signed-off-by: palexdev <alessandro.parisi406@gmail.com>
1 parent dee6071 commit 6cb51b8

File tree

2 files changed

+56
-10
lines changed

2 files changed

+56
-10
lines changed

demo/build.gradle

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import org.apache.tools.ant.taskdefs.condition.Os
2+
13
plugins {
24
id 'application'
35
id 'org.beryx.jlink' version '2.25.0'
@@ -28,6 +30,20 @@ dependencies {
2830
implementation project(':materialfx')
2931
}
3032

33+
compileTestJava {
34+
moduleOptions {
35+
compileOnClasspath = true
36+
}
37+
}
38+
39+
test {
40+
useJUnitPlatform()
41+
42+
moduleOptions {
43+
runOnClasspath = true
44+
}
45+
}
46+
3147
application {
3248
setMainModule("MaterialFX.Demo")
3349
String main = project.findProperty("chooseMain").toString()
@@ -66,17 +82,15 @@ jlink {
6682
addExtraDependencies('javafx')
6783
}
6884

69-
70-
compileTestJava {
71-
moduleOptions {
72-
compileOnClasspath = true
85+
task doPackageAll {
86+
if (Os.isFamily(Os.FAMILY_UNIX)) {
87+
exec {
88+
executable "$projectDir/scripts/JLinkPackage.sh"
89+
args = ["$buildDir"]
90+
}
7391
}
7492
}
7593

76-
test {
77-
useJUnitPlatform()
78-
79-
moduleOptions {
80-
runOnClasspath = true
81-
}
94+
jlinkZip.doLast {
95+
doPackageAll
8296
}

demo/scripts/JLinkPackage.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
#
4+
# Copyright (C) 2022 Parisi Alessandro
5+
# This file is part of MaterialFX (https://github.com/palexdev/MaterialFX).
6+
#
7+
# MaterialFX is free software: you can redistribute it and/or modify
8+
# it under the terms of the GNU Lesser General Public License as published by
9+
# the Free Software Foundation, either version 3 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# MaterialFX is distributed in the hope that it will be useful,
13+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU Lesser General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU Lesser General Public License
18+
# along with MaterialFX. If not, see <http://www.gnu.org/licenses/>.
19+
#
20+
21+
# This only works on Linux and specifically my system since tar2zip is a npm module I installed to convert the tar archive
22+
# to zip easily.
23+
# I was tired of Gradle shit and also tired of learning about boring Linux commands stuff (the tar command is quantum physic
24+
# and the zip command on the other hand is very limited) so this is the quickest solution I came up with
25+
26+
BASE_DIR=$1
27+
IMG_DIR="${BASE_DIR}/image"
28+
OUT_DIR="${BASE_DIR}/distributions"
29+
30+
tar -C "${IMG_DIR}/MaterialFX Demo-linux-x64" --transform 'flags=r;s|.|MFXDemo_Linux|' -c . | xz -4 > "${OUT_DIR}/materialfx_demo_linux64.tar.xz"
31+
tar -C "${IMG_DIR}/MaterialFX Demo-mac" --transform 'flags=r;s|.|MFXDemo_Mac|' -c . | xz -4 > "${OUT_DIR}/materialfx_demo_mac64.tar.xz"
32+
tar -C "${IMG_DIR}/MaterialFX Demo-win" --transform 'flags=r;s|.|MFXDemo_Win|' -c . | tar2zip > "${OUT_DIR}/materialfx_demo_win64.zip"

0 commit comments

Comments
 (0)