-
Notifications
You must be signed in to change notification settings - Fork 538
Expand file tree
/
Copy pathrelease_build.sh
More file actions
executable file
·56 lines (48 loc) · 1.19 KB
/
release_build.sh
File metadata and controls
executable file
·56 lines (48 loc) · 1.19 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
#!/bin/bash
APP_PATH="build/macos/Build/Products/Release/Anx Reader.app"
OPT_APP_FORMAT=""
OPT_DEPLOYMENT=""
BUILD_RESULT=0
for optname in "$@"
do
case $optname in
macos)
OPT_APP_FORMAT="macos"
;;
-d)
OPT_DEPLOYMENT="-d"
;;
-h)
echo "usage: $0 macos [-d]"
exit 0
;;
*)
echo "Invalid argument: $optname"
echo "usage: $0 macos [-d]"
exit 1
;;
esac
done
# 如果没有传递任何参数,显示帮助信息
if [ -z "$OPT_APP_FORMAT" ] && [ -z "$OPT_DEPLOYMENT" ]; then
echo "usage: $0 macos [-d]"
exit 1
fi
clrecho() {
printf "\e[38;5;196m$1\e[0m\n"
}
if [[ "$OPT_APP_FORMAT" == "macos" ]]; then
# if [[ $OPT_DEPLOYMENT == "-d" ]]; then
# fvm flutter clean
# fi
fvm flutter build macos --release
BUILD_RESULT=$?
if [[ $BUILD_RESULT != 0 ]]; then
clrecho "Failed to build the $OPT_APP_FORMAT"
fi
fi
if [[ $BUILD_RESULT == 0 && $OPT_DEPLOYMENT == "-d" ]]; then
echo "deploy to /Applications/"
rm -rf /Applications/AnxReader.app
cp -rf "$APP_PATH" /Applications/AnxReader.app
fi