This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-12
Channels
- # announcements (1)
- # aws (1)
- # babashka (63)
- # beginners (108)
- # calva (12)
- # cider (6)
- # cljdoc (2)
- # cljsrn (33)
- # clojure (150)
- # clojure-europe (28)
- # clojure-nl (13)
- # clojure-spain (1)
- # clojure-spec (8)
- # clojure-uk (25)
- # clojurescript (16)
- # conjure (7)
- # cursive (7)
- # datomic (15)
- # duct (2)
- # eastwood (2)
- # figwheel (1)
- # figwheel-main (1)
- # fulcro (6)
- # graalvm (1)
- # graalvm-mobile (1)
- # helix (6)
- # honeysql (23)
- # integrant (6)
- # introduce-yourself (4)
- # jobs (10)
- # lsp (132)
- # malli (4)
- # meander (1)
- # membrane (1)
- # off-topic (223)
- # pathom (23)
- # pedestal (3)
- # re-frame (18)
- # reagent (13)
- # releases (1)
- # remote-jobs (2)
- # shadow-cljs (68)
- # tools-deps (217)
- # vim (19)
- # xtdb (79)
Is there a way to set the GITLIBS/clojure.gitlibs.dir var within bb.edn such that it is picked up by the clojure
command when building the classpath? The idea is to point it to a local directory on CI to allow for dependency caching. (For maven deps it can be handled by adding -Sdeps '{:mvn/local-repo \".local-m2-repo\"}
to the command.)
Specifying the envvar using the :extra-env
param for the clojure command doesn't work, because this affects the environment of the clojure process started with the classpath, not the environment of the process that computes the classpath. Similarly, adding -J-Dclojure.gitlibs.dir=.gitlibs
to the command does not work.
But surprisingly (to me) it also does not work to set the property directly, as in the following example:
{:tasks
{foo (do
(System/setProperty "clojure.gitlibs.dir" ".gitlibs")
(clojure (str "-Sforce -Sdeps "
"'{:deps {io.github.cognitect-labs/test-runner "
" {:git/url \"\""
" :sha \"705ad25bbf0228b1c38d0244a36001c2987d7337\"}}}' "
"-Spath")))}}
It does work when setting the envvar for the bb
process: GITLIBS=.gitlibs bb foo
, but I was hoiping to be able to handle this inside bb.edn
.I think -J-Dclojure.gitlibs.dir=.gitlibs
should at least work. Which version are you on?
I'm on 0.4.6
. I don't think that will work - it also does not work with the clojure CLI, because the classpath is computed by a different jvm process which does not get java_opts from -J
args
I don't know! As far as I could tell from inspecting the clojure bash script, there's no way of specifying java_opts for that process
I can make an issue in the babashka project โ feel free to close it if you think it belongs somewhere else
yes, that's what I expected to work, but I'm testing it now and it appears it doesn't
This does work:
{:tasks
{foo (do
(shell {:extra-env {"GITLIBS" ".gitlibs"}}
(str "clojure -Sforce -Sdeps "
"'{:deps {io.github.cognitect-labs/test-runner "
" {:git/url \"\""
" :sha \"705ad25bbf0228b1c38d0244a36001c2987d7337\"}}}' "
"-Spath")))}}
Ah yes, of course. That should be good enough for now, although not as satisfying as using the deps.clj.
Sorry, I pressed "enter" before I filled out the issue - there's content on it now https://github.com/babashka/babashka/issues/934
In that case, shouldn't (System/setProperty "clojure.gitlibs.dir" ".gitlibs")
have an effect?
but this JVM isn't started using babashka.process which processes the :extra-env
option
but using some custom ProcessBuilder code that was there since the beginning in deps.clj
@UNBM99ED7 I think I have a solution. Can I provide you with a binary for testing?
https://20854-201467090-gh.circle-artifacts.com/0/release/babashka-0.4.7-SNAPSHOT-macos-amd64.tar.gz
That means I can put something like this in my :init
job
(def clj
(if (some-> (System/getenv "CI") (not= "0"))
(partial clojure
{:extra-env {"GITLIBS" ".gitlibs"}}
"-Sdeps '{:mvn/local-repo \".m2-repo\"}'")
clojure))
if it's easier for you, you can also provide the deps map as a separate string without the single quotes
I'm confused by this.
$ bb version
babashka v0.4.6
$ cat w.bb
(+ 3 2)
$ bb w.bb
----- Error --------------------------------------------------------------------
Type: clojure.lang.ExceptionInfo
Message: Could not resolve symbol:
Location: /home/bob/e/devconsole/w.bb:1:1
Phase: analysis
----- Context ------------------------------------------------------------------
1: (+ 3 2)
^--- Could not resolve symbol:
borkdude@MBP2019 /tmp/foo $ cat /tmp/w.bb
(+ 3 2)
borkdude@MBP2019 /tmp/foo $ bb /tmp/w.bb
5
$ xxd http://w.bb 00000000: efbb bf28 2b20 3320 3229 0a ...(+ 3 2).
thatโll do it
which is fine, what encoding? Ascii is a subset of utf-8
those are byte order marks