Double cljs generation if hooks are enabled for both cljsbuild and cljx
magomimmo opened this issue · comments
Here is a test repository where I enabled :hooks
for both cljsbuild
and cljx
:
git clone https://github.com/magomimmo/modern-cljs.git
cd modern-cljs
git checkout double
$ lein do clean, compile, test
Deleting files generated by lein-cljsbuild.
Rewriting test/cljx to target/test/clj (clj) with features #{clj} and 0 transformations.
Rewriting test/cljx to target/test/cljs (cljs) with features #{cljs} and 1 transformations.
Compiling ClojureScript.
Compiling "resources/public/js/modern_pre.js" from ["src/brepl" "src/cljs"]...
...
...
Successfully compiled "target/test/js/testable.js" in 7.192822 seconds.
Rewriting test/cljx to target/test/clj (clj) with features #{clj} and 0 transformations.
Rewriting test/cljx to target/test/cljs (cljs) with features #{cljs} and 1 transformations.
Compiling ClojureScript.
Compiling "target/test/js/testable_dbg.js" from ["src/brepl" "src/cljs" "target/test/cljs"]...
...
...
Successfully compiled "target/test/js/testable.js" in 6.853873 seconds.
lein test modern-cljs.shopping.validators-test
Ran 1 tests containing 13 assertions.
0 failures, 0 errors.
Running all ClojureScript tests.
Testing modern-cljs.shopping.validators-test
Ran 1 tests containing 13 assertions.
....
{:test 1, :pass 13, :fail 0, :error 0, :type :summary}
$
I don-t know if this behavior pertains cljx
, cljsbuild
or even `lein.
I tested with a cljx build containing the fix for #19 and only see a single generation.
Could you give it a try?
Noted, thanks. I'll try to verify and apply that patch this coming week.
gh-19 is now available in 0.3.1-SNAPSHOT
on Clojars. @magomimmo, can you try that and see if this is resolved (should be, there's a promise in there now).
Hi Chas, unfortunately it does not resolve the problem.
I prepared the following repo
https://github.com/magomimmo/modern-cljs/tree/hooks
and by issuing the the usual lein
command I obtain a double cljx
generation in the compilation task and a cljx re-generation, then a cljs recompilation even if I already compiled everything and I issue only the lein test
command.
lein do clean, compile
Deleting files generated by lein-cljsbuild.
Rewriting test/cljx to target/test/clj (clj) with features #{clj} and 0 transformations.
Rewriting test/cljx to target/test/cljs (cljs) with features #{cljs} and 1 transformations.
Rewriting test/cljx to target/test/clj (clj) with features #{clj} and 0 transformations.
Rewriting test/cljx to target/test/cljs (cljs) with features #{cljs} and 1 transformations.
Compiling ClojureScript.
...
Successfully compiled "resources/public/js/modern.js" in 6.560236 seconds.
If I now run the lein test
task only
# after having already issued the `lein compile` task
lein test
Rewriting test/cljx to target/test/clj (clj) with features #{clj} and 0 transformations.
Rewriting test/cljx to target/test/cljs (cljs) with features #{cljs} and 1 transformations.
Rewriting test/cljx to target/test/clj (clj) with features #{clj} and 0 transformations.
Rewriting test/cljx to target/test/cljs (cljs) with features #{cljs} and 1 transformations.
Compiling ClojureScript.
Compiling "target/test/js/testable.js" from ["src/cljs" "target/test/cljs"]...
...
Successfully compiled "target/test/js/testable_dbg.js" in 1.909651 seconds.
lein test modern-cljs.shopping.validators-test
Ran 1 tests containing 13 assertions.
0 failures, 0 errors.
Running all ClojureScript tests.
Testing modern-cljs.shopping.validators-test
...
{:test 1, :pass 13, :fail 0, :error 0, :type :summary}
If I do the same thing in the master repo (https://github.com/magomimmo/modern-cljs/tree/master) without hooking both cljx and cljsbuild, everything works as expected.
lein do clean, cljx once, compile
Deleting files generated by lein-cljsbuild.
Rewriting test/cljx to target/test/clj (clj) with features #{clj} and 0 transformations.
Rewriting test/cljx to target/test/cljs (cljs) with features #{cljs} and 1 transformations.
Compiling ClojureScript.
...
Successfully compiled "resources/public/js/modern.js" in 6.601562 seconds.
lein test
Compiling ClojureScript.
lein test modern-cljs.shopping.validators-test
Ran 1 tests containing 13 assertions.
0 failures, 0 errors.
Running all ClojureScript tests.
Testing modern-cljs.shopping.validators-test
...
{:test 1, :pass 13, :fail 0, :error 0, :type :summary}
I'll have to dig into this after some travelling next week. It may be time to drop the hooks entirely and use :prep-tasks
per technomancy's suggestion elsewhere.
Don't worry Chas. It's not a big deal. I just never hook clix. I'll search for the :prep-task setting….
Thanks