-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·81 lines (71 loc) · 1.73 KB
/
build.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
current=$(pwd)
client=$current/client
electron=$current/electron
function buildClient() {
echo "build client ..."
# build client
cd "$client" || exit
yarn build
# clean resources
cd "$current" || exit
rm -rf electron/src/dist/*
mkdir electron/src/dist
cp -R client/dist/* electron/src/dist
}
function buildMacArm64Electron() {
cd "$electron" || exit
yarn package --arch=arm64 --platform=darwin
}
function buildMacX64Electron() {
cd "$electron" || exit
yarn package --arch=x64 --platform=darwin
}
function buildWindowsElectron() {
cd "$electron" || exit
yarn package --platform win32
}
if [ "$1" == mac ]; then
echo "build on mac"
if [ "$2" == all ]; then
buildClient
if [ "$3" == arm64 ]; then
buildMacArm64Electron
elif [ "$3" == x64 ]; then
buildMacX64Electron
else
buildMacArm64Electron
buildMacX64Electron
fi
elif [ "$2" == client ]; then
buildClient
elif [ "$2" == electron ]; then
if [ "$3" == arm64 ]; then
buildMacArm64Electron
elif [ "$3" == x64 ]; then
buildMacX64Electron
else
buildMacArm64Electron
buildMacX64Electron
fi
else
echo "no build target"
exit
fi
echo "build on mac success"
elif [ "$1" == windows ]; then
echo "build on windows"
if [ "$2" == all ]; then
buildClient
buildWindowsElectron
elif [ "$2" == client ]; then
buildClient
elif [ "$2" == electron ]; then
buildWindowsElectron
else
echo "no build target"
exit
fi
echo "build on windows success"
else
echo "not support"
fi