Some mechanism for setting *assert* per build configuration #132

gfredericks opened this Issue Sep 2, 2012 · 3 comments


None yet

2 participants


Is there a way to do this already? Maybe at least with robert-hooke? If the best option is to add a feature to lein-cljsbuild, it should probably be more general than just *assert*. E.g., work for any dynamic var, including user-defined vars.

emezeske commented Sep 5, 2012

Unfortunately, I can't think of any decent way to do this, even with robert.hooke. The compiler runs in a subproject (via eval-in-project) and thus I don't think any hooks set up in the Leiningen process itself would be executed.

I think to solve this problem in the general case it's worth starting a conversation about whether dynamic vars should ever be used to configure the compiler. It seems like all it does is make it harder to configure things -- even without lein-cljsbuild, the cljsc command can't even change the settings that are in dynamic vars. I think the best approach would be to always make things configurable via the compiler options map.

I don't know enough about lein plugins and the cljs compiler to really understand the issues here. eval-in-project involves evaling a form, right? Why can't the form be wrapped in (binding [*my-var* some-value] ...)?

emezeske commented Sep 7, 2012

Okay, I was confused about the *assert* Var before. I thought it was one of the options that the ClojureScript compiler exposed as a dynamic Var for controlling compilation, but it's actually just the regular old clojure.core/*assert* that it's looking at. That changes my opinion a little bit, such that I'm in favor of supporting it in lein-cljsbuild.

Your description is pretty much the long and short of it. The binding form would end up in the cljsbuild support JAR that lein-cljsbuild depends on for its internal functionality. I guess we'd add a :assert option to the :build map, and pass that down to determine the value for *assert*.

I'll add this in the next release.

@emezeske emezeske closed this in de61666 Oct 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment