1 Star 0 Fork 492

TechLib/Rainbond

forked from 好雨科技/Rainbond 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
localbuild.sh 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
set -o errexit
# define package name
releasedir=./.release
distdir=${releasedir}/dist
VERSION=$(git symbolic-ref HEAD 2>/dev/null | cut -d"/" -f 3)
buildTime=$(date +%F-%H)
git_commit=$(git log -n 1 --pretty --format=%h)
release_desc=${VERSION}-${git_commit}-${buildTime}
function prepare() {
rm -rf $releasedir
mkdir -pv $releasedir/{tmp,dist}
[ ! -d "$distdir/usr/local/" ] && mkdir -p $distdir/usr/local/bin
}
build_items=(api builder grctl monitor mq node webcli worker eventlog init-probe mesh-data-panel)
function localbuild() {
if [ "$1" = "all" ];then
for item in "${build_items[@]}"
do
echo "build local ${item}"
go build -ldflags "-X github.com/goodrain/rainbond/cmd.version=${release_desc}" -o _output/${GOOS}/${VERSION}/rainbond-$item ./cmd/$item
done
else
echo "build local $1 ${VERSION}"
outputname="_output/${GOOS}/${VERSION}/rainbond-$1"
if [ "$GOOS" = "windows" ];then
outputname="_output/${GOOS}/${VERSION}/rainbond-$1.exe"
fi
ldflags="-X github.com/goodrain/rainbond/cmd.version=${release_desc}"
if [ "$STATIC" = "true" ];then
ldflags="${ldflags} -extldflags '-static'"
fi
go build -v -ldflags "${ldflags}" -o ${outputname} ./cmd/$1
fi
}
case $1 in
*)
prepare
if [ "$1" = "all" ];then
for item in "${build_items[@]}"
do
localbuild $item
done
fi
localbuild $1
;;
esac
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/TechLib/Rainbond.git
git@gitee.com:TechLib/Rainbond.git
TechLib
Rainbond
Rainbond
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385