-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
48 lines (41 loc) · 1.18 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
#! /bin/bash
set -o pipefail -o errexit
if [ -z "$1" ];then
echo "please enter sched, exec or all"
exit
elif [ "$1" != "sched" ] && [ "$1" != "exec" ] && [ "$1" != "all" ];then
echo "only receive [sched], [exec] and [all]"
exit
fi
current_dir=$(pwd)
module_name=${current_dir##*/}
gopath="${current_dir}/gocode"
exec_path="${current_dir}/bin"
repo_path="$gopath/src"
#gopath_w="$repo_path/meggy/Godeps/_workspace"
if [ -e "${gopath}" ];then
rm -rf $gopath
fi
mkdir -p $repo_path
if [ -e "${exec_path}" ];then
rm -rf $exec_path
fi
mkdir $exec_path
ln -sf ${current_dir} $repo_path
#mv -T "$repo_path/$module_name" "$repo_path/my_framework"
export GOPATH=$gopath
if [ "$1" == "sched" ];then
build_name="sched"
rm -f $exec_path/$build_name
go build -o $exec_path/$build_name $repo_path/$module_name/cmd/sche_app.go
elif [ "$1" == "exec" ];then
build_name="sim_exec"
rm -f $exec_path/$build_name
go build -o $exec_path/$build_name $repo_path/$module_name/cmd/exec_app.go
else
rm -rf $exec_path
build_name="sched"
go build -o $exec_path/$build_name $repo_path/$module_name/cmd/sche_app.go
build_name="sim_exec"
go build -o $exec_path/$build_name $repo_path/$module_name/cmd/exec_app.go
fi