2012-06-06 16:52:24 +00:00
|
|
|
#!/usr/bin/env bash
|
2009-11-02 06:21:50 +00:00
|
|
|
|
2013-02-26 19:09:11 +00:00
|
|
|
# Ensure this file is executable via `chmod a+x lein`, then place it
|
2012-07-04 05:38:06 +00:00
|
|
|
# somewhere on your $PATH, like ~/bin. The rest of Leiningen will be
|
|
|
|
# installed upon first run into the ~/.lein/self-installs directory.
|
|
|
|
|
2013-11-19 18:05:36 +00:00
|
|
|
export LEIN_VERSION="2.4.0-SNAPSHOT"
|
2009-12-03 04:47:30 +00:00
|
|
|
|
2010-08-24 03:05:07 +00:00
|
|
|
case $LEIN_VERSION in
|
2010-08-08 18:00:14 +00:00
|
|
|
*SNAPSHOT) SNAPSHOT="YES" ;;
|
|
|
|
*) SNAPSHOT="NO" ;;
|
|
|
|
esac
|
|
|
|
|
2013-03-12 22:14:39 +00:00
|
|
|
if [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "msys" ]]; then
|
2012-09-26 17:48:17 +00:00
|
|
|
delimiter=";"
|
|
|
|
else
|
|
|
|
delimiter=":"
|
|
|
|
fi
|
|
|
|
|
2013-04-12 20:19:00 +00:00
|
|
|
if [[ "$OSTYPE" == "cygwin" ]]; then
|
|
|
|
cygwin=true
|
|
|
|
else
|
|
|
|
cygwin=false
|
|
|
|
fi
|
|
|
|
|
2012-09-26 17:48:17 +00:00
|
|
|
function make_native_path {
|
|
|
|
# ensure we have native paths
|
2013-04-12 21:07:40 +00:00
|
|
|
if $cygwin && [[ "$1" == /* ]]; then
|
2013-01-03 06:32:15 +00:00
|
|
|
echo -n "$(cygpath -wp "$1")"
|
2013-11-30 16:04:10 +00:00
|
|
|
elif [[ "$OSTYPE" == "msys" && "$1" == /?/* ]]; then
|
2013-03-12 22:14:39 +00:00
|
|
|
echo -n "$(sh -c "(cd $1 2</dev/null && pwd -W) || echo $1 | sed 's/^\\/\([a-z]\)/\\1:/g'")"
|
2012-09-26 17:48:17 +00:00
|
|
|
else
|
2013-01-03 06:32:15 +00:00
|
|
|
echo -n "$1"
|
2012-09-26 17:48:17 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# usage : add_path PATH_VAR [PATH]...
|
|
|
|
function add_path {
|
2012-10-26 02:43:31 +00:00
|
|
|
local path_var="$1"
|
2012-09-26 17:48:17 +00:00
|
|
|
shift
|
|
|
|
while [ -n "$1" ];do
|
|
|
|
# http://bashify.com/?Useful_Techniques:Indirect_Variables:Indirect_Assignment
|
2013-11-30 16:04:10 +00:00
|
|
|
if [[ -z ${!path_var} ]]; then
|
|
|
|
export ${path_var}="$(make_native_path "$1")"
|
|
|
|
else
|
|
|
|
export ${path_var}="${!path_var}${delimiter}$(make_native_path "$1")"
|
|
|
|
fi
|
2013-01-03 06:32:15 +00:00
|
|
|
shift
|
2012-09-26 17:48:17 +00:00
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2013-08-09 07:30:47 +00:00
|
|
|
function download_failed_message {
|
|
|
|
echo "Failed to download $1"
|
|
|
|
echo "It's possible your HTTP client's certificate store does not have the"
|
|
|
|
echo "correct certificate authority needed. This is often caused by an"
|
|
|
|
echo "out-of-date version of libssl. Either upgrade it or set HTTP_CLIENT"
|
|
|
|
echo "to turn off certificate checks:"
|
|
|
|
echo " export HTTP_CLIENT=\"wget --no-check-certificate -O\" # or"
|
|
|
|
echo " export HTTP_CLIENT=\"curl --insecure -f -L -o\""
|
|
|
|
echo "It's also possible that you're behind a firewall haven't yet"
|
|
|
|
echo "set HTTP_PROXY and HTTPS_PROXY."
|
|
|
|
}
|
|
|
|
|
2013-07-25 03:55:44 +00:00
|
|
|
function self_install {
|
|
|
|
if [ -r "$LEIN_JAR" ]; then
|
|
|
|
echo "The self-install jar already exists at $LEIN_JAR."
|
|
|
|
echo "If you wish to re-download, delete it and rerun \"$0 self-install\"."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "Downloading Leiningen to $LEIN_JAR now..."
|
|
|
|
mkdir -p "$(dirname "$LEIN_JAR")"
|
|
|
|
LEIN_URL="https://leiningen.s3.amazonaws.com/downloads/leiningen-$LEIN_VERSION-standalone.jar"
|
|
|
|
$HTTP_CLIENT "$LEIN_JAR.pending" "$LEIN_URL"
|
|
|
|
if [ $? == 0 ]; then
|
|
|
|
# TODO: checksum
|
|
|
|
mv -f "$LEIN_JAR.pending" "$LEIN_JAR"
|
|
|
|
else
|
|
|
|
rm "$LEIN_JAR.pending" 2> /dev/null
|
|
|
|
download_failed_message "$LEIN_URL"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2012-02-10 00:58:11 +00:00
|
|
|
if [ `id -u` -eq 0 ] && [ "$LEIN_ROOT" = "" ]; then
|
2010-07-30 20:28:45 +00:00
|
|
|
echo "WARNING: You're currently running as root; probably by accident."
|
|
|
|
echo "Press control-C to abort or Enter to continue as root."
|
|
|
|
echo "Set LEIN_ROOT to disable this warning."
|
2011-03-25 04:14:54 +00:00
|
|
|
read _
|
2010-07-30 20:28:45 +00:00
|
|
|
fi
|
|
|
|
|
2011-04-13 16:40:10 +00:00
|
|
|
NOT_FOUND=1
|
2010-08-27 02:50:04 +00:00
|
|
|
ORIGINAL_PWD="$PWD"
|
2011-05-25 04:35:40 +00:00
|
|
|
while [ ! -r "$PWD/project.clj" ] && [ "$PWD" != "/" ] && [ $NOT_FOUND -ne 0 ]
|
2010-08-12 01:22:25 +00:00
|
|
|
do
|
|
|
|
cd ..
|
2010-08-16 20:14:15 +00:00
|
|
|
if [ "$(dirname "$PWD")" = "/" ]; then
|
2010-08-12 01:22:25 +00:00
|
|
|
NOT_FOUND=0
|
|
|
|
cd "$ORIGINAL_PWD"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2012-10-27 16:57:39 +00:00
|
|
|
export LEIN_HOME="${LEIN_HOME:-"$HOME/.lein"}"
|
2009-11-06 04:36:27 +00:00
|
|
|
|
2012-08-18 00:22:52 +00:00
|
|
|
for f in "$LEIN_HOME/leinrc" ".leinrc"; do
|
2012-10-26 02:43:31 +00:00
|
|
|
if [ -e "$f" ]; then
|
|
|
|
source "$f"
|
2012-08-18 00:22:52 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2013-04-12 21:07:40 +00:00
|
|
|
if $cygwin; then
|
2012-10-26 02:43:31 +00:00
|
|
|
export LEIN_HOME=`cygpath -w "$LEIN_HOME"`
|
2012-04-14 19:18:35 +00:00
|
|
|
fi
|
|
|
|
|
2012-05-10 02:17:37 +00:00
|
|
|
LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar"
|
|
|
|
|
2009-11-22 06:18:51 +00:00
|
|
|
# normalize $0 on certain BSDs
|
2010-07-26 08:37:32 +00:00
|
|
|
if [ "$(dirname "$0")" = "." ]; then
|
|
|
|
SCRIPT="$(which $(basename "$0"))"
|
2009-11-22 05:08:38 +00:00
|
|
|
else
|
|
|
|
SCRIPT="$0"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# resolve symlinks to the script itself portably
|
|
|
|
while [ -h "$SCRIPT" ] ; do
|
|
|
|
ls=`ls -ld "$SCRIPT"`
|
|
|
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
|
|
|
if expr "$link" : '/.*' > /dev/null; then
|
|
|
|
SCRIPT="$link"
|
|
|
|
else
|
2010-12-03 02:17:36 +00:00
|
|
|
SCRIPT="$(dirname "$SCRIPT"$)/$link"
|
2009-11-22 05:08:38 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
BIN_DIR="$(dirname "$SCRIPT")"
|
2009-11-22 00:45:10 +00:00
|
|
|
|
2013-03-28 18:00:27 +00:00
|
|
|
export LEIN_JVM_OPTS="${LEIN_JVM_OPTS-"-XX:+TieredCompilation -XX:TieredStopAtLevel=1"}"
|
|
|
|
|
2013-08-10 00:58:39 +00:00
|
|
|
# This needs to be defined before we call HTTP_CLIENT below
|
|
|
|
if [ "$HTTP_CLIENT" = "" ]; then
|
|
|
|
if type -p curl >/dev/null 2>&1; then
|
|
|
|
if [ "$https_proxy" != "" ]; then
|
|
|
|
CURL_PROXY="-x $https_proxy"
|
|
|
|
fi
|
|
|
|
HTTP_CLIENT="curl $CURL_PROXY -f -L -o"
|
|
|
|
else
|
|
|
|
HTTP_CLIENT="wget -O"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2013-03-28 18:00:27 +00:00
|
|
|
# When :eval-in :classloader we need more memory
|
|
|
|
grep -E -q '^\s*:eval-in\s+:classloader\s*$' project.clj 2> /dev/null && \
|
|
|
|
export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Xms64m -Xmx512m"
|
2012-08-18 00:31:27 +00:00
|
|
|
|
2012-01-17 22:57:24 +00:00
|
|
|
if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
|
2009-11-22 05:08:38 +00:00
|
|
|
# Running from source checkout
|
|
|
|
LEIN_DIR="$(dirname "$BIN_DIR")"
|
2009-11-22 00:45:10 +00:00
|
|
|
|
2013-03-01 01:12:51 +00:00
|
|
|
# Need to use lein release to bootstrap the leiningen-core library (for aether)
|
|
|
|
if [ ! -r "$LEIN_DIR/leiningen-core/.lein-bootstrap" ]; then
|
2012-01-17 23:11:20 +00:00
|
|
|
echo "Leiningen is missing its dependencies."
|
2013-03-23 13:54:59 +00:00
|
|
|
echo "Please run \"lein bootstrap\" in the leiningen-core/ directory"
|
|
|
|
echo "with a stable release of Leiningen. See CONTRIBUTING.md for details."
|
2009-11-28 04:27:11 +00:00
|
|
|
exit 1
|
2009-11-22 00:45:10 +00:00
|
|
|
fi
|
2012-01-24 03:17:14 +00:00
|
|
|
|
2012-02-08 04:10:51 +00:00
|
|
|
# If project.clj for lein or leiningen-core changes, we must recalculate
|
2012-02-08 02:25:07 +00:00
|
|
|
LAST_PROJECT_CHECKSUM=$(cat "$LEIN_DIR/.lein-project-checksum" 2> /dev/null)
|
|
|
|
PROJECT_CHECKSUM=$(sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj")
|
|
|
|
if [ "$PROJECT_CHECKSUM" != "$LAST_PROJECT_CHECKSUM" ]; then
|
|
|
|
if [ -r "$LEIN_DIR/.lein-classpath" ]; then
|
|
|
|
rm "$LEIN_DIR/.lein-classpath"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2013-03-01 01:12:51 +00:00
|
|
|
# Use bin/lein to calculate its own classpath.
|
2012-02-16 20:34:53 +00:00
|
|
|
if [ ! -r "$LEIN_DIR/.lein-classpath" ] && [ "$1" != "classpath" ]; then
|
2012-02-08 02:25:07 +00:00
|
|
|
echo "Recalculating Leiningen's classpath."
|
2012-01-24 03:17:14 +00:00
|
|
|
ORIG_PWD="$PWD"
|
|
|
|
cd "$LEIN_DIR"
|
2012-02-08 03:00:30 +00:00
|
|
|
|
2012-05-10 18:44:31 +00:00
|
|
|
$0 classpath .lein-classpath
|
2012-10-26 02:43:31 +00:00
|
|
|
sum "$LEIN_DIR/project.clj" "$LEIN_DIR/leiningen-core/project.clj" > \
|
2012-05-10 18:44:31 +00:00
|
|
|
.lein-project-checksum
|
2012-01-24 03:17:14 +00:00
|
|
|
cd "$ORIG_PWD"
|
|
|
|
fi
|
|
|
|
|
2012-03-07 18:57:25 +00:00
|
|
|
mkdir -p "$LEIN_DIR/target/classes"
|
2013-03-28 18:00:27 +00:00
|
|
|
export LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Dclojure.compile.path=$LEIN_DIR/target/classes"
|
2012-09-26 18:14:41 +00:00
|
|
|
add_path CLASSPATH "$LEIN_DIR/leiningen-core/src/" "$LEIN_DIR/leiningen-core/resources/" \
|
2013-03-01 01:12:51 +00:00
|
|
|
"$LEIN_DIR/test:$LEIN_DIR/target/classes" "$LEIN_DIR/src" ":$LEIN_DIR/resources"
|
2012-08-18 00:32:40 +00:00
|
|
|
|
2012-07-26 21:09:04 +00:00
|
|
|
if [ -r "$LEIN_DIR/.lein-classpath" ]; then
|
2012-10-26 02:43:31 +00:00
|
|
|
add_path CLASSPATH "$(cat "$LEIN_DIR/.lein-classpath" 2> /dev/null)"
|
2012-07-26 21:09:04 +00:00
|
|
|
else
|
2013-03-01 01:12:51 +00:00
|
|
|
add_path CLASSPATH "$(cat "$LEIN_DIR/leiningen-core/.lein-bootstrap" 2> /dev/null)"
|
2012-07-26 21:09:04 +00:00
|
|
|
fi
|
2012-05-07 18:24:52 +00:00
|
|
|
else # Not running from a checkout
|
2012-09-26 18:14:41 +00:00
|
|
|
add_path CLASSPATH "$LEIN_JAR"
|
2012-05-07 18:24:52 +00:00
|
|
|
|
2012-10-27 16:57:39 +00:00
|
|
|
BOOTCLASSPATH="-Xbootclasspath/a:$LEIN_JAR"
|
2009-11-22 00:45:10 +00:00
|
|
|
|
2009-11-14 21:44:59 +00:00
|
|
|
if [ ! -r "$LEIN_JAR" -a "$1" != "self-install" ]; then
|
2013-07-25 03:55:44 +00:00
|
|
|
self_install
|
2009-11-10 06:22:09 +00:00
|
|
|
fi
|
2009-11-02 06:21:50 +00:00
|
|
|
fi
|
|
|
|
|
2012-08-08 16:31:47 +00:00
|
|
|
# TODO: explain what to do when Java is missing
|
2012-10-26 02:43:31 +00:00
|
|
|
export JAVA_CMD="${JAVA_CMD:-"java"}"
|
|
|
|
export LEIN_JAVA_CMD="${LEIN_JAVA_CMD:-$JAVA_CMD}"
|
2010-05-23 00:28:39 +00:00
|
|
|
|
2013-12-20 02:19:23 +00:00
|
|
|
if [[ -z "${DRIP_INIT+x}" && "$(basename "$LEIN_JAVA_CMD")" == *drip* ]]; then
|
2012-11-08 17:36:54 +00:00
|
|
|
export DRIP_INIT="$(printf -- '-e\n(require (quote leiningen.repl))')"
|
2013-12-20 02:19:23 +00:00
|
|
|
export DRIP_INIT_CLASS="clojure.main"
|
2012-08-27 18:39:08 +00:00
|
|
|
fi
|
|
|
|
|
2010-12-25 04:14:25 +00:00
|
|
|
# Support $JAVA_OPTS for backwards-compatibility.
|
2012-02-08 04:10:51 +00:00
|
|
|
export JVM_OPTS="${JVM_OPTS:-"$JAVA_OPTS"}"
|
2010-12-25 04:14:25 +00:00
|
|
|
|
2013-04-12 20:24:34 +00:00
|
|
|
# Handle jline issue with cygwin not propagating OSTYPE through java subprocesses: https://github.com/jline/jline2/issues/62
|
|
|
|
cygterm=false
|
2013-04-12 21:07:40 +00:00
|
|
|
if $cygwin; then
|
2013-04-12 20:24:34 +00:00
|
|
|
case "$TERM" in
|
|
|
|
rxvt* | xterm* | vt*) cygterm=true ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
|
|
|
if $cygterm; then
|
2013-05-31 14:52:24 +00:00
|
|
|
LEIN_JVM_OPTS="$LEIN_JVM_OPTS -Djline.terminal=jline.UnixTerminal"
|
2013-04-12 20:24:34 +00:00
|
|
|
stty -icanon min 1 -echo > /dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
2011-06-24 05:49:00 +00:00
|
|
|
# TODO: investigate http://skife.org/java/unix/2011/06/20/really_executable_jars.html
|
2010-07-21 04:49:34 +00:00
|
|
|
# If you're packaging this for a package manager (.deb, homebrew, etc)
|
2012-02-08 04:10:51 +00:00
|
|
|
# you need to remove the self-install and upgrade functionality or see lein-pkg.
|
2010-04-17 04:46:53 +00:00
|
|
|
if [ "$1" = "self-install" ]; then
|
2013-03-28 19:21:19 +00:00
|
|
|
if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
|
2013-03-28 19:39:13 +00:00
|
|
|
echo "Running self-install from a checkout is not supported."
|
2013-03-28 19:21:19 +00:00
|
|
|
echo "See CONTRIBUTING.md for SNAPSHOT-specific build instructions."
|
|
|
|
exit 1
|
2010-07-29 04:30:16 +00:00
|
|
|
fi
|
2013-07-25 03:55:44 +00:00
|
|
|
echo "Manual self-install is deprecated; it will run automatically when necessary."
|
|
|
|
self_install
|
2013-08-12 02:57:33 +00:00
|
|
|
elif [ "$1" = "upgrade" ] || [ "$1" = "downgrade" ]; then
|
2011-06-24 03:22:06 +00:00
|
|
|
if [ "$LEIN_DIR" != "" ]; then
|
|
|
|
echo "The upgrade task is not meant to be run from a checkout."
|
|
|
|
exit 1
|
|
|
|
fi
|
2010-08-08 18:00:14 +00:00
|
|
|
if [ $SNAPSHOT = "YES" ]; then
|
2010-02-12 08:41:12 +00:00
|
|
|
echo "The upgrade task is only meant for stable releases."
|
|
|
|
echo "See the \"Hacking\" section of the README."
|
|
|
|
exit 1
|
2009-11-10 06:22:09 +00:00
|
|
|
fi
|
2010-02-12 22:04:47 +00:00
|
|
|
if [ ! -w "$SCRIPT" ]; then
|
|
|
|
echo "You do not have permission to upgrade the installation in $SCRIPT"
|
|
|
|
exit 1
|
|
|
|
else
|
2013-03-20 02:52:11 +00:00
|
|
|
TARGET_VERSION="${2:-stable}"
|
2012-04-07 03:50:28 +00:00
|
|
|
echo "The script at $SCRIPT will be upgraded to the latest $TARGET_VERSION version."
|
2010-02-12 22:04:47 +00:00
|
|
|
echo -n "Do you want to continue [Y/n]? "
|
|
|
|
read RESP
|
|
|
|
case "$RESP" in
|
|
|
|
y|Y|"")
|
|
|
|
echo
|
|
|
|
echo "Upgrading..."
|
2011-03-04 02:55:36 +00:00
|
|
|
TARGET="/tmp/lein-$$-upgrade"
|
2013-04-12 21:07:40 +00:00
|
|
|
if $cygwin; then
|
2012-05-31 04:19:27 +00:00
|
|
|
TARGET=`cygpath -w $TARGET`
|
|
|
|
fi
|
2012-04-07 03:50:28 +00:00
|
|
|
LEIN_SCRIPT_URL="https://github.com/technomancy/leiningen/raw/$TARGET_VERSION/bin/lein"
|
2012-08-25 21:46:03 +00:00
|
|
|
$HTTP_CLIENT "$TARGET" "$LEIN_SCRIPT_URL"
|
|
|
|
if [ $? == 0 ]; then
|
2013-11-19 23:25:06 +00:00
|
|
|
cmp -s "$TARGET" "$SCRIPT"
|
|
|
|
if [ $? == 0 ]; then
|
|
|
|
echo "Leiningen is already up-to-date."
|
|
|
|
fi
|
2013-07-25 03:55:44 +00:00
|
|
|
mv "$TARGET" "$SCRIPT" && chmod +x "$SCRIPT"
|
|
|
|
exec "$SCRIPT" version
|
2012-08-25 21:46:03 +00:00
|
|
|
else
|
|
|
|
download_failed_message "$LEIN_SCRIPT_URL"
|
|
|
|
fi;;
|
2010-02-12 22:04:47 +00:00
|
|
|
*)
|
|
|
|
echo "Aborted."
|
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
fi
|
2009-11-02 06:38:59 +00:00
|
|
|
else
|
2013-04-12 21:07:40 +00:00
|
|
|
if $cygwin; then
|
2010-03-07 05:51:13 +00:00
|
|
|
# When running on Cygwin, use Windows-style paths for java
|
2010-11-19 17:48:02 +00:00
|
|
|
ORIGINAL_PWD=`cygpath -w "$ORIGINAL_PWD"`
|
2010-07-23 16:12:39 +00:00
|
|
|
fi
|
|
|
|
|
2012-09-26 18:34:27 +00:00
|
|
|
# apply context specific CLASSPATH entries
|
|
|
|
if [ -f .lein-classpath ]; then
|
|
|
|
add_path CLASSPATH "$(cat .lein-classpath)"
|
|
|
|
fi
|
|
|
|
|
2010-07-23 16:12:39 +00:00
|
|
|
if [ $DEBUG ]; then
|
2012-08-17 17:41:38 +00:00
|
|
|
echo "Leiningen's classpath: $CLASSPATH"
|
|
|
|
fi
|
|
|
|
|
2012-09-11 17:30:16 +00:00
|
|
|
if ([ "$LEIN_FAST_TRAMPOLINE" != "" ] || [ -r .lein-fast-trampoline ]) &&
|
|
|
|
[ -r project.clj ]; then
|
2013-04-12 12:11:15 +00:00
|
|
|
INPUTS="$@ $(cat project.clj) $LEIN_VERSION $(test -f "$LEIN_HOME/profiles.clj" && cat "$LEIN_HOME/profiles.clj")"
|
2014-01-21 01:36:19 +00:00
|
|
|
export INPUT_CHECKSUM=$(echo $INPUTS | shasum - | cut -f 1 -d " ")
|
2012-08-17 17:41:38 +00:00
|
|
|
# Just don't change :target-path in project.clj, mkay?
|
|
|
|
TRAMPOLINE_FILE="target/trampolines/$INPUT_CHECKSUM"
|
2012-09-11 17:30:16 +00:00
|
|
|
else
|
2013-06-17 19:51:22 +00:00
|
|
|
TRAMPOLINE_FILE="$(mktemp /tmp/lein-trampoline-XXXXXXXXXXXXX)"
|
2012-09-11 17:30:16 +00:00
|
|
|
trap "rm -f $TRAMPOLINE_FILE" EXIT
|
2010-06-22 02:21:22 +00:00
|
|
|
fi
|
2010-04-17 04:46:53 +00:00
|
|
|
|
2013-04-12 21:07:40 +00:00
|
|
|
if $cygwin; then
|
2012-02-08 04:10:51 +00:00
|
|
|
TRAMPOLINE_FILE=`cygpath -w $TRAMPOLINE_FILE`
|
|
|
|
fi
|
|
|
|
|
2012-08-17 17:58:37 +00:00
|
|
|
if [ "$INPUT_CHECKSUM" != "" ] && [ -r "$TRAMPOLINE_FILE" ]; then
|
2012-08-17 20:11:00 +00:00
|
|
|
if [ $DEBUG ]; then
|
|
|
|
echo "Fast trampoline with $TRAMPOLINE_FILE."
|
|
|
|
fi
|
2012-08-17 17:15:43 +00:00
|
|
|
exec sh -c "exec $(cat $TRAMPOLINE_FILE)"
|
2011-06-20 02:28:16 +00:00
|
|
|
else
|
2012-08-27 18:04:22 +00:00
|
|
|
export TRAMPOLINE_FILE
|
2014-06-08 15:07:27 +00:00
|
|
|
"$LEIN_JAVA_CMD" \
|
2012-10-27 16:57:39 +00:00
|
|
|
"${BOOTCLASSPATH[@]}" \
|
2012-08-17 17:15:43 +00:00
|
|
|
$LEIN_JVM_OPTS \
|
|
|
|
-Dfile.encoding=UTF-8 \
|
|
|
|
-Dmaven.wagon.http.ssl.easy=false \
|
2014-01-24 17:59:58 +00:00
|
|
|
-Dmaven.wagon.rto=10000 \
|
2012-08-17 17:15:43 +00:00
|
|
|
-Dleiningen.original.pwd="$ORIGINAL_PWD" \
|
2012-12-02 02:51:15 +00:00
|
|
|
-Dleiningen.script="$SCRIPT" \
|
2012-09-27 18:22:03 +00:00
|
|
|
-classpath "$CLASSPATH" \
|
2012-08-17 17:15:43 +00:00
|
|
|
clojure.main -m leiningen.core.main "$@"
|
|
|
|
|
|
|
|
EXIT_CODE=$?
|
|
|
|
|
2013-04-12 20:24:34 +00:00
|
|
|
if $cygterm ; then
|
|
|
|
stty icanon echo > /dev/null 2>&1
|
|
|
|
fi
|
|
|
|
|
2013-07-16 09:40:51 +00:00
|
|
|
## TODO: [ -r "$TRAMPOLINE_FILE" ] may be redundant? A trampoline file
|
|
|
|
## is always generated these days.
|
2012-11-03 16:54:29 +00:00
|
|
|
if [ -r "$TRAMPOLINE_FILE" ] && [ "$LEIN_TRAMPOLINE_WARMUP" = "" ]; then
|
2012-08-17 17:58:37 +00:00
|
|
|
TRAMPOLINE="$(cat $TRAMPOLINE_FILE)"
|
|
|
|
if [ "$INPUT_CHECKSUM" = "" ]; then
|
|
|
|
rm $TRAMPOLINE_FILE
|
|
|
|
fi
|
2013-07-16 09:40:51 +00:00
|
|
|
if [ "$TRAMPOLINE" = "" ]; then
|
|
|
|
exit $EXIT_CODE
|
|
|
|
else
|
|
|
|
exec sh -c "exec $TRAMPOLINE"
|
|
|
|
fi
|
2012-08-17 17:15:43 +00:00
|
|
|
else
|
|
|
|
exit $EXIT_CODE
|
|
|
|
fi
|
2011-06-20 02:28:16 +00:00
|
|
|
fi
|
2009-11-02 06:38:59 +00:00
|
|
|
fi
|