blob: c30aca02ec999320e2b3f0f3ce36c04aa0425ae3 [file] [log] [blame]
#!/usr/bin/env bash
# This script should be used to publish a snapshot JAR to Apache Maven
# repo from the current HEAD.
set -e
# Use 'atexit' for cleanup.
. $(dirname ${0})/
# Use colors for errors.
. $(dirname ${0})/
test ${#} -eq 1 || \
{ echo "Usage: `basename ${0}` [version]"; exit 1; }
echo "${GREEN}Deploying ${TAG}${NORMAL}"
read -p "Hit enter to continue ... "
WORK_DIR=`mktemp -d /tmp/mesos-tag-XXXX`
atexit "rm -rf ${WORK_DIR}"
# Get the absolute path of the local git clone.
MESOS_GIT_LOCAL=$(cd "$(dirname $0)"/..; pwd)
pushd ${WORK_DIR}
# Make a shallow clone from the local git repository.
git clone --shared ${MESOS_GIT_LOCAL} mesos
pushd mesos
# Ensure has the correct version.
echo "Confirming that contains ${VERSION}"
grep "\[mesos\], \[${VERSION}\]"
echo "${GREEN}Updating to include 'SNAPSHOT'.${NORMAL}"
sed -i '' "s/\[mesos\], \[.*\]/[mesos], [${TAG}]/"
# Build mesos.
mkdir build
pushd build
../configure --disable-optimize
# First build the protobuf compiler.
# TODO(vinod): This is short term fix for MESOS-959.
pushd 3rdparty
make -j3
# Build and deploy the jar.
make -j3 maven-install
mvn deploy -f src/java/mesos.pom
echo "${GREEN}Successfully deployed the jar to maven snapshot repository ...${NORMAL}"
popd # build
popd # mesos
popd # ${WORK_DIR}
echo "${GREEN}Success!${NORMAL}"
exit 0