Exclude cljs source file from compilation
Description
Environment
every environment
Attachments
- 07 Dec 2012, 04:30 PM
Activity
David Nolen December 18, 2012 at 9:09 PM
Should be resolved by tools that use the compiler.
Giacomo Cosenza December 10, 2012 at 10:37 AM
Hi all,
just a small add on to the previous comment. I don't think we're going to update cljsc/cljsc.clj, which I consider a kind of tool, much more fragile and limited than cljsbuild plugin, to interoperate with CLJS compiler.
My best
Mimmo
Giacomo Cosenza December 10, 2012 at 10:20 AM
Hi all,
we all agree with Brenton and yes, the :exclude option has to be at the same hierarchical level of :source-path. I'll verify if we can also extend :source-path from taking a String to taking a vector of String, in such a way that the user could ask to compile more cljs src-dir.
Mimmo
Former user December 10, 2012 at 3:48 AM
FWIW, I agree with Brenton that this should be in lein-cljsbuild.
I didn't know that cljs.closure/build was flexible enough to do this already. I always thought that it needed to be extended so that a vector of files could be passed in, or something, but it sounds like the Compilable approach should work just fine.
I will happily accept a patch for this. One thing to keep in mind, though, is that the :exclude entry should not be in the :compiler map if lein-cljsbuild is handling it. The :compiler map is passed straight through as options to cljs.closure/build. So, the :exclude entry should be a neighbor of the :compiler entry.
David Nolen December 7, 2012 at 11:40 PM
I agree that anything that can be solved at higher level tools is better - it wasn't clear to me from the implementation that Compilable could be used to control this - but I see now.
Mimmo, cljs.closure/build takes a Compilable and a map of options. So lein-cljsbuild could construct the custom Compilable that understands :excludes and pass it along.
Details
Assignee
UnassignedUnassignedReporter
Giacomo CosenzaGiacomo CosenzaPriority
Major
Details
Details
Assignee
Reporter
Priority

Scenario:
you have a :dev build and a
rod build
In the :dev build you want to have a brepl connected with the browser and you coded that connection in a isolated cljs source file.
In the
rod build you do not want that connection active, meaning you don't want source cljs file enabling the connection to be included in the compilation.
Given this scenario, you need to duplicate all the cljs source files but the one that enable the connection. This mean you have to manually maintain two code bases.
It could be useful to have a way to :exclude some files from :source-path.