pull/597/head
Rongjian Lan 6 years ago
parent 569d12fb14
commit 673c3d9144
  1. 11
      scripts/go_executable_build.sh

@ -13,6 +13,7 @@ GOOS=linux
GOARCH=amd64
FOLDER=/${WHOAMI:-$USER}
RACE=
VERBOSE=
unset -v progdir
case "${0}" in
@ -50,6 +51,7 @@ OPTIONS:
-b bucket set the upload bucket name (default: $BUCKET)
-f folder set the upload folder name in the bucket (default: $FOLDER)
-r enable -race build option (default: $RACE)
-v verbose build process (default: $VERBOSE)
ACTION:
build build binaries only (default action)
@ -87,7 +89,7 @@ function build_only
if [[ -z "$build" || "$bin" == "$build" ]]; then
rm -f $BINDIR/$bin
echo "building ${SRC[$bin]}"
env GOOS=$GOOS GOARCH=$GOARCH go build -v -x -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]}
env GOOS=$GOOS GOARCH=$GOARCH go build $VERBOSE -ldflags="-X main.version=v${VERSION} -X main.commit=${COMMIT} -X main.builtAt=${BUILTAT} -X main.builtBy=${BUILTBY}" -o $BINDIR/$bin $RACE ${SRC[$bin]}
if [ "$(uname -s)" == "Linux" ]; then
$BINDIR/$bin -version
fi
@ -116,7 +118,7 @@ function upload
if [ -e ${LIB[$lib]} ]; then
$AWSCLI s3 cp ${LIB[$lib]} s3://${BUCKET}$FOLDER/$lib --acl public-read
else
echo "!! MISSING $lib !!"
echo "!! MISSING ${LIB[$lib]} !!"
fi
done
@ -153,7 +155,7 @@ function upload_wallet
if [ -e ${LIB[$lib]} ]; then
$AWSCLI s3 cp ${LIB[$lib]} s3://${PUBBUCKET}/$DESTDIR/$lib --acl public-read
else
echo "!! MISSING $lib !!"
echo "!! MISSING ${LIB[$lib]} !!"
fi
done
@ -161,7 +163,7 @@ function upload_wallet
}
################################ MAIN FUNCTION ##############################
while getopts "hp:a:o:b:f:r" option; do
while getopts "hp:a:o:b:f:rv" option; do
case $option in
h) usage ;;
p) PROFILE=$OPTARG ;;
@ -170,6 +172,7 @@ while getopts "hp:a:o:b:f:r" option; do
b) BUCKET=$OPTARG/ ;;
f) FOLDER=$OPTARG ;;
r) RACE=-race ;;
v) VERBOSE='-v -x' ;;
esac
done

Loading…
Cancel
Save