Fork me on GitHub
#tools-deps
<
2020-12-24
>
Eugen08:12:37

hi is there a way that I can access (read) the merged deps.edn from the code I am calling ?

:my-alias-target {:extra-deps {....}
                    :main-opts ["-e" "function/class call that can use deps.edn contents"]}

borkdude08:12:01

@eugen.stan Maybe looking at the clojure.basis will help

borkdude08:12:39

(slurp (System/getProperty "clojure.basis"))

👀 3
seancorfield17:12:21

Per @alexmiller it's possible (probable?) that the clojure.basis system property will go away (which would make it impossible for a program to know how it was invoked). It's pretty straightforward to calculate the project basis (from the various deps.edn files) using tools.deps.alpha but you need to tell it what aliases you need merging (and whether you want the user deps.edn file or not -- equivalent to -Sforce).

Alex Miller (Clojure team)17:12:38

I don’t think I said that

Alex Miller (Clojure team)17:12:53

We are going to add an api for access

Alex Miller (Clojure team)17:12:07

The system property would then be part of impl

seancorfield18:12:50

Ah, sorry, I misunderstood. It sounded like you wanted to get rid of the system property altogether.

seancorfield18:12:15

I misremembered: @U050ECB92 said "I am 90% sure the clojure.basis property is going away"

ghadi18:12:57

That’s me hedging that it’s going to be turned into an impl detail

😆 3
Eugen07:12:51

Thanks for clarifying

Eugen10:12:19

thanks @borkdude, it's exactly what I need

andy.fingerhut16:12:43

I am using Clojure CLI tools version 1.10.1.763, and with both that and a slightly earlier version when attempting a command with a single alias that uses a single :git/url dependency (which has its own :git/url dependencies), I get an error message "Error building classpath. No known relationship between git versions", but no other clue about which dependency is causing that message. Should it give a dependency name in that message? Or perhaps there are some extra command line options I could use to make it show more details?

Alex Miller (Clojure team)19:12:26

What that error means is that the same git lib was found but there is no ancestor relationship between the two shas and thus the “newest” version can’t be determined

andy.fingerhut21:12:28

Understood. Is there enough info available when that is detected to print which git lib caused the problem? Not a big deal for me on this issue, but I can imagine with larger dep trees that it would help to narrow down the source of the problem

Alex Miller (Clojure team)22:12:06

It can be improved if you want to file a ticket

andy.fingerhut16:12:41

Adding -Sverbose shows me install_dir, config_paths, etc. but no more detail on the final error message, which is the same as above. -Strace does not write any trace.edn file.

hiredman16:12:30

I forget the flags, but the dependency tree printing may help

andy.fingerhut16:12:37

I am fairly sure I have a small enough issue I can track this down -- mainly curious whether the error message can be made more informative.

andy.fingerhut16:12:22

If you mean -X:deps tree, I tried adding that at the end of my command line, and it downloads a few extra deps, but then gives the same error message with no other output.

hiredman16:12:20

It must be in the deps of your single git dep, or you have another version of that git dep in one of the other deps.edn files listed in config_paths

andy.fingerhut16:12:11

Agreed that my little problem here should be straightforward to track down, since I can count the deps on the fingers of one hand. As I said, I'm mainly asking whether this is expected output, for cases where it isn't so few deps.

andy.fingerhut16:12:34

I will get this fixed in this project, but in case you want to reproduce, a command line that should do it is, I believe: clj -Srepro -Sdeps '{:deps {cljol/cljol {:git/url "" :sha "36c45f741fc64db248020aeb155f1f0f24f95dd9"}}}'

seancorfield17:12:21

Per @alexmiller it's possible (probable?) that the clojure.basis system property will go away (which would make it impossible for a program to know how it was invoked). It's pretty straightforward to calculate the project basis (from the various deps.edn files) using tools.deps.alpha but you need to tell it what aliases you need merging (and whether you want the user deps.edn file or not -- equivalent to -Sforce).