Support for passing "--define" option to compiler.jar #21

RafalBabinicz opened this Issue Jan 23, 2012 · 1 comment


None yet

2 participants


for example by specifying in project.clj
:compiler {
:define "goog.userAgent.ASSUME_MOBILE_WEBKIT"
:define "goog.userAgent.product.ASSUME_ANDROID"

goog.userAgent global props:
goog.userAgent.product global props:
"java -jar compiler.jar --help" for all available options
Google Closure Definitive Guide at Google Books:

clojurescript/src/clj/cljs/closure.clj: functions "make-options" and "set-options"

(defn set-options
"TODO: Add any other options that we would like to support."
[opts ^CompilerOptions compiler-options](when %28contains? opts :pretty-print%29
%28set! %28.prettyPrint compiler-options%29 %28:pretty-print opts%29%29)
(when (contains? opts :print-input-delimiter)
(set! (.printInputDelimiter compiler-options)
(:print-input-delimiter opts))))

(defn make-options
"Create a CompilerOptions object and set options from opts map."
[opts](let [level %28case %28:optimizations opts%29
:advanced CompilationLevel/ADVANCED_OPTIMIZATIONS
:whitespace CompilationLevel/WHITESPACE_ONLY
:simple CompilationLevel/SIMPLE_OPTIMIZATIONS%29
compiler-options %28doto %28CompilerOptions.%29
%28.setCodingConvention %28ClosureCodingConvention.%29%29%29]
%28do %28.setOptionsForCompilationLevel level compiler-options%29
%28set-options opts compiler-options%29

emezeske commented Oct 2, 2012

This is, ultimately, a feature request that should go on the ClojureScript issue tracker: . This is a feature that the ClojureScript compiler itself would have to expose.

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