-
Notifications
You must be signed in to change notification settings - Fork 0
/
package-macos.sh
80 lines (74 loc) · 2.45 KB
/
package-macos.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
#https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-fx-jdk17.0.11-macosx_x64.tar.gz
NAME=CaDoodle
VERSION=1.0.1
MAIN=com.commonwealthrobotics.Main
if [[ -z "${VERSION_SEMVER}" ]]; then
VERSION=4.0.4
else
VERSION="${VERSION_SEMVER}"
fi
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
ARCH=x86_64
JVM=zulu17.50.19-ca-fx-jdk17.0.11-macosx_x64
if [[ $(uname -m) == 'arm64' ]]; then
ARCH=arm64
echo "M1 Mac detected https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-fx-jdk17.0.11-macosx_aarch64.tar.gz"
JVM=zulu17.50.19-ca-fx-jdk17.0.11-macosx_aarch64
else
echo "x86 Mac detected https://cdn.azul.com/zulu/bin/zulu17.50.19-ca-fx-jdk17.0.11-macosx_x64.tar.gz"
fi
set -e
ZIP=$JVM.tar.gz
export JAVA_HOME=$HOME/bin/java17/
if test -d $JAVA_HOME/$JVM/; then
echo "$JAVA_HOME exists."
else
rm -rf $JAVA_HOME
mkdir -p $JAVA_HOME
curl https://cdn.azul.com/zulu/bin/$ZIP -o $ZIP
tar -xvzf $ZIP -C $JAVA_HOME
mv $JAVA_HOME/$JVM/* $JAVA_HOME/
fi
./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 -jar $DIR/$JAR_NAME
echo "Test jar complete"
ICON=$NAME.png
cp SourceIcon.png $ICON
rm -rf $SCRIPT_DIR/$NAME
rm -rf $SCRIPT_DIR/$NAME.AppDir
BUILDDIR=CaDoodleUpdater/build/libs/
TARGETJAR=CaDoodleUpdater.jar
rm -rf *.dmg
echo "Building DMG..."
MACIMAGE=SourceIcon.png
mkdir $NAME.iconset
sips -z 16 16 $MACIMAGE --out $NAME.iconset/icon_16x16.png
sips -z 32 32 $MACIMAGE --out $NAME.iconset/[email protected]
sips -z 32 32 $MACIMAGE --out $NAME.iconset/icon_32x32.png
sips -z 64 64 $MACIMAGE --out $NAME.iconset/[email protected]
sips -z 128 128 $MACIMAGE --out $NAME.iconset/icon_128x128.png
sips -z 256 256 $MACIMAGE --out $NAME.iconset/[email protected]
sips -z 256 256 $MACIMAGE --out $NAME.iconset/icon_256x256.png
sips -z 512 512 $MACIMAGE --out $NAME.iconset/[email protected]
sips -z 512 512 $MACIMAGE --out $NAME.iconset/icon_512x512.png
cp $MACIMAGE $NAME.iconset/[email protected]
iconutil -c icns $NAME.iconset
rm -R $NAME.iconset
$JAVA_HOME/bin/jpackage --input $BUILDDIR \
--name $NAME \
--main-jar $TARGETJAR \
--main-class $MAIN \
--type dmg \
--copyright "Creative Commons" \
--vendor "Common Wealth Robotics" \
--icon $NAME.icns \
--app-version "$VERSION" \
--java-options '--enable-preview'
ls -al
rm -rf release
mkdir release
mv $NAME-$VERSION.dmg release/$NAME-MacOS-$ARCH.dmg