Last active
August 29, 2015 14:17
-
-
Save xeqi/21fc5ab3e244d98d4199 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(require 'cljs.closure) | |
(require 'cljs.js-deps) | |
(import 'java.net.URLClassLoader) | |
(import 'java.net.URL) | |
(def react-url | |
"https://clojars.org/repo/cljsjs/react/0.13.0-0/react-0.13.0-0.jar") | |
(defn add-url | |
"Act like pomegranate/dynapath and add a url onto the classpath" | |
[cl url] | |
(-> URLClassLoader | |
(.getDeclaredMethod "addURL" (into-array Class [URL])) | |
(doto (.setAccessible true)) | |
(.invoke cl (into-array URL [url])))) | |
(defn build-output | |
"Build the src tree and capture warnings" | |
[] | |
(with-out-str | |
(binding [*err* *out*] | |
(cljs.closure/build | |
"src" | |
{:output-to "out/main.js"})))) | |
(assert | |
(= (build-output) | |
"WARNING: Required namespace not provided for cljsjs.react\n")) | |
(let [cl (.. Thread currentThread getContextClassLoader)] | |
(add-url cl (URL. react-url))) | |
(assert | |
(= (build-output) "")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns t.core | |
(:require cljsjs.react)) | |
(enable-console-print!) | |
(println "Hello world!") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -cp cljs.jar:src clojure.main build.clj | |
Exception in thread "main" java.lang.AssertionError: Assert failed: (= (build-output) ""), compiling:(/home/xeqi/workspace/tmp/cljscompilerchck/build.clj:31:33) | |
at clojure.lang.Compiler.load(Compiler.java:7142) | |
at clojure.lang.Compiler.loadFile(Compiler.java:7086) | |
at clojure.main$load_script.invoke(main.clj:274) | |
at clojure.main$script_opt.invoke(main.clj:336) | |
at clojure.main$main.doInvoke(main.clj:420) | |
at clojure.lang.RestFn.invoke(RestFn.java:408) | |
at clojure.lang.Var.invoke(Var.java:379) | |
at clojure.lang.AFn.applyToHelper(AFn.java:154) | |
at clojure.lang.Var.applyTo(Var.java:700) | |
at clojure.main.main(main.java:37) | |
Caused by: java.lang.AssertionError: Assert failed: (= (build-output) "") | |
at user$eval40.invoke(build.clj:33) | |
at clojure.lang.Compiler.eval(Compiler.java:6703) | |
at clojure.lang.Compiler.load(Compiler.java:7130) | |
... 9 more |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment