-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-windows_x86_64.sh
91 lines (81 loc) · 2.7 KB
/
package-windows_x86_64.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
echo "Windows bundling"
VERSION=0.0.1
NAME=CaDoodle
MAIN=com.commonwealthrobotics.Main
if [[ -z "${VERSION_SEMVER}" ]]; then
VERSION=4.0.4
else
VERSION="${VERSION_SEMVER}"
fi
#https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-fx-jdk17.0.11-win_x64.zip
# zulu17.50.19-ca-fx-jdk17.0.11-win_x64
JVM=zulu17.50.19-ca-fx-jdk17.0.11-win_x64
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
set -e
ZIP=$JVM.zip
export JAVA_HOME="$HOME/bin/java17/"
if test -d "$JAVA_HOME/$JVM/"; then
echo "$JAVA_HOME exists."
else
mkdir -p "$JAVA_HOME"
curl https://cdn.azul.com/zulu/bin/$ZIP -o $ZIP
#unzip $ZIP -d $JAVA_HOME
7z x $ZIP -o"$JAVA_HOME"
mv "$JAVA_HOME/$JVM/"* "$JAVA_HOME/"
fi
echo "Compile wiht gradle"
./gradlew shadowJar
echo "Test jar in: $SCRIPT_DIR"
DIR="$SCRIPT_DIR/CaDoodleUpdater/build/libs/"
INPUT_DIR="$SCRIPT_DIR/input"
JAR_NAME=CaDoodleUpdater.jar
#$JAVA_HOME/bin/java.exe -jar $DIR/$JAR_NAME
echo "Test jar complete"
ICON=$NAME.ico
magick convert SourceIcon.png -resize 256x256 your_image_256.png
magick convert SourceIcon.png -resize 128x128 your_image_128.png
magick convert SourceIcon.png -resize 64x64 your_image_64.png
magick convert SourceIcon.png -resize 48x48 your_image_48.png
magick convert SourceIcon.png -resize 32x32 your_image_32.png
magick convert SourceIcon.png -resize 16x16 your_image_16.png
magick convert your_image_16.png your_image_32.png your_image_48.png your_image_64.png your_image_128.png your_image_256.png $NAME.ico
PACKAGE="$JAVA_HOME/bin/jpackage.exe"
mkdir -p "$INPUT_DIR"
cp "$DIR/$JAR_NAME" "$INPUT_DIR/"
#$PACKAGE --input "$INPUT_DIR/" --name "$NAME" --main-jar "$JAR_NAME" --app-version "$VERSION" --icon "$ICON" --type "exe" --resource-dir "temp2" --verbose
#exit 1
rm -rf temp*
rm -rf $NAME
# depends on WiX https://github.com/wixtoolset/wix3/releases
"$PACKAGE" --input "$INPUT_DIR/" \
--name "$NAME" \
--main-jar "$JAR_NAME" \
--main-class "$MAIN" \
--type "app-image" \
--temp "temp1" \
--app-version "$VERSION" \
--icon "$ICON" \
--java-options '--enable-preview'
echo "Zipping standalone version"
rm -rf *.zip
7z a $NAME-$VERSION.zip "$NAME/"
echo "Building system wide installer"
"$PACKAGE" --input "$INPUT_DIR/" \
--name "$NAME" \
--main-jar "$JAR_NAME" \
--main-class "$MAIN" \
--type "exe" \
--temp "temp2" \
--app-version "$VERSION" \
--icon "$ICON" \
--win-shortcut \
--win-menu \
--win-dir-chooser \
--win-per-user-install \
--java-options '--enable-preview'
ls -al
rm -rf release
mkdir release
export ARCH=x86_64
cp $NAME-$VERSION.exe release/$NAME-Windows-$ARCH.exe
cp $NAME-$VERSION.zip release/$NAME-Windows-$ARCH.zip