Fork me on GitHub
#tools-deps
<
2020-10-29
>
dpsutton15:10:45

working to give an error message to verify that the tools deps version is too old to support -M -m. Does anyone know offhand if a version supported -X but not -M -m? Hoping can check something real quick with -X and that means it necessarily supports -M

dpsutton15:10:24

as it stands, added a simple (ns check) (defn -main [& _] (System/exit 0)) but would prefer to not need a new main and new ns if X and M go hand in hand

dpsutton16:10:38

ie, could just do clojure -X clojure.core/identity :a :a and if that returns 0 then good to go for -M -m our.stuff

lread16:10:01

@dpsutton I expect this is not what you are looking for, but I write my scripts in Babashka where I find a Clojure version check to be explicit and straightforward: https://github.com/lread/rewrite-cljc-playground/blob/60ad8c118a86221e35692f2ce10281e7cef0f8a4/script/helper/env.clj#L39

practicalli-johnny16:10:10

@dpsutton https://clojure.org/releases/tools might have the info about -X but not -M -m support... although I believe -X support wasnt added until https://clojure.org/releases/tools#v1.10.1.697 and -M -m was in by then. I use https://clojure.org/releases/tools#v1.10.1.697 as the minimum requirement for Clojure CLI tools with my aliases and content from Practicalli

seancorfield16:10:41

-M has been in the CLI for a long time but it's meaning changed around 1.10.1.697

seancorfield16:10:45

The difference between 1.10.1.561 (stable) and the later version is just that -M now respects resolve-args and classpath-args in aliases as well as main-opts. Previously, it ignored resolve-args and classpath-args. Does that help @dpsutton?

dpsutton16:10:30

Yeah that does. I think that means we should use the check for X support to make sure we have a recent enough version

dpsutton16:10:59

Although I think our use case is simple enough that as long as M support is there it’s fine

seancorfield16:10:22

@dpsutton I just ran some tests on a bunch of prerelease versions between the last two stable releases, and there are several where that command returns a zero status but doesn't actually work.

seancorfield17:10:26

(but I believe they would support -M with aliases by that point... I just haven't tested that 🙂 )

dpsutton17:10:00

In what way do they not work?

dpsutton17:10:09

And thanks so much!

seancorfield17:10:40

(! 1626)-> /usr/local/Cellar/clojure\@1.10.1.636/1.10.1.636/bin/clojure -X clojure.core/identity :a :a
No alias specified with -X

Thu Oct 29 09:58:15
(sean)-(jobs:0)-(/Developer/workspace/wsmain/build)
(! 1627)-> echo $?
0

seancorfield17:10:13

The ability to pass the fn to execute on the command-line came fairly late in that set of prerelease builds.

seancorfield17:10:28

1.10.1.672 seems to be the first prerelease build that allowed it.

dpsutton17:10:18

Oh ok. It’s only prereleases? If so they can diagnose it on their own :)

dpsutton17:10:40

Bleeding edge is sometimes bleeding

seancorfield17:10:13

Yeah, 1.10.1.561 (previous stable) throws an exception and gives a non-zero exit status.

seancorfield17:10:31

(so does 1.10.1.590 which was the first of the prerelease builds)

dpsutton17:10:40

Beautiful. How do you change versions so quickly? Would have done that if I knew a good way to swap them around easily

seancorfield17:10:46

I installed them by version with brew and then I can use the full path (as shown above) to run any version I want 🙂

kirill.salykin17:10:29

how are you doing this?

kirill.salykin17:10:01

just brew install @version ?

seancorfield17:10:09

brew install clojure/tools/[email protected] per the CLI install docs

kirill.salykin17:10:31

clear, thanks a lot!

seancorfield17:10:09

See https://github.com/clojure/homebrew-tools (which is linked from the CLI install docs on the CLI guides page)

seancorfield17:10:34

I didn't have 561 until just now, but installed it by version to test.

dpsutton17:10:30

Oh I didn’t know it left older versions laying around