port from cljx to cljc
achengs opened this issue · comments
lynaghk/cljx says cljx is deprecated now that Clojure supports reader conditionals ... This ClojureScript wiki page Using cljc links to two example pull requests for porting. A port would enable current efforts to use automat in ClojureScript
I've talked to @domkm, who did the original changes, about this. I think he might get to it when he has time, but if you (or someone else) would like to take the lead I'd be very appreciative.
Okay, I've done the bulk of the work and tests pass in clojure, but clojurescript is broken and I can't figure out why.
Check out my code on my fork jjl/automat , the 'cljc' branch.
@jjl In what way is it broken? Do you get an error?
custard-tart% lein clean-test
Compiling 2 source files to /Users/jjl/code/automat/target/classes
warning: [options] bootstrap class path not set in conjunction with -source 1.5
warning: [options] source value 1.5 is obsolete and will be removed in a future release
warning: [options] target value 1.5 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
lein test automat.core-simple-check
lein test automat.fsm-simple-check
{:result true, :num-tests 100, :seed 1454203566359, :test-var check-closed-over-operations}
Ran 1 tests containing 1 assertions.
0 failures, 0 errors.
Compiling ClojureScript.
Compiling "target/test.js" from ["src" "test"]...
Compiling "target/test.js" failed.
Exception in thread "main" java.lang.AbstractMethodError: Method cljsbuild/compiler/SourcePaths._find_sources(Ljava/lang/Object;)Ljava/lang/Object; is abstract, compiling:(/private/var/folders/k6/glc05svd5d194k8kgqfwkrph0000gn/T/form-init382463497803898384.clj:1:124)
at clojure.lang.Compiler.load(Compiler.java:7239)
at clojure.lang.Compiler.loadFile(Compiler.java:7165)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$init_opt.invoke(main.clj:280)
at clojure.main$initialize.invoke(main.clj:308)
at clojure.main$null_opt.invoke(main.clj:343)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:383)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.lang.AbstractMethodError: Method cljsbuild/compiler/SourcePaths._find_sources(Ljava/lang/Object;)Ljava/lang/Object; is abstract
at cljsbuild.compiler.SourcePaths._find_sources(compiler.clj)
at cljs.closure$build$fn__5570.invoke(closure.clj:1862)
at clojure.lang.Atom.swap(Atom.java:37)
at clojure.core$swap_BANG_.invoke(core.clj:2238)
at cljs.closure$build.invoke(closure.clj:1856)
at cljs.closure$build.invoke(closure.clj:1840)
at cljsbuild.compiler$compile_cljs$fn__5674.invoke(compiler.clj:81)
at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:80)
at cljsbuild.compiler$run_compiler.invoke(compiler.clj:179)
at user$eval5806$iter__5824__5828$fn__5829$fn__5841.invoke(form-init382463497803898384.clj:1)
at user$eval5806$iter__5824__5828$fn__5829.invoke(form-init382463497803898384.clj:1)
at clojure.lang.LazySeq.sval(LazySeq.java:40)
at clojure.lang.LazySeq.seq(LazySeq.java:49)
at clojure.lang.RT.seq(RT.java:507)
at clojure.core$seq__4128.invoke(core.clj:137)
at clojure.core$dorun.invoke(core.clj:3009)
at clojure.core$doall.invoke(core.clj:3025)
at user$eval5806.invoke(form-init382463497803898384.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6782)
at clojure.lang.Compiler.eval(Compiler.java:6772)
at clojure.lang.Compiler.load(Compiler.java:7227)
... 11 more
Subprocess failed```
@jjl I'd suggest reverting ClojureScript to the previous version to see if the tests are failing due to your CLJC conversion or due to ClojureScript compiler changes.
Leaving this link so I can find it again:
master...jjl:cljc
Reported bug upstream http://dev.clojure.org/jira/browse/CLJS-1554
Okay, that was related to an outdated lein-cljsbuild, doh!.
New odd error: "Feature should be a keyword: (defprotocol InputStream (nextInput [_ eof])) {:type :reader-exception, :line 69, :column 38, :file "/Users/jjl/code/automat/src/automat/stream.cljc""
Is your code on github up-to-date? That error looks like you forgot the :clj
or :cljs
in a reader conditional but I don't see it missing.