Skip to content

Commit 6d4ada4

Browse files
bensudnolen
authored and
dnolen
committed
CLJS-1469 :modules regression
The sortInputsByDeps method now depends on the Google CompilerOptions which need to be set before calling the method. A test to check for similar regressions was added.
1 parent d2fbb13 commit 6d4ada4

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/main/clojure/cljs/closure.clj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,7 @@
965965
(let [closure-compiler (make-closure-compiler)
966966
^List externs (load-externs opts)
967967
compiler-options (make-options opts)
968+
_ (.initOptions closure-compiler compiler-options)
968969
sources (if (= :whitespace (:optimizations opts))
969970
(cons "var CLOSURE_NO_DEPS = true;" sources)
970971
sources)

src/test/clojure/cljs/build_api_tests.clj

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
(:refer-clojure :exclude [compile])
33
(:use cljs.build.api)
44
(:use clojure.test)
5-
(:require [cljs.env :as env]
5+
(:import java.io.File)
6+
(:require [clojure.java.io :as io]
7+
[cljs.env :as env]
68
[cljs.analyzer :as ana]))
79

810
(deftest test-target-file-for-cljs-ns
@@ -114,3 +116,20 @@
114116
'(graph.bar.core graph.baz.core)))
115117
(is (= (cljs-ns-dependents test-cenv 'graph.foo.core)
116118
'(graph.bar.core graph.baz.core))))
119+
120+
(deftest cljs-1469
121+
(let [srcs "samples/hello/src"
122+
[common-tmp app-tmp] (mapv #(File/createTempFile % ".js")
123+
["common" "app"])
124+
opts {:optimizations :simple
125+
:modules {:common {:entries #{"hello.foo.bar"}
126+
:output-to (.getAbsolutePath common-tmp)}
127+
:app {:entries #{"hello.core"}
128+
:output-to (.getAbsolutePath app-tmp)}}}]
129+
(.deleteOnExit common-tmp)
130+
(.deleteOnExit app-tmp)
131+
(is (every? #(zero? (.length %)) [common-tmp app-tmp])
132+
"The initial files are empty")
133+
(build srcs opts)
134+
(is (not (every? #(zero? (.length %)) [common-tmp app-tmp]))
135+
"The files are not empty after compilation")))

0 commit comments

Comments
 (0)