Merge pull request #526 from juergenhoetzel/master

Invalid classpath entries in .lein-classpath
This commit is contained in:
Phil Hagelberg 2012-04-16 11:25:11 -07:00
commit 0f0c2770ff
2 changed files with 12 additions and 6 deletions

View file

@ -35,6 +35,10 @@ done
export LEIN_HOME=${LEIN_HOME:-"$HOME/.lein"} export LEIN_HOME=${LEIN_HOME:-"$HOME/.lein"}
LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar" LEIN_JAR="$LEIN_HOME/self-installs/leiningen-$LEIN_VERSION-standalone.jar"
if [ "$OSTYPE" = "cygwin" ]; then
LEIN_HOME=`cygpath -w $LEIN_HOME`
fi
# apply context specific CLASSPATH entries # apply context specific CLASSPATH entries
if [ -f .lein-classpath ] && [ ! -f src/leiningen/version.clj ]; then if [ -f .lein-classpath ] && [ ! -f src/leiningen/version.clj ]; then
CLASSPATH="`cat .lein-classpath`:$CLASSPATH" CLASSPATH="`cat .lein-classpath`:$CLASSPATH"
@ -87,9 +91,7 @@ if [ -r "$BIN_DIR/../src/leiningen/version.clj" ]; then
ORIG_PWD="$PWD" ORIG_PWD="$PWD"
cd "$LEIN_DIR" cd "$LEIN_DIR"
# For some reason "$0" classpath > .lein-classpath doesn't work; wtf? $0 classpath .lein-classpath
LEIN_CLASSPATH=$($0 classpath)
echo $LEIN_CLASSPATH > .lein-classpath
sum $LEIN_DIR/project.clj $LEIN_DIR/leiningen-core/project.clj > .lein-project-checksum sum $LEIN_DIR/project.clj $LEIN_DIR/leiningen-core/project.clj > .lein-project-checksum
cd "$ORIG_PWD" cd "$ORIG_PWD"
fi fi

View file

@ -7,8 +7,12 @@
(str/join java.io.File/pathSeparatorChar (classpath/get-classpath project))) (str/join java.io.File/pathSeparatorChar (classpath/get-classpath project)))
(defn classpath (defn classpath
"Print the classpath of the current project. "Write the classpath of the current project to output-file.
With no arguments, print the classpath to stdout.
Suitable for java's -cp option." Suitable for java's -cp option."
[project] ([project]
(println (get-classpath-string project))) (println (get-classpath-string project)))
([project output-file]
(spit output-file (get-classpath-string project))))