boot-clj / boot-figreload

Boot task providing live-reload using Fighweel client
Eclipse Public License 1.0
49 stars 1 forks source link

ClassCastException thrown by boot-figreload #8

Closed DonyorM closed 7 years ago

DonyorM commented 7 years ago

Currently my code is throwing the following error when running the command boot -vv figwheel:

java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.lang.String
    at java.lang.String.compareTo(String.java:111)
    at clojure.lang.Util.compare(Util.java:153)
    at clojure.lang.RT$DefaultComparator.compare(RT.java:280)
    at clojure.lang.PersistentTreeMap.doCompare(PersistentTreeMap.java:311)
    at clojure.lang.PersistentTreeMap.entryAt(PersistentTreeMap.java:298)
    at clojure.lang.PersistentTreeMap.containsKey(PersistentTreeMap.java:94)
    at clojure.lang.APersistentSet.contains(APersistentSet.java:34)
    at clojure.lang.PersistentTreeSet.cons(PersistentTreeSet.java:52)
    at clojure.lang.PersistentTreeSet.cons(PersistentTreeSet.java:17)
    at clojure.lang.RT.conj(RT.java:652)
    at clojure.core$conj__4345.invokeStatic(core.clj:85)
    at clojure.core$conj__4345.invoke(core.clj:82)
    at adzerk.boot_cljs.middleware$main.invokeStatic(middleware.clj:76)
    at adzerk.boot_cljs.middleware$main.invoke(middleware.clj:52)
    at adzerk.boot_cljs$compile_1.invokeStatic(boot_cljs.clj:154)
    at adzerk.boot_cljs$compile_1.invoke(boot_cljs.clj:141)
    at adzerk.boot_cljs$eval813$fn__814$fn__819$fn__820$fn__821.invoke(boot_cljs.clj:276)
    at clojure.core$map$fn__4785.invoke(core.clj:2646)
    at clojure.lang.LazySeq.sval(LazySeq.java:40)
    at clojure.lang.LazySeq.seq(LazySeq.java:49)
    at clojure.lang.RT.seq(RT.java:521)
    at clojure.core$seq__4357.invokeStatic(core.clj:137)
    at clojure.core$dorun.invokeStatic(core.clj:3024)
    at clojure.core$doall.invokeStatic(core.clj:3039)
    at clojure.core$doall.invoke(core.clj:3039)
    at adzerk.boot_cljs$eval813$fn__814$fn__819$fn__820.invoke(boot_cljs.clj:274)
    at adzerk.boot_cljs$eval758$fn__759$fn__764$fn__765.invoke(boot_cljs.clj:174)
    at adzerk.boot_cljs_repl$eval916$fn__917$fn__926$fn__927.invoke(boot_cljs_repl.clj:187)
    at boot.task.built_in$fn__2414$fn__2415$fn__2432$fn__2433.invoke(built_in.clj:479)
    at boot.task.built_in$fn__2414$fn__2415$fn__2424$fn__2425.invoke(built_in.clj:477)
    at powerlaces.boot_figreload$eval1336$fn__1337$fn__1346$fn__1347$fn__1354.invoke(boot_figreload.clj:222)
    at powerlaces.boot_figreload$eval1336$fn__1337$fn__1346$fn__1347.invoke(boot_figreload.clj:221)
    at boot.task.built_in$fn__2345$fn__2346$fn__2351$fn__2352$fn__2370$fn__2371.invoke(built_in.clj:430)
    at boot.task.built_in$fn__2345$fn__2346$fn__2351$fn__2352$fn__2370.invoke(built_in.clj:430)
    at boot.task.built_in$fn__2345$fn__2346$fn__2351$fn__2352.invoke(built_in.clj:427)
    at boot.core$run_tasks.invoke(core.clj:1019)
    at boot.core$boot$fn__918.invoke(core.clj:1029)
    at clojure.core$binding_conveyor_fn$fn__4676.invoke(core.clj:1938)
    at clojure.lang.AFn.call(AFn.java:18)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

This is the figwheel task:

(deftask figwheel
  "Runs figwheel and enables reloading."
  []
  (dev)
  (require '[powerlaces.boot-figreload :refer [reload]]
           '[pandeiro.boot-http :refer [serve]])
  (let [reload (resolve 'powerlaces.boot-figreload/reload)
        serve (resolve 'pandeiro.boot-http/serve)]
    (comp
     (watch)
     (reload :client-opts {:debug true})
     (cljs-repl)
     (cljs)
     )))

This occurs after boot outputs "Compiling ClojureScript". I do not see this error if I run boot cljs or boot cljs-repl without the figwheel setup.

You can see my full build.boot file here.

My main.cljs.edn file is:

{:require [test.core]
 :compiler-options {:main "test.app",
                    :asset-path "/js/out",
                    :output-to "target/cljsbuild/public/js/app.js",
                    :output-dir "target/cljsbuild/public/js/out",
                    :source-map true,
                    :optimizations :none,
                    :pretty-print true}}
arichiardi commented 7 years ago

Thank you I will fix this.

arichiardi commented 7 years ago

Actually it seems like this is triggered by boot-cljs, can you confirm @DonyorM?

DonyorM commented 7 years ago

@arichiardi Reloading (either by boot-figreload or ordinary boot-reload) is certainly involved. Running boot cljs by itself causes no issues.

arichiardi commented 7 years ago

I copied from boot-cljs big chunks of code that is why :stuck_out_tongue:

arichiardi commented 7 years ago

Fixed in https://github.com/boot-clj/boot-cljs/pull/165

DonyorM commented 7 years ago

Works beautifully with the addition. Thanks for the fix.