Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Start ripping out Lein 1 compat. Issue #175.

  • Loading branch information...
commit f69f3890c1500aa1ef82b590394f42159f5b63e8 1 parent 341b689
@emezeske authored
View
3  .gitignore
@@ -4,6 +4,9 @@ lib
classes/
lein-cljsbuild-*.*.*
cljsbuild-*.*.*
+target
+plugin/target
+support/target
example-projects/*/*.jar
example-projects/simple/resources
example-projects/advanced/resources/public/js
View
8 bin/test-install.sh
@@ -14,7 +14,7 @@ pushd $project_root
rm -rf ~/.m2/repository/lein-cljsbuild ~/.m2/repository/cljsbuild/
for d in support plugin; do
pushd $d
- lein install, midje
+ lein do install, test
popd
done
for d in $projects; do
@@ -23,10 +23,6 @@ for d in $projects; do
extra_command=', cljsbuild test'
fi
lein clean
- rm -rf .lein-*
- lein cljsbuild clean, cljsbuild once$extra_command
- lein clean
- rm -rf .lein-*
- lein2 do cljsbuild clean, cljsbuild once$extra_command
+ lein do cljsbuild clean, cljsbuild once$extra_command
popd
done
View
7 example-projects/advanced/project.clj
@@ -4,7 +4,7 @@
:dependencies [[org.clojure/clojure "1.4.0"]
[compojure "1.0.4"]
[hiccup "1.0.0"]]
- :plugins [[lein-cljsbuild "0.2.9"]
+ :plugins [[lein-cljsbuild "0.3.0"]
[lein-ring "0.7.0"]]
; Enable the lein hooks for: clean, compile, test, and jar.
:hooks [leiningen.cljsbuild]
@@ -71,7 +71,4 @@
:compiler {:output-to "resources/private/js/unit-test.js"
:optimizations :whitespace
:pretty-print true}}}}
- :ring {:handler example.routes/app}
- ; for Leiningen 1.x:
- :source-path "src-clj"
- :dev-dependencies [[lein-ring "0.7.0"]])
+ :ring {:handler example.routes/app})
View
7 example-projects/simple/project.clj
@@ -4,14 +4,11 @@
:dependencies [[org.clojure/clojure "1.4.0"]
[compojure "1.0.4"]
[hiccup "1.0.0"]]
- :plugins [[lein-cljsbuild "0.2.9"]
+ :plugins [[lein-cljsbuild "0.3.0"]
[lein-ring "0.7.0"]]
:cljsbuild {
:builds [{:source-path "src-cljs"
:compiler {:output-to "resources/public/js/main.js"
:optimizations :whitespace
:pretty-print true}}]}
- :ring {:handler example.routes/app}
- ; for Leiningen 1.x:
- :source-path "src-clj"
- :dev-dependencies [[lein-ring "0.7.0"]])
+ :ring {:handler example.routes/app})
View
17 plugin/project.clj
@@ -1,12 +1,15 @@
(defproject lein-cljsbuild "0.3.0"
:description "ClojureScript Autobuilder Plugin"
:url "http://github.com/emezeske/lein-cljsbuild"
- :license {:name "Eclipse Public License - v 1.0"
- :url "http://www.eclipse.org/legal/epl-v10.html"
- :distribution :repo}
+ :license
+ {:name "Eclipse Public License - v 1.0"
+ :url "http://www.eclipse.org/legal/epl-v10.html"
+ :distribution :repo}
:dependencies [[fs "1.1.2"]]
- :dev-dependencies [[midje "1.4.0"]
- ; NOTE: lein-midje requires different versions to be
- ; installed for lein1 vs lein2 compatibility :(.
- [lein-midje "1.0.10"]]
+ :profiles {
+ :dev {
+ :dependencies [
+ [midje "1.4.0"]
+ [cljsbuild "0.3.0"]]
+ :plugins [[lein-midje "2.0.4"]]}}
:eval-in-leiningen true)
View
115 plugin/src/leiningen/cljsbuild.clj
@@ -8,48 +8,20 @@
[leiningen.cljsbuild.jar :as jar]
[leiningen.cljsbuild.subproject :as subproject]
[leiningen.compile :as lcompile]
+ [leiningen.core.eval :as leval]
+ [leiningen.core.main :as lmain]
[leiningen.help :as lhelp]
[leiningen.jar :as ljar]
[leiningen.test :as ltest]
[leiningen.trampoline :as ltrampoline]
[robert.hooke :as hooke]))
-; TODO: lein2: All temporary output files, etc, should go into (:target-path project),
-; in which case they will automatically be removed upon "lein clean".
-
-(def repl-output-path ".lein-cljsbuild-repl")
-
-(def exit-code-success 0)
-(def exit-code-failure 1)
-
-; TODO: lein1 does not have a leiningen.core.main ns. This can go away once lein2
-; is released, if that ever happens.
-(def ^:private lein2?
- (try
- (require 'leiningen.core.main)
- true
- (catch java.io.FileNotFoundException _
- false)))
-
-(defn- exit-success
- "Exit successfully in a way that satisifies lein1 and lein2."
- []
- (if lein2?
- nil
- exit-code-success))
-
-(defn- exit-failure
- "Fail in a way that satisifies lein1 and lein2."
- []
- (if lein2?
- ((resolve 'leiningen.core.main/abort))
- exit-code-failure))
+(def ^:private repl-output-path "repl")
(defn- run-local-project [project crossover-path builds requires form]
- (subproject/eval-in-project project crossover-path builds
+ (leval/eval-in-project (subproject/make-subproject project crossover-path builds)
form
- requires)
- (exit-success))
+ requires))
(defn- run-compiler [project {:keys [crossover-path crossovers builds]} build-ids watch?]
(doseq [build-id build-ids]
@@ -117,7 +89,7 @@
(do ~@forms)
(do
(println "REPL subcommands must be run via \"lein trampoline cljsbuild <command>\".")
- (exit-failure))))
+ (lmain/abort))))
(defn- once
"Compile the ClojureScript project once."
@@ -133,7 +105,7 @@
"Remove automatically generated files."
[project {:keys [crossover-path builds repl-launch-commands test-commands]}]
(println "Deleting files generated by lein-cljsbuild.")
- (fs/delete-dir repl-output-path)
+ (fs/delete-dir (config/in-target-path (:target-path project) repl-output-path))
(fs/delete-dir crossover-path)
(let [raw-commands (concat
(keep identity (map :notify-command builds))
@@ -153,10 +125,8 @@
(defn- test
"Run ClojureScript tests."
[project options args]
- (let [compile-result (run-compiler project options nil false)]
- (if (and (not lein2?) (not= compile-result exit-code-success))
- compile-result
- (run-tests project options args))))
+ (run-compiler project options nil false)
+ (run-tests project options args))
(defn- repl-listen
"Run a REPL that will listen for incoming connections."
@@ -207,7 +177,7 @@
([project]
(println
(lhelp/help-for "cljsbuild"))
- (exit-failure))
+ (lmain/abort))
([project subtask & args]
(let [options (config/extract-options project)]
(case subtask
@@ -222,59 +192,36 @@
(println
"Subtask" (str \" subtask \") "not found."
(lhelp/subtask-help-for *ns* #'cljsbuild))
- (exit-failure))))))
+ (lmain/abort))))))
-; Lein2 "preps" the project when eval-in-project is called. This
+; Lein "preps" the project when eval-in-project is called. This
; causes it to be compiled, which normally would trigger the compile
; hook below, which is bad because we can't compile unless we're in
; the dummy subproject. To solve this problem, we disable all of the
-; hooks if we notice that lein2 is currently prepping.
+; hooks if we notice that lein is currently prepping.
(defmacro skip-if-prepping [task args & forms]
- `(if (subproject/prepping?)
+ `(if false ; FIXME FIXME leval/*prepping?*
(apply ~task ~args)
(do ~@forms)))
-; Supporting both lein1 and lein2 is starting to become VERY PAINFUL.
-(if lein2?
- (do
- (defn compile-hook [task & args]
- (skip-if-prepping task args
- (apply task args)
- (run-compiler (first args) (config/extract-options (first args)) nil false)))
-
- (defn test-hook [task & args]
- (skip-if-prepping task args
- (apply task args)
- (run-tests (first args) (config/extract-options (first args)) [])))
-
- (defn clean-hook [task & args]
- (skip-if-prepping task args
- (apply task args)
- (clean (first args) (config/extract-options (first args)))))
+(defn compile-hook [task & args]
+ (skip-if-prepping task args
+ (apply task args)
+ (run-compiler (first args) (config/extract-options (first args)) nil false)))
- (defn jar-hook [task & [project out-file filespecs]]
- (skip-if-prepping task [project out-file filespecs]
- (apply task [project out-file (concat filespecs (jar/get-filespecs project))]))))
- (do
- (defn compile-hook [task & args]
- (let [compile-result (apply task args)]
- (if (not= compile-result exit-code-success)
- compile-result
- (run-compiler (first args) (config/extract-options (first args)) nil false))))
+(defn test-hook [task & args]
+ (skip-if-prepping task args
+ (apply task args)
+ (run-tests (first args) (config/extract-options (first args)) [])))
- (defn test-hook [task & args]
- (let [test-results [(apply task args)
- (run-tests (first args) (config/extract-options (first args)) [])]]
- (if (every? #(= % exit-code-success) test-results)
- (exit-success)
- (exit-failure))))
+(defn clean-hook [task & args]
+ (skip-if-prepping task args
+ (apply task args)
+ (clean (first args) (config/extract-options (first args)))))
- (defn clean-hook [task & args]
- (apply task args)
- (clean (first args) (config/extract-options (first args))))
-
- (defn jar-hook [task & [project out-file filespecs]]
- (apply task [project out-file (concat filespecs (jar/get-filespecs project))]))))
+(defn jar-hook [task & [project out-file filespecs]]
+ (skip-if-prepping task [project out-file filespecs]
+ (apply task [project out-file (concat filespecs (jar/get-filespecs project))])))
(defn activate
"Set up hooks for the plugin. Eventually, this can be changed to just hook,
@@ -284,7 +231,3 @@
(hooke/add-hook #'ltest/test #'test-hook)
(hooke/add-hook #'lclean/clean #'clean-hook)
(hooke/add-hook #'ljar/write-jar #'jar-hook))
-
-; Lein1 hooks have to be called manually, in lein2 the activate function will
-; be automatically called.
-(when-not lein2? (activate))
View
43 plugin/src/leiningen/cljsbuild/config.clj
@@ -3,34 +3,39 @@
(:require
[clojure.pprint :as pprint]))
-(def compiler-output-dir-base ".lein-cljsbuild-compiler-")
+(defn in-target-path [target-path subpath]
+ (str target-path "/cljsbuild-" subpath))
+
+(defn- compiler-output-dir-base [target-path]
+ (in-target-path target-path "compiler-"))
+
(def compiler-global-dirs
{:libs "closure-js/libs"
:externs "closure-js/externs"})
-(def default-global-options
+(defn- default-global-options [target-path]
{:repl-launch-commands {}
:repl-listen-port 9000
:test-commands {}
- :crossover-path ".crossover-cljs"
+ :crossover-path (in-target-path target-path "crossover")
:crossover-jar false
:crossovers []})
-(def default-compiler-options
- {:output-to "main.js"
+(defn- default-compiler-options [target-path]
+ {:output-to (in-target-path target-path "main.js")
:optimizations :whitespace
:warnings true
:externs []
:libs []
:pretty-print true})
-(def default-build-options
+(defn- default-build-options [target-path]
{:source-path "src-cljs"
:jar false
:notify-command nil
:incremental true
:assert true
- :compiler default-compiler-options})
+ :compiler (default-compiler-options target-path)})
(defn convert-builds-map [options]
(update-in options [:builds]
@@ -95,27 +100,27 @@
(deep-merge a b)
b))
-(defn- set-default-build-options [options]
- (deep-merge default-build-options options))
+(defn- set-default-build-options [target-path options]
+ (deep-merge (default-build-options target-path) options))
-(defn- set-default-output-dirs [options]
+(defn- set-default-output-dirs [target-path options]
(let [output-dir-key [:compiler :output-dir]
builds
(for [[build counter] (map vector (:builds options) (range))]
(if (get-in build output-dir-key)
build
(assoc-in build output-dir-key
- (str compiler-output-dir-base counter))))]
+ (str (compiler-output-dir-base target-path) counter))))]
(if (or (empty? builds)
(apply distinct? (map #(get-in % output-dir-key) builds)))
(assoc options :builds builds)
(throw (Exception. (str "All " output-dir-key " options must be distinct."))))))
-(defn set-default-options [options]
- (set-default-output-dirs
- (deep-merge default-global-options
+(defn set-default-options [target-path options]
+ (set-default-output-dirs target-path
+ (deep-merge (default-global-options target-path)
(assoc options :builds
- (map set-default-build-options (:builds options))))))
+ (map #(set-default-build-options target-path %) (:builds options))))))
(defn set-build-global-dirs [build]
(reduce (fn [build [k v]] (update-in build [:compiler k] conj v))
@@ -128,13 +133,13 @@
(defn- normalize-options
"Sets default options and accounts for backwards compatibility."
- [options]
+ [target-path options]
(let [options (convert-builds-map options)
compat (backwards-compat options)]
(when (not= options compat)
(warn-deprecated compat))
- (-> compat
- set-default-options
+ (->> compat
+ (set-default-options target-path)
set-compiler-global-dirs)))
(defn parse-shell-command [raw]
@@ -163,4 +168,4 @@
(when (nil? (:cljsbuild project))
(println "WARNING: no :cljsbuild entry found in project definition."))
(let [raw-options (:cljsbuild project)]
- (normalize-options raw-options)))
+ (normalize-options (:target-path project) raw-options)))
View
62 plugin/src/leiningen/cljsbuild/subproject.clj
@@ -42,57 +42,15 @@
(merge cljsbuild project))))
(defn make-subproject [project crossover-path builds]
- {:local-repo-classpath true
- :dependencies (merge-dependencies (:dependencies project))
- :dev-dependencies (:dev-dependencies project)
- :repositories (:repositories project)})
-
-(defn make-subproject-lein1 [project crossover-path builds]
- (merge (make-subproject project crossover-path builds)
- {:source-path (:source-path project)
- :resources-path (:resources-path project)
- :extra-classpath-dirs (concat
- (:extra-classpath-dirs project)
- (map :source-path builds)
- [crossover-path])}))
-
-(defn make-subproject-lein2 [project crossover-path builds]
(with-meta
- (merge (make-subproject project crossover-path builds)
- {:source-paths (concat
- (:source-paths project)
- (map :source-path builds)
- [crossover-path])
- :resource-paths (:resource-paths project)
- :checkout-deps-shares (:checkout-deps-shares project)
- :eval-in (:eval-in project)})
+ {:local-repo-classpath true
+ :dependencies (merge-dependencies (:dependencies project))
+ :repositories (:repositories project)
+ :source-paths (concat
+ (:source-paths project)
+ (map :source-path builds)
+ [crossover-path])
+ :resource-paths (:resource-paths project)
+ :checkout-deps-shares (:checkout-deps-shares project)
+ :eval-in (:eval-in project)}
(meta project)))
-
-(defn eval-in-project
- "Support eval-in-project in both Leiningen 1.x and 2.x."
- [project crossover-path builds form requires]
- (let [[eip args]
- (or (try (require 'leiningen.core.eval)
- [(resolve 'leiningen.core.eval/eval-in-project)
- [(make-subproject-lein2 project crossover-path builds)
- form
- requires]]
- (catch java.io.FileNotFoundException _))
- (try (require 'leiningen.compile)
- [(resolve 'leiningen.compile/eval-in-project)
- [(make-subproject-lein1 project crossover-path builds)
- form
- nil
- nil
- requires]]
- (catch java.io.FileNotFoundException _)))]
- (apply eip args)))
-
-(defn prepping? []
- (try
- (require 'leiningen.core.eval)
- (if-let [prepping-var (resolve 'leiningen.core.eval/*prepping?*)]
- (deref prepping-var)
- false)
- (catch java.io.FileNotFoundException _
- false)))
View
147 plugin/test/leiningen/test/cljsbuild.clj
@@ -6,45 +6,15 @@
[leiningen.trampoline :as ltrampoline]
[leiningen.cljsbuild.config :as config]
[leiningen.cljsbuild.jar :as jar]
- [leiningen.cljsbuild.subproject :as subproject]))
-
-; This crazy in-ns business is to mock out the namespaces that would normally
-; be required by eval-in-project. It would be preferable to just :require them,
-; but they require Clojure 1.3 and we're running in Leningen 1 which uses 1.2.
-; TODO: Once Leiningen 2 is released, get rid of this.
-
-(in-ns 'cljsbuild.crossover)
-(clojure.core/use 'midje.sweet)
-(unfinished copy-crossovers)
-(unfinished crossover-macro-paths)
-
-(in-ns 'cljsbuild.util)
-(clojure.core/use 'midje.sweet)
-(unfinished once-every-bg)
-(unfinished in-threads)
-
-(in-ns 'cljsbuild.compiler)
-(clojure.core/use 'midje.sweet)
-(unfinished run-compiler)
-
-(in-ns 'cljsbuild.clean)
-(clojure.core/use 'midje.sweet)
-(unfinished cleanup-files)
-
-(in-ns 'cljsbuild.test)
-(clojure.core/use 'midje.sweet)
-(unfinished run-tests)
-
-(in-ns 'cljsbuild.repl.listen)
-(clojure.core/use 'midje.sweet)
-(unfinished run-repl-listen)
-(unfinished run-repl-launch)
-
-(in-ns 'cljsbuild.repl.rhino)
-(clojure.core/use 'midje.sweet)
-(unfinished run-repl-rhino)
-
-(in-ns 'leiningen.test.cljsbuild)
+ [leiningen.cljsbuild.subproject :as subproject]
+ [leiningen.core.eval :as leval]
+ cljsbuild.crossover
+ cljsbuild.util
+ cljsbuild.compiler
+ cljsbuild.clean
+ cljsbuild.test
+ cljsbuild.repl.listen
+ cljsbuild.repl.rhino))
(def repl-listen-port 10000)
(def repl-launch-command-id "launch-id")
@@ -86,7 +56,7 @@
(:compiler (first parsed-builds)))
(def project
- {:dependencies [['org.clojure/clojure "1.3.0"]]
+ {:dependencies [['org.clojure/clojure "1.4.0"]]
:cljsbuild
{:repl-listen-port repl-listen-port
:repl-launch-commands {repl-launch-command-id repl-launch-command}
@@ -97,38 +67,35 @@
:builds builds}})
(defn hook-success [& args]
- 0)
+ nil)
(defn hook-failure [& args]
- 1)
+ (throw (Exception. "Dummy hook failed.")))
-(defn eval-locally [_ _ _ body _]
+(defn eval-locally [_ body _]
(eval body))
-(defmacro with-compiler-bindings [& forms]
- `(binding [subproject/eval-in-project eval-locally
- cljsbuild.util/in-threads (fn [f# s#] (doseq [i# s#] (f# i#)))
- cljsbuild.util/once-every-bg (fn [_# _# _#] nil)]
+(defmacro with-mocks [& forms]
+ `(with-redefs [leval/eval-in-project eval-locally
+ cljsbuild.util/once-every-bg (fn [_# _# _#] nil)]
~@forms))
(fact "fail when no arguments present"
- (cljsbuild project) => 1)
+ (cljsbuild project) => (throws Exception))
(fact "once/auto call eval-in-project with the right args"
(doseq [command ["once" "auto"]]
- (cljsbuild project command) => 0
+ (cljsbuild project command) => nil
(provided
- (subproject/eval-in-project
- project
- crossover-path
- parsed-builds
+ (leval/eval-in-project
+ (subproject/make-subproject project crossover-path parsed-builds)
anything
- anything) => 0 :times 1)) )
+ anything) => nil :times 1)) )
(fact "once task calls the compiler correctly"
(doseq [extra-args [[] [build-id]]]
- (with-compiler-bindings
- (apply cljsbuild project "once" extra-args)) => 0
+ (with-mocks
+ (apply cljsbuild project "once" extra-args)) => nil
(provided
(cljsbuild.crossover/crossover-macro-paths
crossovers) => crossover-macros :times 1
@@ -146,22 +113,22 @@
{}) => nil :times 1)))
(fact "bad build IDs are detected"
- (with-compiler-bindings
+ (with-mocks
(cljsbuild project "once" "wrong-build-id")) => (throws Exception))
(fact "clean calls cleanup-files"
- (with-compiler-bindings
- (cljsbuild project "clean")) => 0
- (with-compiler-bindings
- (clean-hook hook-success project)) => 0
- (with-compiler-bindings
- (clean-hook hook-failure project)) => 0
+ (with-mocks
+ (cljsbuild project "clean")) => nil
+ (with-mocks
+ (clean-hook hook-success project)) => nil
+ (with-mocks
+ (clean-hook hook-failure project)) => (throws Exception)
(against-background
(cljsbuild.clean/cleanup-files parsed-compiler) => nil :times 1))
(fact "compile-hook calls through to the compiler when task succeeds"
- (with-compiler-bindings
- (compile-hook hook-success project)) => 0
+ (with-mocks
+ (compile-hook hook-success project)) => nil
(provided
(cljsbuild.crossover/crossover-macro-paths
crossovers) => crossover-macros :times 1
@@ -179,8 +146,8 @@
{}) => nil :times 1))
(fact "compile-hook does not call through to the compiler when task fails"
- (with-compiler-bindings
- (compile-hook hook-failure project)) => 1
+ (with-mocks
+ (compile-hook hook-failure project)) => (throws Exception)
(provided
(cljsbuild.crossover/crossover-macro-paths
anything) => nil :times 0
@@ -201,14 +168,14 @@
; like being directly inside a let.
(let [parsed-commands [(config/parse-shell-command test-command)]]
(fact "tests work correctly"
- (with-compiler-bindings
- (cljsbuild project "test")) => 0
- (with-compiler-bindings
- (cljsbuild project "test" test-command-id)) => 0
- (with-compiler-bindings
- (test-hook hook-success project)) => 0
- (with-compiler-bindings
- (test-hook hook-failure project)) => 1
+ (with-mocks
+ (cljsbuild project "test")) => nil
+ (with-mocks
+ (cljsbuild project "test" test-command-id)) => nil
+ (with-mocks
+ (test-hook hook-success project)) => nil
+ (with-mocks
+ (test-hook hook-failure project)) => (throws Exception)
(against-background
(cljsbuild.crossover/crossover-macro-paths
crossovers) => crossover-macros :times 0
@@ -224,31 +191,31 @@
incremental?
assert?
{}) => nil :times 1
- (cljsbuild.test/run-tests parsed-commands) => 0 :times 1)))
+ (cljsbuild.test/run-tests parsed-commands) => nil :times 1)))
-(defmacro with-repl-bindings [& forms]
- `(binding [subproject/eval-in-project eval-locally
- ltrampoline/*trampoline?* true]
- ~@forms))
+(defmacro with-repl-env [& forms]
+ `(with-mocks
+ (binding [ltrampoline/*trampoline?* true]
+ ~@forms)))
(fact "repl-listen calls run-repl-listen"
- (with-repl-bindings
- (cljsbuild project "repl-listen")) => 0
+ (with-repl-env
+ (cljsbuild project "repl-listen")) => nil
(provided
(cljsbuild.repl.listen/run-repl-listen repl-listen-port anything) => nil :times 1))
(fact "repl-launch with no ID fails"
- (with-repl-bindings
+ (with-repl-env
(cljsbuild project "repl-launch")) => (throws Exception))
(fact "repl-launch with bad ID fails"
- (with-repl-bindings
+ (with-repl-env
(cljsbuild project "repl-launch" "wrong-repl-launch-id")) => (throws Exception))
(fact "repl-launch calls run-repl-launch"
(let [parsed-command (config/parse-shell-command repl-launch-command)]
- (with-repl-bindings
- (cljsbuild project "repl-launch" repl-launch-command-id)) => 0
+ (with-repl-env
+ (cljsbuild project "repl-launch" repl-launch-command-id)) => nil
(provided
(cljsbuild.repl.listen/run-repl-launch
repl-listen-port
@@ -256,8 +223,8 @@
parsed-command) => nil :times 1)))
(fact "repl-rhino calls run-repl-rhino"
- (with-repl-bindings
- (cljsbuild project "repl-rhino")) => 0
+ (with-repl-env
+ (cljsbuild project "repl-rhino")) => nil
(provided
(cljsbuild.repl.rhino/run-repl-rhino) => nil :times 1))
@@ -268,7 +235,7 @@
input-filespecs [{:type :bytes :path "/i/j" :bytes "fake-1"}]
project-filespecs [{:type :bytes :path "/a/b" :bytes "fake-2"}]
all-filespecs (concat input-filespecs project-filespecs)]
- (jar-hook jar-task project out-file input-filespecs) => 0
+ (jar-hook jar-task project out-file input-filespecs) => nil
(provided
- (jar-task project out-file all-filespecs) => 0
+ (jar-task project out-file all-filespecs) => nil
(jar/get-filespecs project) => project-filespecs)))
View
10 plugin/test/leiningen/test/cljsbuild/config.clj
@@ -25,6 +25,8 @@
(parse-shell-command ["a"]) => {:shell ["a"]}
(parse-shell-command ["a" "b" "c" :x 1 :y 2]) => {:shell ["a" "b" "c"] :x 1 :y 2})
+(def target-path "target")
+
(def config-in
{:repl-launch-commands {:a ["a"]}
:repl-listen-port 10000
@@ -48,17 +50,17 @@
:pretty-print false}})})
(fact "custom settings are not overwritten by defaults"
- (set-default-options config-in) => config-in)
+ (set-default-options target-path config-in) => config-in)
(fact "missing settings have defaults provided"
(doseq [option (keys config-in)]
- (set-default-options (dissoc config-in option)) => (contains {option anything})))
+ (set-default-options target-path (dissoc config-in option)) => (contains {option anything})))
(defn- get-build [config]
(first (:builds config)))
(defn- default-build-option [config build option]
- (set-default-options
+ (set-default-options target-path
(assoc config :builds
(list (dissoc build option)))))
@@ -72,7 +74,7 @@
(:compiler (get-build config)))
(defn- default-compiler-option [config compiler option]
- (set-default-options
+ (set-default-options target-path
(assoc config :builds
(list
(assoc compiler :compiler
View
42 plugin/test/leiningen/test/cljsbuild/subproject.clj
@@ -26,48 +26,28 @@
(def lein-extra-classpath-dirs ["a" "b"])
(def lein-dependencies [clojure-dependency ['a "1"]])
(def expected-dependencies (conj lein-dependencies ['cljsbuild cljsbuild-version]))
-(def lein-dev-dependencies [['b "2"]])
(def lein-repositories ["repository"])
(def lein-builds [{:source-path lein-build-path}])
-(def lein1-project
- {:dependencies lein-dependencies
- :dev-dependencies lein-dev-dependencies
- :source-path lein-source-path
- :extra-classpath-dirs lein-extra-classpath-dirs
- :repositories lein-repositories})
-
-(fact
- (let [subproject (make-subproject-lein1 lein1-project lein-crossover lein-builds)]
- (doseq [dir (concat lein-extra-classpath-dirs [lein-build-path lein-crossover])]
- (:extra-classpath-dirs subproject) => (contains dir))
- (:source-path subproject) => lein-source-path
- (:local-repo-classpath subproject) => truthy
- (:dev-dependencies subproject) => lein-dev-dependencies
- (:repositories subproject) => lein-repositories
- (:dependencies subproject) => (in-any-order expected-dependencies)))
-
-(def lein2-metadata {:test-metadata "testing 1 2 3"})
-(def lein2-eval-in :trampoline)
-(def lein2-resource-paths "resources")
-(def lein2-project
+(def lein-metadata {:test-metadata "testing 1 2 3"})
+(def lein-eval-in :trampoline)
+(def lein-resource-paths "resources")
+(def lein-project
(with-meta
{:dependencies lein-dependencies
- :dev-dependencies lein-dev-dependencies
:source-paths (concat [lein-source-path] lein-extra-classpath-dirs)
:repositories lein-repositories
- :eval-in lein2-eval-in
- :resource-paths lein2-resource-paths}
- lein2-metadata))
+ :eval-in lein-eval-in
+ :resource-paths lein-resource-paths}
+ lein-metadata))
(fact
- (let [subproject (make-subproject-lein2 lein2-project lein-crossover lein-builds)]
- (meta subproject) => lein2-metadata
+ (let [subproject (make-subproject lein-project lein-crossover lein-builds)]
+ (meta subproject) => lein-metadata
(doseq [dir (concat lein-extra-classpath-dirs [lein-source-path lein-build-path lein-crossover])]
(:source-paths subproject) => (contains dir))
(:local-repo-classpath subproject)
- (:dev-dependencies subproject) => lein-dev-dependencies
(:repositories subproject) => lein-repositories
- (:eval-in subproject) => lein2-eval-in
- (:resource-paths subproject) => lein2-resource-paths
+ (:eval-in subproject) => lein-eval-in
+ (:resource-paths subproject) => lein-resource-paths
(:dependencies subproject) => (in-any-order expected-dependencies)))
View
6 sample.project.clj
@@ -50,7 +50,7 @@
; doc/CROSSOVERS.md for more details. Defaults to the empty vector [].
:crossovers [example.crossover]
; The directory into which the :crossovers namespaces should be copied.
- ; Defaults to ".crossover-cljs".
+ ; Defaults to "/target/cljsbuild-crossover".
:crossover-path ".crossover-cljs"
; If hooks are enabled, this flag determines whether files from :crossover-path
; are added to the JAR file created by "lein jar".
@@ -84,7 +84,7 @@
; The :compiler options are passed directly to the ClojureScript compiler.
:compiler {
; The path to the JavaScript file that will be output.
- ; Defaults to "main.js".
+ ; Defaults to "target/cljsbuild-main.js".
:output-to "resources/public/js/main.js"
; This flag will turn on compiler warnings for references to
; undeclared vars, wrong function call arities, etc. Defaults to true.
@@ -101,7 +101,7 @@
:print-input-delimiter false
; Sets the output directory for temporary files used during
; compilation. Must be unique among all :builds. Defaults to
- ; ".lein-cljsbuild-compiler-X" (where X is a unique integer).
+ ; "target/cljsbuild-compiler-X" (where X is a unique integer).
:output-dir ".clojurescript-output"
; Configure externs files for external libraries.
; Defaults to the empty vector [].
View
30 support/project.clj
@@ -1,17 +1,19 @@
(defproject cljsbuild "0.3.0"
:description "ClojureScript Autobuilder"
:url "http://github.com/emezeske/lein-cljsbuild"
- :license {:name "Eclipse Public License - v 1.0"
- :url "http://www.eclipse.org/legal/epl-v10.html"
- :distribution :repo}
- :dependencies [[org.clojure/clojure "1.4.0"]
- [org.clojure/clojurescript "0.0-1552"
- :exclusions [org.apache.ant/ant]]
- ; Ugly workaround for http://dev.clojure.org/jira/browse/CLJS-418
- [org.clojure/google-closure-library-third-party "0.0-2029"]
- [fs "1.1.2"]
- [clj-stacktrace "0.2.5"]]
- :dev-dependencies [[midje "1.4.0"]
- ; NOTE: lein-midje requires different versions to be
- ; installed for lein1 vs lein2 compatibility :(.
- [lein-midje "1.0.10"]])
+ :license
+ {:name "Eclipse Public License - v 1.0"
+ :url "http://www.eclipse.org/legal/epl-v10.html"
+ :distribution :repo}
+ :dependencies
+ [[org.clojure/clojure "1.4.0"]
+ [org.clojure/clojurescript "0.0-1552"
+ :exclusions [org.apache.ant/ant]]
+ ; Ugly workaround for http://dev.clojure.org/jira/browse/CLJS-418
+ [org.clojure/google-closure-library-third-party "0.0-2029"]
+ [fs "1.1.2"]
+ [clj-stacktrace "0.2.5"]]
+ :profiles {
+ :dev {
+ :dependencies [[midje "1.4.0"]]
+ :plugins [[lein-midje "2.0.4"]]}})
Please sign in to comment.
Something went wrong with that request. Please try again.