Skip to content

Commit

Permalink
Keep dev-dependencies in lib/dev, out of the way of uberjar.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Apr 17, 2010
1 parent a756c40 commit cd4b569
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 24 deletions.
13 changes: 3 additions & 10 deletions README.md
Expand Up @@ -180,16 +180,6 @@ Once that succeeds it will be available for other projects to depend
on. Leiningen adds Clojars and [the Clojure nightly build
snapshots](http://build.clojure.org) to the default repositories.

## Known Issues

* The uberjar task uses everything in the lib directory. This may
include dev dependencies or old dependencies; it's best to clean
before creating an uberjar.

* See the [issue
tracker](http://github.com/technomancy/leiningen/issues) for a more
complete list.

## Hacking

You'll need to bootstrap using a stable release before you can hack on
Expand Down Expand Up @@ -221,6 +211,9 @@ plugin as a dev-dependency of your project, and you'll be able to call
"lein $YOUR_COMMAND". See the lein-swank directory for an example of a
plugin.

See the [complete list of known
issues](http://github.com/technomancy/leiningen/issues).

## License

Copyright (C) 2009 Phil Hagelberg, Alex Osborne, and Dan Larkin
Expand Down
2 changes: 1 addition & 1 deletion bin/lein
Expand Up @@ -2,7 +2,7 @@

VERSION="1.2.0-SNAPSHOT"

# TODO: put project's lib/dev on leiningen classpath
CLASSPATH="$(find lib/dev -follow -mindepth 1 -maxdepth 1 -print0 2> /dev/null | tr \\0 \:)":$CLASSPATH
LEIN_JAR="$HOME/.m2/repository/leiningen/leiningen/$VERSION/leiningen-$VERSION-standalone.jar"
CLOJURE_JAR="$HOME/.m2/repository/org/clojure/clojure/1.2.0-master-SNAPSHOT/clojure-1.2.0-master-SNAPSHOT.jar"

Expand Down
2 changes: 1 addition & 1 deletion project.clj
Expand Up @@ -10,6 +10,6 @@
[org.apache.ant/ant "1.7.0"]
[jline "0.9.94"]
[org.apache.maven/maven-ant-tasks "2.1.0"]]
:dev-dependencies [[leiningen/lein-swank "1.1.0"]
:dev-dependencies [[leiningen/lein-swank "1.2.0-SNAPSHOT"]
[autodoc "0.7.0"]]
:main leiningen.core)
14 changes: 7 additions & 7 deletions src/leiningen/deps.clj
Expand Up @@ -57,26 +57,26 @@ dependencies with the following:
com.sun.jdmk/jmxtools
com.sun.jmx/jmxri]]"
;; TODO: get deps from ~/.m2 while offline
([project skip-dev]
([project skip-dev set]
(let [deps-task (DependenciesTask.)]
(.setBasedir lancet/ant-project (:root project))
(.setFilesetId deps-task "dependency.fileset")
(.setProject deps-task lancet/ant-project)
(.setPathId deps-task (:name project))
(doseq [r (map make-repository (get-repository-list project))]
(.addConfiguredRemoteRepository deps-task r))
(doseq [dep (:dependencies project)]
(doseq [dep (project set)]
(.addDependency deps-task (make-dependency dep)))
(when-not skip-dev
(doseq [dep (:dev-dependencies project)]
(.addDependency deps-task (make-dependency dep))))
;; TODO: this is starting a rogue thread keeping the JVM from exiting
(.execute deps-task)
(.mkdirs (file (:library-path project)))
(copy-dependencies (:jar-behavior project)
(:library-path project) true
(.getReference lancet/ant-project
(.getFilesetId deps-task)))
(println (format "Copied dependencies into %s."
(:library-path project)))))
(println (format "Copied %s into %s." set (:library-path project)))
(when (and (not skip-dev) (seq (:dev-dependencies project)))
(deps (assoc project :library-path (str (:root project) "/lib/dev"))
true :dev-dependencies))))
([project skip-dev] (deps project skip-dev :dependencies))
([project] (deps project false)))
6 changes: 3 additions & 3 deletions src/leiningen/uberjar.clj
Expand Up @@ -45,10 +45,10 @@ may wish to clean first."
[project]
(jar project)
(let [jarname-root (str (:name project) \- (:version project))]
(with-open [out (-> (file (:root project) (str jarname-root "-standalone.jar"))
(with-open [out (-> (file (:root project)
(str jarname-root "-standalone.jar"))
(FileOutputStream.) (ZipOutputStream.))]
;; TODO: any way to make sure we skip dev dependencies?
(let [deps (->> (file-seq (file (:library-path project)))
(let [deps (->> (.listFiles (file (:library-path project)))
(filter #(.endsWith (.getName %) ".jar"))
(cons (file (:root project) (str jarname-root ".jar"))))
[_ components] (reduce (partial include-dep out)
Expand Down
6 changes: 4 additions & 2 deletions todo.org
Expand Up @@ -19,15 +19,17 @@ Leiningen TODOs
** DONE upgrade task (patch submitted)
** DONE doc generation (autodoc plugin)
* For 1.2.0
** TODO better way to force setFork in eval-in-project
** TODO unpredictable hangs when tasks finish
** DONE include version in jar filenames
** TODO a list of dirs to include in the jar when building
** TODO specify min. lein version in project.clj
** TODO set arbitrary jar metadata
** TODO classpath task to just print configured classpath
** DONE classpath task to just print configured classpath
** TODO walk up the filesystem to find project.clj
** TODO move repl task from shell script to clojure code
** DONE move repl task from shell script to clojure code
** TODO allow *warn-on-reflection* to be turned on in project.clj
** TODO repl task exits on some projects (sample)
* For later
** TODO write shell wrappers
** TODO lein install $PROJECT (works outside project root)
Expand Down

0 comments on commit cd4b569

Please sign in to comment.