[Bug]: prep-lib is broken
Closed this issue · 5 comments
What version of Datahike are you using?
main
What version of Java are you using?
19
What operating system are you using?
Linux
What database EDN configuration are you using?
Describe the bug
When using datahike as a lib I need to run clj -X:deps prep
to compile the java classes. This throws Prep function could not be resolved: tools.build/jcompile
because the clj -T:build jcompile
functionality seems to be broken. Tried from datahike-server repository.
In the datahike-folder when cloned to disk clj -X:deps prep
does nothing but clj -T:build compile
throws java.lang.Exception: Cyclic load dependency: [ /clojure/main ]->/clojure/spec/alpha->[ /clojure/main ]->/clojure/core/server
What is the expected behaviour?
clj -X:deps prep
should compile the java code like it is described here.
How can the behaviour be reproduced?
clj -X:deps prep
I've also run into this. I tried debugging it, but can't deduce any useful info from the emitted stacktrace for java.lang.Exception: Cyclic load dependency: [ /clojure/main ]->/clojure/spec/alpha->[ /clojure/main ]->/clojure/core/server
.
I tried running the build command from the circle ci yaml (clj -A:build -P
). It completed successfully, but the prep command still failed with the above error.
The reason for this seems to be that the [:deps/prep-lib :fn]
path points to a babashka build task and not a function. A really ugly hack that seems to provide a workaround for the problem is as follows.
First add a build.clj
:
(ns build
(:require [clojure.java.shell :refer [sh]]))
(defn bb-trigger [_input]
(sh "bb" "jcompile"))
Then change the ´deps.edn´ to use that file as build namespace and the function, i.e. :build {:ns-default build}
and :fn bb-trigger
.
The result is really slow for some reason, and someone with more clojure experience may find a neater solution.
A really ugly hack
Haha :) I like it. I will try to test it and solve this issue soonish. Thanks!
I think I will do it like you proposed. Do you want to submit that patch? @oelrich
Absolutely! I'll try to get it done today.