-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bash
42 lines (37 loc) · 1.54 KB
/
build.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# @author Val Richter
# @reviewer Malte Richert
#
javaPath=/opt/homebrew/Cellar/openjdk/20.0.1
javafxPath=/Users/malterichert/Dev/javafx-sdk-20.0.1
jarName=SoundInvestments.jar
mavenJarPath=./target/sound-investments-1.0-SNAPSHOT-jar-with-dependencies.jar
#
# Build clean dist directory
if [ -d "./dist" ]; then
rm -rf "./dist"
fi
mkdir "./dist"
# Build Fat-Jar
echo "Building JAR..."
mvn clean package >/dev/null
cp "$mavenJarPath" "./dist/$jarName" >/dev/null
# Build Java Runtime
echo "Building Runtime..."
cp -r "$javafxPath" "./dist/javafx" >/dev/null
jlink --no-header-files --no-man-pages --compress=2 --strip-debug --module-path "$javaPath/jmods" --add-modules java.net.http,java.base,java.sql,jdk.localedata,java.desktop --module-path "./dist/javafx/lib" --add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics --bind-services --output dist/java
cp -r "./dist/javafx/bin" "./dist/java/bin" >/dev/null
rm -rf "./dist/javafx/bin" >/dev/null
rm -rf "./dist/javafx/legal" >/dev/null
rm "./dist/javafx/src.zip" >/dev/null
# Copy resources into the distributable
echo "Copying Resources..."
distResourcesPath=./dist/src/main
mkdir -p "$distResourcesPath"
cp -r "./src/main/resources" "$distResourcesPath" >/dev/null
# Write executable into the distributable
echo "Writing Script..."
echo "#! /usr/bin/env bash
cd -- \$(dirname \$BASH_SOURCE)
java --module-path javafx/lib --add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics -jar $jarName" >dist/SoundInvestments.command
chmod a+x dist/SoundInvestments.command
echo "Done"