babashka

https://github.com/babashka/babashka. Also see #sci, #nbb and #babashka-circleci-builds .
2020-08-26T02:20:48.104500Z

To summarize, I put the above script in a file test_bb_requires.clj, ran bb against it, and checked that BABASHKA_CLASSPATH doesn’t exist before and after. Then I ran your sample on the command-line which works fine:

bash-3.2$ echo $BABASHKA_CLASSPATH

bash-3.2$ bb test_bb_requires.clj
java.lang.Exception: Could not require java-time. [at /Users/me/..../mydir/test_bb_requires.clj, line 16, column 1]
bash-3.2$ echo $BABASHKA_CLASSPATH

bash-3.2$ export BABASHKA_CLASSPATH=$(clojure -Sdeps '{:deps {henryw374/cljc.java-time
                         {:git/url "<https://github.com/henryw374/cljc.java-time.git>"
                          :sha "e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c"}}}' -Spath)

&gt; &gt; bash-3.2$ bash-3.2$ bb -e "(require '[cljc.java-time.local-date :as ld])"

bash-3.2$ java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b16, mixed mode)
(MacOS 10.13.6) Thanks!

borkdude 2020-08-26T07:44:58.104800Z

Note that you are requiring a different namespace in the first example, but apart from that, I can reproduce your issue now. I'll look into it.

borkdude 2020-08-26T07:53:06.105Z

This example works for me:

(require '[babashka.classpath :refer [add-classpath]]
         '[clojure.java.shell :refer [sh]]
         '[clojure.string :as str])

(def added-deps
  '{:deps {cljc.java-time {:git/url "<https://github.com/henryw374/cljc.java-time.git>"
                           :sha "e3d184b78e933322b3fcaa6ca66cbb8f42a6b35c"}
           medley {:git/url "<https://github.com/borkdude/medley>"
                   :sha "91adfb5da33f8d23f75f0894da1defe567a625c0"}}})
(def cp (:out (sh "clojure" "-Spath" "-Sdeps" (str added-deps))))

(add-classpath (str/trim cp))
(require '[cljc.java-time.local-date :as ld])

borkdude 2020-08-26T07:53:20.105200Z

Somehow I needed to trim the classpath to get rid of the newline

borkdude 2020-08-26T08:19:56.105400Z

So it turns out it was in fact loading macrovich, but the part on the path had appended a new line for that .jar file

borkdude 2020-08-26T08:23:35.105600Z

I adapted the README accordingly

2020-08-26T14:17:13.105800Z

Fixed indeed, thanks! I was wondering if others encountered the same newline issue. Regarding the wrong ns name, I think I was trying to avoid the cljs call from an earlier try, sorry about that. Looking forward to discover and learn more from your work! Cheers..

borkdude 2020-08-26T14:32:45.106Z

@kingcode Cool. I think the cljc.java-time lib could maybe be optimized by not loading macrovich for babashka and/or clojure, since it's only relevant to cljs. Maybe the author will take a PR