Fix trampoline file to work with Drip
Read the TRAMPOLINE_FILE environment variable instead of putting it in a system property. Drip looks up pre-spun JVMs using a hash of the command-line arguments, so putting the trampoline file in a system property causes it to start a new spare JVM for every lein invocation.
This commit is contained in:
parent
04c784c1aa
commit
30a6643fcd
3 changed files with 9 additions and 7 deletions
2
bin/lein
2
bin/lein
|
@ -255,13 +255,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 "$@"
|
||||
|
||||
|
|
|
@ -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%"
|
||||
|
|
|
@ -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))
|
||||
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue