-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change name of plugin to app-metric-registrar and add build script
Signed-off-by: Ben Fuller <[email protected]>
- Loading branch information
Max Eshleman
authored and
Ben Fuller
committed
Aug 20, 2018
1 parent
a969ed2
commit b3858e9
Showing
3 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
pushd() { | ||
command pushd $@ >/dev/null | ||
} | ||
|
||
popd() { | ||
command popd $@ >/dev/null | ||
} | ||
|
||
pushd $(dirname $(dirname $0)) | ||
PROJECT_ROOT=$(pwd -P) | ||
popd | ||
|
||
PLUGIN_OUTPUT=${PLUGIN_DIRECTORY:-${PROJECT_ROOT}/plugins} | ||
mkdir -p ${PLUGIN_OUTPUT} | ||
pushd ${PLUGIN_OUTPUT} | ||
PLUGIN_OUTPUT=$(pwd -P) | ||
popd | ||
|
||
function build_for() { | ||
local OS=$1 | ||
local ARCH=$2 | ||
|
||
echo "Building CLI for $OS $ARCH..." | ||
|
||
BUILD_NUMBER=${VERSION:-0.0.1} | ||
MAJOR_MINOR_PATCH=( ${BUILD_NUMBER//./ }) | ||
VERSION_FLAGS="-X main.Major=${MAJOR_MINOR_PATCH[0]} -X main.Minor=${MAJOR_MINOR_PATCH[1]} -X main.Patch=${MAJOR_MINOR_PATCH[2]}" | ||
|
||
GOARCH=${ARCH} GOOS=${OS} go build -o ${PLUGIN_OUTPUT}/app-metrics-registrar-${OS}-${ARCH}-${BUILD_NUMBER} -ldflags "${VERSION_FLAGS}" | ||
} | ||
|
||
pushd ${PROJECT_ROOT} | ||
source .envrc | ||
|
||
echo "Fetching dependencies..." | ||
[[ -z "${NO_DEP:-}" ]] && go get github.com/golang/dep/cmd/dep | ||
|
||
pushd src/cliplugin | ||
[[ -z "${NO_DEP:-}" ]] && dep ensure | ||
|
||
if [[ -n "${CLI_BUILD_OS}" ]]; then | ||
build_for ${CLI_BUILD_OS} ${CLI_BUILD_ARCH:-amd64} | ||
else | ||
for OS in windows linux darwin; do | ||
build_for ${OS} amd64 | ||
done | ||
for OS in windows linux; do | ||
build_for ${OS} 386 | ||
done | ||
fi | ||
popd | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters