Fork me on GitHub
#babashka
<
2020-08-25
>
kingcode21:08:44

I am trying to mimicking the babashka example for using external libraries, and adding one of my own, but the cp string is empty:

kingcode21:08:25

(def added-deps '{:deps {clojure.java-time {:git/url "" :sha "a36e0c5295dbcb0458040004d8f593b33fad0867"} medley {:git/url "" :sha "91adfb5da33f8d23f75f0894da1defe567a625c0"}}})

kingcode21:08:26

The added dependency (java-time) is not found and wrecking the whole classpath string as a result

borkdude21:08:26

Can you please post the code as one string between triple backticks?

kingcode21:08:07

Sure! Thx…

(def added-deps
  '{:deps {clojure.java-time {:git/url ""
                              :sha "a36e0c5295dbcb0458040004d8f593b33fad0867"}

           medley {:git/url ""
                   :sha "91adfb5da33f8d23f75f0894da1defe567a625c0"}}})

kingcode21:08:38

(Sorry, haven’t used slack for a while)

borkdude21:08:25

I'm getting: > Error building classpath. Manifest type not detected when finding deps for clojure.java-time/clojure.java-time in coordinate {:git/url "https://github.com/dm3/clojure.java-time", :sha "a36e0c5295dbcb0458040004d8f593b33fad0867"} when I try those coordinates with clojure

kingcode21:08:02

OK Thanks! That is a java-time repo issue then?

kingcode21:08:41

Will look into it…thx for a great tool.

borkdude21:08:06

Yes, I think the commit you are referencing is an old one that doesn't have a deps.edn in the repo

borkdude21:08:39

Btw, the library clojure.java-time doesn't work with bb right now: > java.lang.Exception: Unable to resolve classname: java.lang.reflect.Field Check out https://github.com/borkdude/babashka/blob/master/doc/libraries.md for a list of libs that do work. This one does work: https://github.com/henryw374/cljc.java-time, I haven't added it to the page yet.

kingcode21:08:44

Thanks - will try the one you suggest.

borkdude21:08:07

@kingcode This one is tested with bb on CI:

henryw374/cljc.java-time
                         {:git/url ""
                          :sha "e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c"}

kingcode22:08:06

Thanks..Now the cp is updated and looks good. But for some reason, when trying it in the bb Repl, I am unable to require anything e.g.

kingcode22:08:30

(require '[cljc.java-time.local-date :as ld])
;;=> java.lang.Exception: Could not require net.cgrand.macrovich. [at cljs/java_time/interop.cljc, line 1, column 1]

kingcode22:08:35

ooops I think the issue is cljs getting in the way !?

borkdude22:08:11

which commit SHA are you using

kingcode22:08:14

I also tried (require '[java-time]) with similar results: user=> java.lang.Exception: Could not require java-time. [at line 26, column 1]

kingcode22:08:56

The one you gave me: e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c

kingcode22:08:33

Thank you…sorry for the inconvenience

borkdude22:08:11

No problem, happy to get you started. So this works:

borkdude@MBA2015 /tmp $ export BABASHKA_CLASSPATH=$(clojure -Sdeps '{:deps {henryw374/cljc.java-time
                         {:git/url ""
                          :sha "e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c"}}}' -Spath)
borkdude@MBA2015 /tmp $ bb -e "(require '[cljc.java-time.local-date :as ld])"

borkdude22:08:36

Also works from the REPL, just tested that

borkdude22:08:54

Now I'm wondering what doesn't work for you

borkdude22:08:32

Looks like you're using an older version maybe?

kingcode22:08:17

Hmmm…strange. I am using bb 0.1.3

borkdude22:08:31

I mean of cljc.java-time?

borkdude22:08:02

Does it work from the command line and not from the REPL, or both?

kingcode22:08:02

oh…the SHA is not the same as version? 0.1.11 corresponds to the SHA we are using ( e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c).

kingcode22:08:38

I will try your snippet above as is..

kingcode22:08:40

Yes, from the command prompt it looks fine - no exception. I was using it inside the REPL created from ‘bb’ at the prompt

borkdude22:08:59

are you using BABASHKA_CLASSPATH or some other means? Please give as much detail as possible

borkdude22:08:19

I have to call it a night. Will look again tomorrow

kingcode22:08:56

OK Thank you, have a good night. I will look for more details, but for now I have put the code into a .clj file I am running to the MacOSX prompt, which does reproduce the issue:

#!/usr/bin/env bb

(require '[clojure.java.shell :refer [sh]]
         '[clojure.pprint :refer [pprint]]
         '[clojure.tools.cli :as cli :refer [parse-opts]]
         '[babashka.classpath :refer [add-classpath]])

(def added-deps
  '{:deps {cljc.java-time {:git/url ""
                           :sha "e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c"}
           medley {:git/url ""
                   :sha "91adfb5da33f8d23f75f0894da1defe567a625c0"}}})

(def cp (:out (sh "clojure" "-Spath" "-Sdeps" (str added-deps))))
(add-classpath cp)
(require '[java-time :as t])