Skip to content

Commit

Permalink
Merge branch 'drip'
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjudd committed Sep 8, 2012
2 parents 6b2412a + 35a01e6 commit 1077aa4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 5 additions & 1 deletion bin/lein
Expand Up @@ -155,6 +155,10 @@ function download_failed_message {
export JAVA_CMD=${JAVA_CMD:-"java"}
export LEIN_JAVA_CMD=${LEIN_JAVA_CMD:-$JAVA_CMD}

if [[ "$(basename $LEIN_JAVA_CMD)" == *drip* ]]; then
export DRIP_INIT=$(printf -- "-e\n(require 'leiningen.repl)")
fi

# Support $JAVA_OPTS for backwards-compatibility.
export JVM_OPTS="${JVM_OPTS:-"$JAVA_OPTS"}"

Expand Down Expand Up @@ -255,13 +259,13 @@ else
fi
exec sh -c "exec $(cat $TRAMPOLINE_FILE)"
else
export TRAMPOLINE_FILE
$LEIN_JAVA_CMD \
-client -XX:+TieredCompilation \
$LEIN_JVM_OPTS \
-Dfile.encoding=UTF-8 \
-Dmaven.wagon.http.ssl.easy=false \
-Dleiningen.original.pwd="$ORIGINAL_PWD" \
-Dleiningen.trampoline-file="$TRAMPOLINE_FILE" \
-cp "$CLASSPATH" \
clojure.main -m leiningen.core.main "$@"

Expand Down
3 changes: 1 addition & 2 deletions bin/lein.bat
Expand Up @@ -189,8 +189,7 @@ if "%1" == "trampoline" (goto RUN_TRAMPOLINE) else (goto RUN_NORMAL)
set "TRAMPOLINE_FILE=%TEMP%\lein-trampoline-%RANDOM%.bat"
%JAVA_CMD% -client %LEIN_JVM_OPTS% ^
-Dleiningen.original.pwd="%ORIGINAL_PWD%" ^
-Dleiningen.trampoline-file="%TRAMPOLINE_FILE%" ^
-cp "%CLASSPATH%" clojure.main -e "(use 'leiningen.core.main)(apply -main (map str '(%*)))"
-cp "%CLASSPATH%" clojure.main -e "(use 'leiningen.core.main)(apply -main "%TRAMPOLINE_FILE%" (map str '(%*)))"

if not exist "%TRAMPOLINE_FILE%" goto EOF
call "%TRAMPOLINE_FILE%"
Expand Down
11 changes: 7 additions & 4 deletions src/leiningen/trampoline.clj
Expand Up @@ -9,8 +9,11 @@

(def ^:dynamic *trampoline?* false)

(defn- trampoline-file []
(System/getenv "TRAMPOLINE_FILE"))

(defn- win-batch? []
(.endsWith (System/getProperty "leiningen.trampoline-file") ".bat"))
(.endsWith (trampoline-file) ".bat"))

(defn- quote-arg [arg]
(format "\"%s\"" arg))
Expand All @@ -33,10 +36,10 @@

(defn write-trampoline [project forms deps]
(let [command (trampoline-command-string project forms deps)
trampoline-file (System/getProperty "leiningen.trampoline-file")]
trampoline (trampoline-file)]
(main/debug "Trampoline command:" command)
(.mkdirs (.getParentFile (io/file trampoline-file)))
(spit trampoline-file command)))
(.mkdirs (.getParentFile (io/file trampoline)))
(spit trampoline command)))

(defn ^:higher-order trampoline
"Run a task without nesting the project's JVM inside Leiningen's.
Expand Down

0 comments on commit 1077aa4

Please sign in to comment.