Support LEIN_NO_DEV environment variable to skip development settings.

This commit is contained in:
Phil Hagelberg 2011-06-23 22:10:48 -07:00
parent 10413655e7
commit 956d0b3bfe
3 changed files with 17 additions and 7 deletions

View file

@ -1,6 +1,6 @@
(ns leiningen.classpath
"Print the classpath of the current project."
(:use [leiningen.core :only [read-project]]
(:use [leiningen.core :only [read-project no-dev?]]
[leiningen.deps :only [find-jars]]
[leiningen.util.paths :only [leiningen-home]]
[clojure.java.io :only [file]]
@ -45,15 +45,17 @@
(defn get-classpath
"Answer a list of classpath entries for PROJECT."
[project]
(concat [(:source-path project)
(:test-path project)
(concat (if-not (no-dev?)
[(:test-path project)
(:dev-resources-path project)])
[(:source-path project)
(:compile-path project)
(:dev-resources-path project)
(:resources-path project)]
(:extra-classpath-dirs project)
(checkout-deps-paths project)
(find-jars project)
(user-plugins)))
(if-not (no-dev?)
(user-plugins))))
(defn get-classpath-string [project]
(join java.io.File/pathSeparatorChar (get-classpath project)))

View file

@ -25,6 +25,13 @@
(defdeprecated normalize-path paths/normalize-path)
(defn no-dev?
"Should the dev dependencies and directories be ignored?
Warning: alpha; subject to change."
[]
(System/getenv "LEIN_NO_DEV"))
(defn user-init
"Load the user's ~/.lein/init.clj file, if present."
[]

View file

@ -1,7 +1,7 @@
(ns leiningen.deps
"Download all dependencies and put them in :library-path."
(:require [lancet.core :as lancet])
(:use [leiningen.core :only [repositories-for user-settings]]
(:use [leiningen.core :only [repositories-for user-settings no-dev?]]
[leiningen.util.maven :only [make-dependency]]
[leiningen.util.file :only [delete-file-recursively]]
[leiningen.util.paths :only [get-os get-arch]]
@ -190,7 +190,8 @@
(delete-file-recursively (:library-path project) :silently)
(delete-file-recursively (File. (:root project) "native") :silently))
(let [fileset (do-deps project :dependencies)]
(do-deps project :dev-dependencies)
(when-not (no-dev?)
(do-deps project :dev-dependencies))
(extract-native-deps project)
(when (:checksum-deps project)
(spit (new-deps-checksum-file project) (deps-checksum project)))