Permalink
Browse files

Sort JavaScript files in dependency order once, just before advanced …

…compilation
  • Loading branch information...
1 parent e615f4c commit 2e5eee630b353df791c8fb6ced40d99fb9536bb5 @brentonashworth brentonashworth committed Mar 30, 2012
Showing with 14 additions and 14 deletions.
  1. +14 −14 src/clj/cljs/closure.clj
@@ -347,12 +347,11 @@
(defn compile-dir
"Recursively compile all cljs files under the given source
- directory. Return a list of JavaScriptFiles in dependency order."
+ directory. Return a list of JavaScriptFiles."
[^File src-dir opts]
(let [out-dir (output-directory opts)]
- (dependency-order
- (map compiled-file
- (comp/compile-root src-dir out-dir)))))
+ (map compiled-file
+ (comp/compile-root src-dir out-dir))))
(defn path-from-jarfile
"Given the URL of a file within a jar, return the path of the file
@@ -514,8 +513,8 @@
(defn js-dependencies
"Given a sequence of Closure namespace strings, return the list of
- all dependencies in dependency order. The returned list includes all
- Google and third-party library dependencies.
+ all dependencies. The returned list includes all Google and
+ third-party library dependencies.
Third-party libraries are configured using the :libs option where
the value is a list of directories containing third-party
@@ -531,7 +530,7 @@
(recur (into (rest requires) new-req)
(into visited new-req)
(conj deps node)))
- (cons (get index "goog/base.js") (dependency-order deps))))))
+ (remove nil? deps)))))
(comment
;; find dependencies
@@ -549,11 +548,10 @@
(defn cljs-dependencies
"Given a list of all required namespaces, return a list of
- IJavaScripts which are the cljs dependencies in dependency
- order. The returned list will not only include the explicitly
- required files but any transitive depedencies as well. JavaScript
- files will be compiled to the working directory if they do not
- already exist.
+ IJavaScripts which are the cljs dependencies. The returned list will
+ not only include the explicitly required files but any transitive
+ depedencies as well. JavaScript files will be compiled to the
+ working directory if they do not already exist.
Only load dependencies from the classpath."
[opts requires]
@@ -574,7 +572,7 @@
(recur (into (rest required-files) new-req)
(into visited new-req)
(conj js-deps js)))
- (dependency-order js-deps))))))
+ (remove nil? js-deps))))))
(comment
;; only get cljs deps
@@ -863,7 +861,9 @@
[(-compile (io/resource "cljs/nodejscli.cljs") all-opts)]))
js-sources (if (coll? compiled)
(apply add-dependencies all-opts compiled)
- (add-dependencies all-opts compiled))]
+ (add-dependencies all-opts compiled))
+ js-sources (cons (javascript-file nil (io/resource "goog/base.js") ["goog"] nil)
+ (dependency-order js-sources))]
(if (:optimizations all-opts)
(->> js-sources
(apply optimize all-opts)

0 comments on commit 2e5eee6

Please sign in to comment.