Fork me on GitHub
#tools-deps
<
2020-09-07
>
seancorfield00:09:47

Can't you override it to point to local JAR? The sources JAR file?

seancorfield01:09:38

Since we're getting a lot of depstar questions here, I created a dedicated channel for support/questions/etc. Also for clj-new.

borkdude06:09:22

@dominicm you can also use classpath overrides with nil. I’ve used this for creating babashka uberjars (see its README and look for uberjar)

kirill.salykin09:09:33

goodmorning, please advice how I can turn off the OmitStackTraceInFastThrow?

clojure -A:app -J "XX:-OmitStackTraceInFastThrow"
doesnt seem to work

dharrigan09:09:32

clojure -J-XX:-OmitStackTraceInFastThrow

kirill.salykin09:09:46

thanks! it is all about the order

practicalli-johnny10:09:42

In clojure pre-release (1.10.1.672) it seems that the -X flag does not download dependencies specified in the alias :extra-deps section. Is this the correct behavior? From my interpretation of "-X now supports multiple aliases, aliases with other argmap options like :extra-deps, and ad hoc functions" I would have thought deps would be downloaded

borkdude10:09:30

is that in combination with -A?

practicalli-johnny10:09:59

No, just by itself. I understood -A was being depreciated, so am trying to understand the scope of using -M (which seems fairly clear) and -X which I am still confused about (from a users ponit of view)

Alex Miller (Clojure team)13:09:58

@jr0cket that is intended to work, so could be a bug

practicalli-johnny15:09:27

Yes, it does work on a clean install of Clojure CLI with the ~/.clojure/.cpcache removed. This is making much more sence now. Thanks.

rickmoynihan13:09:26

To temporarily swap out a git dep for a local dev version, am I normally better adding an alias with :override-deps in it to a :local/root, or adding :classpath-overrides to my ~/.clojure/deps.edn ?

dominicm13:09:24

@rickmoynihan I usually use an override-deps (actually extra-deps because it's the same otherwise) in ~/.clojure/deps.edn because: • Nobody else can use it - has my homedir in • Most people on my teams aren't contributing to those other libraries anyway. It's less reusable than one would think

rickmoynihan13:09:25

yeah for both options I’m talking about adding it to ~/.clojure/deps.edn… trying to understand which way is better.

rickmoynihan13:09:11

One (`:override-deps`) effects resolve-deps and the other make-classpath right?

rickmoynihan13:09:09

Practically though; aren’t they both equivalent?

dominicm13:09:16

I think for your case, they're essentially equivalent. I'd go with extra-deps just because it's more famiilar.

rickmoynihan13:09:34

except :classpath-overrides assumes the lib only introduces a single classpath root, is that right?

rickmoynihan13:09:06

so e.g. it would potentially miss including resources etc

dominicm13:09:13

Exactly, yeah

borkdude14:09:50

Re command line args, I have one tool that only has one CLI argument, --opts in which you pass a Clojure map. For that tool I think it made sense and it also simplified command line parsing, possibly also easier to keep it non-breaking. I'm not suggesting that other tools do this, but works for this one particular thing.

clojure -A:carve --opts '{:paths ["src" "test"]}'

sogaiu23:09:42

i have a tool that does something similar -- though it doesn't use anything like --opts before the string. it's nice to not have to decide on command line arguments when you don't know what option and arg names are likely to be used more often.

dominicm15:09:25

I suppose the clj way of doing that is would be clj -X:carve :paths '["src" "test"]'?

borkdude15:09:22

I guess so, but if we're going to use quotes, why not quote the whole thing anyway

dominicm15:09:14

I mention it only because I think this is what clj is trying to make the standard for cli tools. While I personally think --path src --path test would be the best, standards are better than better.

borkdude15:09:32

or :paths src,test since comma is whitespace in Clojure, but not in bash?

borkdude15:09:54

$ bb -e "*command-line-args*" -- :paths src,test
(":paths" "src,test")

dominicm15:09:40

You're thinking in Clojure 🙂 I'm thinking of bash. Admittedly, my answer was without context. Generally I'd much prefer an api where paths was the & args at the end so I could just do:

clj -X:carve dev-*

dominicm15:09:59

(which expands to clj -X:carve dev-src dev-resources dev-etc)

borkdude15:09:18

If bash would expand that comma separated, then it would work as passing one value.

borkdude15:09:42

Anyway, it doesn't.

borkdude15:09:06

Yeah, if keywords would separate other values then :jars *.jar :paths src* would work

borkdude15:09:30

unless your dir starts with a colon :)

borkdude15:09:55

but I guess using a comma as explicit separator works:

$ bb -e "*command-line-args*" -- :foo t* , :nums 1 2 3
(":foo" "tags" "test" "test-resources" "," ":nums" "1" "2" "3")

borkdude15:09:41

This doesn't work in powershell (no expansion, comma is gone)

PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu-20.04\tmp> cd C:/Temp
PS C:\Temp>  bb -e "*command-line-args*" -- :foo t* , :nums 1 2 3
(":foo" "t*" ":nums" "1" "2" "3")

borkdude15:09:25

Finally, cmd.exe (no expansion, preserves comma)

C:\Temp>bb -e "*command-line-args*" -- :foo t* , :nums 1 2 3
(":foo" "t*" "," ":nums" "1" "2" "3")

dominicm15:09:41

No idea how cmd.exe handles wildcards. Ultimately there's some platform specific tweaks to match the ergonomics of a platform you're on.

borkdude15:09:41

I guess there's a reason WSL2 is getting popular

dominicm15:09:49

But also - this is what people on cmd.exe expect. That's fine and while I don't understand it, if that's what makes sense for their OS then fine.

borkdude15:09:22

I listened to a podcast by someone who is working on the new Terminal app. She said that they couldn't change cmd.exe's behavior because that would be breaking for lots of people. But everyone basically agrees that it sucks.

borkdude15:09:41

Making the cmd.exe window smaller will make it faster, because there is less rendering, which is blocking

borkdude15:09:04

ok sorry, got a little bit off topic

lread17:09:16

Getting back to clojure/clj command line arg compatibility, this is not helpful right now, but I am curious. If we could go back in time would these tools have been better initially named something like clj-alpha1 and clojure-alpha1? This would have drawn attention to their alpha-ness and also allowed a path for introducing breaking changes.

lread17:09:28

Then again maybe not… this would have implied clojure itself is alpha.

lread17:09:43

Tricky little problem.

borkdude17:09:02

The help could have mentioned the word alpha at least somewhere. From and end user's perspective, it's hard to see this is alpha, you'd have to know what .jar it's calling underneath which has alpha in the name. This entire page doesn't mention alpha neither: https://clojure.org/guides/deps_and_cli

seancorfield17:09:08

I just got a bug report against the new version of clj-new and it's obviously broken but it leads me to a question about t.d.a and migrations: clj-new uses t.d.a to resolve coordinates for templates and it was using t.d.a 0.8.677 and the clojure.tools.deps.alpha.reader namespace with default-deps and read-deps. I updated it to 0.9.782 and switched the code over to pull in the runtime basis... but of course that doesn't exist in the new CLI! Doh! I could revert to 0.8.677 and continue using the old logic, but I was wondering if there was a way in 0.9.782 to get at that same logic so that utilities could run with the basis, if it exists, else fall back to the equivalent of (read-deps (default-deps))? Mostly a question for @alexmiller I guess...

Alex Miller (Clojure team)18:09:58

Those functions now exist in the tools.deps.alpha namespace

Alex Miller (Clojure team)18:09:18

Or their equivalents - there were some name changes etc

seancorfield18:09:22

Hmm, it looks like some of the logic for finding deps.edn has moved into the CLI script, and is no longer in t.d.a?

Alex Miller (Clojure team)18:09:49

No, should all be there

Alex Miller (Clojure team)18:09:00

Shape is a little different

seancorfield18:09:06

OK, I'll keep digging...

Alex Miller (Clojure team)18:09:50

Sorry, not at a computer to be precise

Alex Miller (Clojure team)18:09:00

It’s just root-deps and user-deps and ./deps.edn

seancorfield18:09:54

find-edn-maps was what I needed so I think I'm good now...

seancorfield18:09:23

For anyone else working on t.d.a-based tooling who wants to leverage 0.9.782 but continue to support older CLI versions, here's what I ended up with for the basis:

(delay (if-let [basis-file (System/getProperty "clojure.basis")]
           (-> basis-file
               (io/file)
               (slurp)
               (edn/read-string))
           (let [{:keys [root-edn user-edn project-edn]} (deps/find-edn-maps)]
             (deps/merge-edns (filterv some? [root-edn user-edn project-edn]))))))
That's to replace the equivalent of (read-deps (default-deps)) from t.d.a 0.8.677 -- it's not identical, but for the purposes of equivalence with 0.8.677 it seems close enough.