|
|
|
|
@ -20,9 +20,16 @@ cd $DIR
|
|
|
|
|
GIT_COMMIT=$(git rev-parse HEAD)
|
|
|
|
|
GIT_DIRTY=$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)
|
|
|
|
|
|
|
|
|
|
# If we're building a race-enabled build, then set that up.
|
|
|
|
|
if [ ! -z $PACKER_RACE ]; then
|
|
|
|
|
echo -e "${OK_COLOR}--> Building with race detection enabled${NO_COLOR}"
|
|
|
|
|
PACKER_RACE="-race"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Compile the main Packer app
|
|
|
|
|
echo -e "${OK_COLOR}--> Compiling Packer${NO_COLOR}"
|
|
|
|
|
go build \
|
|
|
|
|
${PACKER_RACE} \
|
|
|
|
|
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
|
|
|
|
-v \
|
|
|
|
|
-o bin/packer .
|
|
|
|
|
@ -32,6 +39,7 @@ for PLUGIN in $(find ./plugin -mindepth 1 -maxdepth 1 -type d); do
|
|
|
|
|
PLUGIN_NAME=$(basename ${PLUGIN})
|
|
|
|
|
echo -e "${OK_COLOR}--> Compiling Plugin: ${PLUGIN_NAME}${NO_COLOR}"
|
|
|
|
|
go build \
|
|
|
|
|
${PACKER_RACE} \
|
|
|
|
|
-ldflags "-X github.com/mitchellh/packer/packer.GitCommit ${GIT_COMMIT}${GIT_DIRTY}" \
|
|
|
|
|
-v \
|
|
|
|
|
-o bin/packer-${PLUGIN_NAME} ${PLUGIN}
|
|
|
|
|
|