tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
dominicm 2020-10-24T13:21:44.050100Z

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

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

dominicm 2020-10-24T13:33:40.050300Z

I was curious to see what would happen :)

Jakub Holý 2020-10-24T14:43:38.052100Z

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!

alexmiller 2020-10-24T14:44:58.053500Z

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

alexmiller 2020-10-24T14:45:42.054600Z

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

alexmiller 2020-10-24T14:46:25.055700Z

https://clojure.org/reference/deps_and_cli

Jakub Holý 2020-10-24T14:51:41.056200Z

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

Jakub Holý 2020-10-24T15:10:39.057600Z

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)?

✅ 1
Jakub Holý 2020-10-24T15:13:38.058900Z

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>
...
?

dpsutton 2020-10-24T15:14:40.059600Z

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

❤️ 1
alexmiller 2020-10-24T15:18:48.060400Z

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

alexmiller 2020-10-24T15:19:00.060800Z

But either absolute or relative are fine

✅ 1
alexmiller 2020-10-24T15:21:05.061800Z

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

👎 1
dpsutton 2020-10-24T15:36:08.062800Z

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

borkdude 2020-10-24T15:40:05.063Z

jvm doesn't do this

borkdude 2020-10-24T15:40:25.063700Z

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

dpsutton 2020-10-24T15:40:26.063800Z

Makes sense. Not sure where I got that expectation

borkdude 2020-10-24T15:41:20.064400Z

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

borkdude 2020-10-24T15:42:02.065Z

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

borkdude 2020-10-24T15:42:54.065600Z

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

alexmiller 2020-10-24T15:50:41.065900Z

Java has a system property for this - user.home

alexmiller 2020-10-24T15:50:59.066300Z

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

alexmiller 2020-10-24T15:51:31.066600Z

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

dominicm 2020-10-24T15:55:07.067100Z

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

dharrigan 2020-10-24T16:10:14.069Z

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}}

dharrigan 2020-10-24T16:10:26.069300Z

I cannot bring that across to my mac environment

dharrigan 2020-10-24T16:10:47.069600Z

since that is /Users/home/david

dharrigan 2020-10-24T16:11:17.070400Z

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

dharrigan 2020-10-24T16:12:57.070800Z

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

dharrigan 2020-10-24T16:13:15.071300Z

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

Jakub Holý 2020-10-24T16:13:49.071500Z

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

dharrigan 2020-10-24T16:14:07.071800Z

nope

dharrigan 2020-10-24T16:14:23.072100Z

Switching to a relative path, ends up with

dharrigan 2020-10-24T16:14:26.072300Z

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.

dharrigan 2020-10-24T16:15:22.073400Z

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)

dharrigan 2020-10-24T16:18:05.074600Z

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

Jakub Holý 2020-10-24T16:20:52.074700Z

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/

dominicm 2020-10-24T16:21:45.075Z

ah, OK :)

dominicm 2020-10-24T16:27:07.075200Z

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 :)

alexmiller 2020-10-24T16:56:05.075800Z

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

alexmiller 2020-10-24T16:57:57.077200Z

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

dominicm 2020-10-24T16:59:06.077300Z

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

dominicm 2020-10-24T16:59:14.077400Z

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

alexmiller 2020-10-24T16:59:36.077900Z

Yeah, that’s problematic

Jakub Holý 2020-10-24T17:00:20.078Z

OMG, thanks a lot! I must be blind.

alexmiller 2020-10-24T17:06:45.079800Z

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

alexmiller 2020-10-24T17:07:51.080600Z

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

dominicm 2020-10-24T17:10:55.080800Z

I suppose paths could be canonicalized pre-merging.

borkdude 2020-10-24T18:13:51.081400Z

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.

borkdude 2020-10-24T18:14:49.082Z

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

alexmiller 2020-10-24T18:44:00.082600Z

That’s possible, I’ll think about it

dharrigan 2020-10-24T18:59:38.082800Z

that would be nice

dharrigan 2020-10-24T18:59:39.083Z

🙂