-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
96 lines (82 loc) · 1.68 KB
/
deploy.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
92
93
94
95
96
#!/bin/sh
# Readme
# RD同学 sh deploy.sh //默认所有子系统全部编译
# 指定的子系统(module) sh deploy.sh -m mo-common,mo-car
#
#定义颜色
WHITE="\e[1;37m"
RED="\e[1;31m"
blue="\e[0;34m"
BLUE="\e[1;34m"
NC="\e[0m"
# 准备初始化环境
Prepare(){
cwd=`pwd`
deployDir="${cwd}/../../"
sourceDir=${cwd}
}
# 编译一个子系统 Build common
Build(){
moduleName=$1
moduleDir="${sourceDir}/${moduleName}"
if [ -d ${moduleDir} ]
then
cd ${moduleDir}
if [[ "local" = ${des} ]]
then
if [ $optimize ]
then
jello release -d local -com
else
jello release -d local -cm
fi
else
if [ $optimize ]
then
jello release -com
else
jello release -cm
fi
fi
else
echo "${moduleDir}文件夹不存在"
fi
}
#入口函数
startBuild(){
Prepare
if [ ! -z $buildModules ]
then
OLD_IFS="$IFS"
IFS=","
moduleList=($buildModules)
IFS="$OLD_IFS"
fi
for module in ${moduleList[@]}
do
echo $module
Build $module
done
}
#子系统列表
moduleList=("common" "user" "home" "invest")
#命令行参数分析
while getopts "d:m:o" arg
do
case $arg in
d)
des=$OPTARG
;;
m)
buildModules=$OPTARG #指定编译的子系统
;;
o)
optimize=true
;;
?) #当有不认识的选项的时候arg为?
echo -e ${RED} "参数错误" ${NC}
exit 1
;;
esac
done
startBuild