cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
2021-05-28T15:46:20.078300Z

I'm struggling a bit with running CLJS compiler under Bazel (new rules from scratch for reasons, not using the shared Bazel Clojure libs) and can't figure out what causes this error:

Exception in thread "main" java.io.FileNotFoundException: Could not locate cljs/loader__init.class, cljs/loader.clj or cljs/loader.cljc on classpat
h.                                                                                                                                                 
        at clojure.lang.RT.load(RT.java:466)                                                                                                       
        at clojure.lang.RT.load(RT.java:424)                          
        at clojure.core$load$fn__7800.invoke(core.clj:6126)                                                                                                at clojure.core$load.invokeStatic(core.clj:6125)                                                                                           
        at clojure.core$load.doInvoke(core.clj:6109)
        at clojure.lang.RestFn.invoke(RestFn.java:408)
        at clojure.core$load_one.invokeStatic(core.clj:5908)                                                                                       
        at clojure.core$load_one.invoke(core.clj:5903)
        at clojure.core$compile$fn__7805.invoke(core.clj:6137)
        at clojure.core$compile.invokeStatic(core.clj:6136)
        at clojure.core$compile.invoke(core.clj:6128)
        at clojure.lang.Var.invoke(Var.java:384)
        at clojure.lang.Compile.main(Compile.java:70)
I gather that cljs.loader is very special, and I'm having a hard time figuring out where it actually gets loaded and what might be wrong.

thheller 2021-05-28T17:33:40.079400Z

@braden.shepherdson that is an error trying to load a CLJS file from CLJ. that ns isn't special, it is just CLJS code not CLJ code.

2021-05-28T17:52:49.080200Z

am I reading it right that src/main/clojure should be the input to clojure.main , while src/main/cljs should be data files available at runtime?

thheller 2021-05-28T17:55:14.081Z

not really? all the files are required by the CLJS compiler. none of the are required at "runtime" if you are referring to the runtime of the final JS output? (as the CLJS compiler will have turned the relevant files into JS code)

2021-05-28T17:56:49.082100Z

I think the problem is actually that this rule wants to AOT-compile the Clojure code and then run it, hence the compile- and run-time distinction.

thheller 2021-05-28T18:00:15.085Z

if you have everything AOT compiled and those classes available you can maybe get away with just src/main/cljs. but there are some .cljc files so might be safer to just keep src/main/clojure as well, if you run the self-hosted compiler you'll need all of it regardless

2021-05-28T18:02:14.085700Z

hm. maybe that's the trouble; I don't think I tried it with src/main/clojure as the srcs and both as data.

2021-05-28T18:22:58.086100Z

🎉 I managed to get --help to work.