Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
gradle LP
#!/usr/bin/env bash
# bin/compile <build-dir> <cache-dir>
# fail fast
set -e
BIN_DIR=$(cd $(dirname $0); pwd) # absolute path
# parse args
BUILD_DIR=$1
CACHE_DIR=$2
GRADLEDIST="gradle-1.0-milestone-3"
if [ ! -d $CACHE_DIR ] ; then
mkdir $CACHE_DIR
fi
export GRADLE_USER_HOME=$CACHE_DIR
if [ -f $BUILD_DIR/gradlew ] ; then
BUILDCMD="./gradlew"
else
if [ ! -d $CACHE_DIR/$GRADLEDIST ] ; then
cd $CACHE_DIR
GRADLE_URL="http://lang-pack-gradle.s3.amazonaws.com/$GRADLEDIST.tar.gz"
echo -n "-----> Installing $GRADLEDIST....."
curl --silent --location $GRADLE_URL | tar xz
echo " done"
echo " (Use the Gradle Wrapper if you want to use a different gradle version)"
fi
BUILDCMD="gradle"
fi
cd $BUILD_DIR
export PATH=$CACHE_DIR/$GRADLEDIST/bin:$PATH
# build app
echo "-----> executing $BUILDCMD"
$BUILDCMD 2>&1 | sed -u 's/^/ /'
if [ "${PIPESTATUS[*]}" != "0 0" ]; then
echo " ! Failed to build app"
exit 1
fi
#!/usr/bin/env bash
# bin/use <build-dir>
if [ -f $1/build.gradle ]; then
echo "Java/Gradle" && exit 0
else
echo "no" && exit 1
fi
#!/usr/bin/env bash
# bin/release <build-dir>
BUILD_DIR=$1
cat <<EOF
---
config_vars:
JAVA_OPTS: -Xmx384m -Xss512k -XX:+UseCompressedOops
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment