Fork me on GitHub
#tools-deps
<
2020-10-24
>
dominicm13:10:44

{:aliases {:foo ["bar"]}} and clj -A:foo produces interesting results :P e.g.

:resolve-args {\b \a},
:classpath-args {\b \a},

dominicm13:10:40

I was curious to see what would happen :)

Jakub Holý (HolyJak)14:10:38

Hi! What is the relationship of versions between Clojure and tools.deps? Latest Clojure download is https://download.clojure.org/install/linux-install-1.10.1.727.sh, latest https://github.com/clojure/tools.deps.alpha#release-information. If I install that Clojure, which deps will I get? I.e. what command-line options will clojure support? Thank you!

Alex Miller (Clojure team)14:10:58

The change logs for the two are cross linked and you can find official release info at https://clojure.org/releases/tools

Alex Miller (Clojure team)14:10:42

The docs on the Clojure site always reflect the latest stable release (or use -h or the man page)

Jakub Holý (HolyJak)14:10:41

Thank you! I should have noticed the " See the changelog for version information." at https://clojure.org/guides/getting_started

Jakub Holý (HolyJak)15:10:39

Q1: Does :local/root need to be an absolute path? If so - I guess it isn't possible to use something like "~/path/to/it" (to make it portable across users)?

3
Jakub Holý (HolyJak)15:10:38

Q2: Why am I getting > Error building classpath. No coordinate type found for library cryogen-asciidoc/cryogen-asciidoc in coordinate {:local-root "/Users/me/external/cryogen-all/cryogen-asciidoc"} when head /Users/me/external/cryogen-all/cryogen-asciidoc/pom.xml returns successfully (modified)

...
  <groupId>cryogen-asciidoc</groupId>
  <artifactId>cryogen-asciidoc</artifactId>
...
?

dpsutton15:10:40

https://github.com/lambdaisland/chui/blob/master/deps.edn#L4 is an example of relative paths. I think if you use an absolute path like ~/some/path it will not be portable at all

❤️ 3
Alex Miller (Clojure team)15:10:48

You can’t use ~ - that’s a shell thing

Alex Miller (Clojure team)15:10:00

But either absolute or relative are fine

3
Alex Miller (Clojure team)15:10:05

Not sure if that solves your q2 or not but if not share your deps.edn

👎 3
Jakub Holý (HolyJak)16:10:52

Here is it

{:deps {org.clojure/clojure {:mvn/version "1.10.1"}
        ring-server/ring-server {:mvn/version "0.5.0"}
        ring/ring-devel {:mvn/version "1.7.1"}
        compojure/compojure {:mvn/version "1.6.1"}
        cryogen-core/cryogen-core {:mvn/version "0.3.2"}
        #_#_cryogen-core/cryogen-core {:local-root "../../external/cryogen-all/cryogen-core"}
        #_#_cryogen-asciidoc/cryogen-asciidoc {:mvn/version "0.3.2"}
        cryogen-asciidoc/cryogen-asciidoc {:local-root "../../external/cryogen-all/cryogen-asciidoc"}}
 :aliases {;; Run with `clojure -M:build`
           :build {:main-opts ["-m" "cryogen.core"]}
           ;; Start a server serving the blog: `clojure -X:serve`
           ;; (requires tools-deps 0.9.745+)
           :serve {:exec-fn   cryogen.server/serve
                   :exec-args {:port 8888}}}}
This is from https://github.com/holyjak/blog.jakubholy.net, the local dependency is https://github.com/cryogen-project/cryogen-asciidoc/

Alex Miller (Clojure team)16:10:05

It’s :local/root not :local-root

Jakub Holý (HolyJak)17:10:20

OMG, thanks a lot! I must be blind.

dpsutton15:10:08

I’m surprised you can’t use ~. I figured it would end up in a path object and the jvm would work it out for you

borkdude15:10:05

jvm doesn't do this

borkdude15:10:25

it's a bash thing. On Windows this doesn't work either

dpsutton15:10:26

Makes sense. Not sure where I got that expectation

borkdude15:10:20

What could work OS-independent is interpolation of environment variables. But even then you would have to use different names for linux and windows

borkdude15:10:02

so probably a script that generates deps.edn for you as a pre-processing step is the least worst way of dealing with such concerns

borkdude15:10:54

I haven't had an app where I did this, except for one where I keep deps in sync between project.clj and deps.edn

Alex Miller (Clojure team)15:10:41

Java has a system property for this - user.home

Alex Miller (Clojure team)15:10:59

(System/getProperty "user.home") is platform independent

Alex Miller (Clojure team)15:10:31

but no equivalent to that in deps.edn (yet, or maybe ever)

dominicm15:10:07

@holyjak what's the home-relative use case?

Jakub Holý (HolyJak)16:10:49

None, if I can (I can) use relative psths

dharrigan16:10:14

I would love to see deps.edn support some type of user home substitution. I have the a main $HOME/.clojure directory, in there I have my deps.edn file, that I pull in other libraries with that are all local root (i.e., setting up a REPL with some middleware etc..). Right now, since I’m on Linux I have to put an absolute path in, i.e., :base {:extra-deps {local-base/local-base {:local/root "/home/david/.clojure/libs/local.base" :deps/manifest :deps}}

dharrigan16:10:26

I cannot bring that across to my mac environment

Alex Miller (Clojure team)17:10:45

Making the .clojure/deps.edn portable across machines wrt paths is not a goal - imo if you’re on a different machine, you will need to adjust to that machine

Alex Miller (Clojure team)17:10:51

Which is not to say we won’t ever add something like this, but I’m not eager to do so

dharrigan16:10:47

since that is /Users/home/david

dharrigan16:10:17

I thus have to maintain two separate deps.edn files that are near identical, apart from the path stuff.

dharrigan16:10:57

but and I’m just trying this out…having it as a relative path may work!

dharrigan16:10:15

i.e., :base {:extra-deps {local-base/local-base {:local/root "libs/local.base" :deps/manifest :deps}}

dharrigan16:10:23

Switching to a relative path, ends up with

dharrigan16:10:26

Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate local/rebel/main__init.class, local/rebel/main.clj or local/rebel/main.cljc on classpath.

dharrigan16:10:22

which leaves me with having to put the absolute path in my deps.edn, and maintaining two separate deps.edn (which I suspect, if I was also on windows would incur more mangement)

dharrigan16:10:05

It would be nice IMHO if deps supported at least having :local/root resolve the user’s home.

dominicm16:10:07

Hmm, I'm slightly surprised that resolution isn't relative when doing that. The personal tooling case is the only one I have so far too :)

Alex Miller (Clojure team)16:10:57

I’m not, that’s what I’d expect - top level deps are relative to where you’re running clj

dominicm16:10:06

@alexmiller I suppose they could be resolved with a relative *dir* like when doing transitive :local/root though?

dominicm16:10:14

(obviously there's problems there due to the merging)

Alex Miller (Clojure team)16:10:36

Yeah, that’s problematic

dominicm17:10:55

I suppose paths could be canonicalized pre-merging.

borkdude18:10:51

that's what I do in clj-kondo config. Each config can refer to local dirs relative to itself and these get resolved during config reading.

borkdude18:10:49

this way you can have hooks in your home dir config, not relative to your project

Alex Miller (Clojure team)18:10:00

That’s possible, I’ll think about it

dharrigan18:10:38

that would be nice