Navigation Menu

Skip to content

Commit

Permalink
Add an option to include crossover CLJS in JARs.
Browse files Browse the repository at this point in the history
  • Loading branch information
emezeske committed Feb 20, 2012
1 parent 201ab27 commit 22feed4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
1 change: 1 addition & 0 deletions example-projects/advanced/project.clj
Expand Up @@ -30,6 +30,7 @@
; development/debugging, and one with many optimizations for
; production use.
:crossovers [example.crossover]
:crossover-jar true
:builds [
{:source-path "src-cljs"
:jar true
Expand Down
16 changes: 9 additions & 7 deletions plugin/src/leiningen/cljsbuild.clj
Expand Up @@ -15,26 +15,24 @@
'[[cljsbuild "0.1.0"]])

(def repl-output-path ".lein-cljsbuild-repl")
(def crossover-path ".lein-cljsbuild-crossover")
(def compiler-output-dir-base ".lein-cljsbuild-compiler-")

(def default-global-options
{:repl-launch-commands {}
:repl-listen-port 9000
:test-commands {}
:crossover-path "crossover-cljs"
:crossover-jar false
:crossovers []})

; TODO Add a :crossover-jar boolean option?
; TODO Write a "migrating from 0.0.x to 0.1.x" doc... :(

(def default-compiler-options
{:output-to "main.js"
:optimizations :whitespace
:pretty-print true})

(def default-build-options
{:source-path "src-cljs"
:jar false
:compiler default-compiler-options})

(def exit-success 0)
Expand Down Expand Up @@ -122,7 +120,7 @@
(:compiler opts#)))
'~builds)))

(defn- run-tests [project {:keys [test-commands builds]} args]
(defn- run-tests [project {:keys [test-commands crossover-path builds]} args]
(when (> (count args) 1)
(throw (Exception. "Only expected zero or one arguments.")))
(let [selected-tests (if (empty? args)
Expand Down Expand Up @@ -285,8 +283,12 @@ Available commands:
(defn- get-filespecs
"Returns a seq of filespecs for cljs dirs (as passed to leiningen.jar/write-jar)"
[project]
(let [builds (extract-options project)
paths (map :source-path (filter :jar builds))]
(let [options (extract-options project)
builds (:builds options)
build-paths (map :source-path (filter :jar builds))
paths (if (:crossover-jar options)
(conj build-paths (:crossover-path options))
build-paths)]
(mapcat path-filespecs paths)))

(defn compile-hook [task & args]
Expand Down
5 changes: 3 additions & 2 deletions sample.project.clj
Expand Up @@ -44,8 +44,9 @@
; "Sharing Code Between Clojure and Clojurescript" section for more details.
; Defaults to the empty vector [].
:crossovers [example.crossover]
; TODO: Document :crossovers-jar once that's added.
; :crossovers-jar true
; TODO: Document :crossover-jar once that's added.
; :crossover-jar true
; :crossover-path true
; The :builds option should be set to a sequence of maps. Each
; map will be treated as a separate, independent, ClojureScript
; compiler configuration
Expand Down

0 comments on commit 22feed4

Please sign in to comment.