-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·83 lines (78 loc) · 2.9 KB
/
build
File metadata and controls
executable file
·83 lines (78 loc) · 2.9 KB
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
#!/bin/bash
YELLOW='\033[1;33m'
CYAN='\033[1;96m'
NC='\033[0m'
MOUNTAIN='\xE2\x9B\xB0'
JAVA_RUNTIME=`/usr/libexec/java_home -v 1.8`
DATE=`date +%Y-%m-%d`
APP_NAME="HALite"
JAR_NAME="HALite.jar"
build_native () {
printf "${MOUNTAIN} Building ${CYAN}${APP_NAME}${NC} app package...\n"
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/javapackager -deploy \
-native image \
-nosign \
-outdir out \
-outfile halite \
-srcfiles out/HALite.jar \
-appclass system_main.HALite \
-name $APP_NAME \
-title "Geochemical Ablation Interface" \
-Bruntime=${JAVA_RUNTIME} \
-Bicon=resources/app/icon.icns
printf "${MOUNTAIN} ${CYAN}${APP_NAME}${NC} built to ${YELLOW}/out/bundles/${APP_NAME}${NC} \n"
}
if [ $# -eq 0 ]; then
build_native
elif [ "$1" == "--icon" ]; then
if [ "$#" -eq 2 ]; then
if file "$2" |grep -qE 'image|bitmap'; then
printf "${MOUNTAIN} Building ${CYAN}${APP_NAME}${NC} iconset...\n"
TARGET=icon.iconset
mkdir $TARGET
sips -z 16 16 $2 --out $TARGET/icon_16x16.png
sips -z 32 32 $2 --out $TARGET/icon_16x16@2x.png
sips -z 32 32 $2 --out $TARGET/icon_32x32.png
sips -z 64 64 $2 --out $TARGET/icon_32x32@2x.png
sips -z 128 128 $2 --out $TARGET/icon_128x128.png
sips -z 256 256 $2 --out $TARGET/icon_128x128@2x.png
sips -z 256 256 $2 --out $TARGET/icon_256x256.png
sips -z 512 512 $2 --out $TARGET/icon_256x256@2x.png
sips -z 512 512 $2 --out $TARGET/icon_512x512.png
cp $2 $TARGET/icon_512x512@2x.png
iconutil -c icns $TARGET
rm -R $TARGET
mv icon.icns resources/app/
#app build
build_native
else
printf "${MOUNTAIN} ${YELLOW}Error:${NC} the specified path ${CYAN}${2}${NC} is not a bitmap \n"
fi
else
printf "${MOUNTAIN} ${YELLOW}Error:${NC} specify an image path when using ${CYAN}--icon${NC} \n"
fi
elif [ "$1" == "--release" ]; then
if [ "$#" -eq 2 ]; then
build_native
#write metadata
python metadata.py "out/bundles/HALite.app/Contents/Info.plist" ${2}
RELEASE_VERSION_LABEL=${2}_$DATE
mkdir -p release/${RELEASE_VERSION_LABEL}
BUILD_NAME="${APP_NAME}_${RELEASE_VERSION_LABEL}"
OSX_NAME="OSX_${BUILD_NAME}.zip"
CROSS_PLATFORM="CrossPlatform_${BUILD_NAME}.zip"
pushd out/bundles
zip -r $OSX_NAME ./${APP_NAME}.app > /dev/null 2>&1
popd
pushd out
zip -r $CROSS_PLATFORM ./$JAR_NAME > /dev/null 2>&1
popd
mv out/bundles/$OSX_NAME release/${RELEASE_VERSION_LABEL}/
mv out/$CROSS_PLATFORM release/${RELEASE_VERSION_LABEL}/
printf "${MOUNTAIN} Build ${YELLOW}$BUILD_NAME${NC} release complete \n"
else
printf "${MOUNTAIN} ${YELLOW}Error:${NC} specify a release version when using ${CYAN}--release${NC} \n"
fi
else
printf "${MOUNTAIN} ${YELLOW}Error:${NC} ${CYAN}$1${NC} not a valid parameter (Did you mean ${CYAN}--release${NC}?)\n"
fi