tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
borkdude 2020-08-19T11:10:25.246400Z

Why does clojure not warn about an unexisting :test alias?

borkdude@MBP2019 /tmp/p1 $ echo "{}"  > deps.edn
borkdude@MBP2019 /tmp/p1 $ clojure -Srepro -A:test
Clojure 1.10.1
user=> ^D
borkdude@MBP2019 /tmp/p1 $ clojure -Srepro -A:testx
WARNING: Specified aliases are undeclared: [:testx]
Clojure 1.10.1
user=>

borkdude 2020-08-19T11:11:28.247600Z

Also, I figured it would be useful to have something like: clojure -CR:test to get the same as clojure -C:test -R:test: use case, I want to run a REPL with the same paths and deps as the :test alias, just not execute the main

vlaaad 2020-08-19T11:28:25.247800Z

I think :test exists in install deps?

dharrigan 2020-08-19T11:58:11.248300Z

indeed, in my install on Arch, in /usr/share/clojure/deps.edn it has test as an alias

souenzzo 2020-08-19T12:56:48.248600Z

This file https://github.com/clojure/brew-install/blob/1.10.1/src/main/resources/deps.edn The "global" deps

alexmiller 2020-08-19T13:11:29.248900Z

you can use clojure -A:test to do that

alexmiller 2020-08-19T13:12:07.249100Z

oh, "and not execute the main" - well for that you need the -C / -R

seancorfield 2020-08-19T16:59:31.249400Z

@borkdude https://github.com/seancorfield/depstar/issues/34

seancorfield 2020-08-19T17:03:45.250Z

@alexmiller https://github.com/seancorfield/depstar/issues/35 -- good idea you posted in #beginners !

alexmiller 2020-08-19T17:30:05.250500Z

-Scp is an existing clj option btw

alexmiller 2020-08-19T17:30:42.251200Z

we would definitely like to encourage more use of -X - considering a bunch of additional features that may continue to make it more attractive for tools

alexmiller 2020-08-19T17:30:48.251400Z

and easier to use

borkdude 2020-08-19T17:40:19.251500Z

That's useful, but it only affects the runtime classpath. This feature is about overriding the classpath from which the uberjar is created, which makes it more flexible. The classpath can be generated from other tools like leiningen, boot, clojure, etc, whatever source.

borkdude 2020-08-19T17:42:34.252500Z

@seancorfield One other thing that came up in #beginners: the non-standard way of providing the name of the uberjar. It would be easier to compose if that could be done using a named parameter like --uberjar foo.jar

alexmiller 2020-08-19T17:46:36.252900Z

gotcha, might be something good to add to tools.build's uber stuff then :)

vlaaad 2020-08-19T17:52:14.253500Z

Features like...? :)

alexmiller 2020-08-19T17:59:03.253700Z

well, still designing :)

alexmiller 2020-08-19T18:01:26.253900Z

but really trying to simplify invocation in several ways

👍 1
seancorfield 2020-08-19T18:39:16.254200Z

Updating hf.depstar.uberjar:

(defn run
  "Generic entry point for all invocations.

  Can be used with `clojure -X`:

  In `:aliases`:

      :depstar {:extra-deps {seancorfield/depstar {:mvn/version ...}}}
      :uberjar {:fn hf.depstar.uberjar/run
                :args {:aot true :jar-type :uber}}

  Then run:

      clojure -R:depstar -X:uberjar :jar MyProject.jar :main-class project.core

  If the destination JAR file and main class are fixed, then could be
  added to `:args` in `deps.edn`:

      :depstar {:extra-deps {seancorfield/depstar {:mvn/version ...}}}
      :uberjar {:fn hf.depstar.uberjar/run
                :args {:aot true :jar MyProject.jar
                       :jar-type :uber :main-class project.core}}

  Both `:jar` and `:main-class` can be specified as symbols or strings."
It would be nice if -X acted like -R .. -X .. so you didn't have to also specify -R:depstar here and could have the :extra-deps in the :uberjar alias.

seancorfield 2020-08-19T18:40:59.255300Z

@borkdude Yeah, I'm making it :jar for the -X option and it will also be -J / --jar on the command-line (as well as just accepting the filename anywhere).

seancorfield 2020-08-19T18:41:25.255700Z

So @daniel415’s example will work exactly as he would like.

borkdude 2020-08-19T18:41:37.255900Z

:thumbsup:

alexmiller 2020-08-19T18:41:39.256Z

what I'm working on right now is in that area

1
alexmiller 2020-08-19T18:42:21.256300Z

all over it!

dakra 2020-08-19T18:47:14.256800Z

Nice :)

Janne Sauvala 2020-08-19T19:41:26.257Z

@alexmiller I keep hearing references to tools.build (since your Inside Clojure -post). Is there more detailed description of it somewhere already or can we expect something coming out soonish? 🙂

seancorfield 2020-08-19T20:01:12.257200Z

I suspect the answers are "no" and "maybe" -- depending on your definition of "soon" 🙂

alexmiller 2020-08-19T20:09:15.257400Z

^^

alexmiller 2020-08-19T20:09:38.257600Z

trying to pull together a lot of strands right now, not sure on timing yet

seancorfield 2020-08-19T20:17:22.260600Z

OK, in light of earlier discussions, the develop branch of depstar has several new features requested this morning: support for clojure -X, support for overriding the classpath used for building the JAR, and reworked argument parsing so the JAR filename can be specified "anywhere" (before/after/in the middle of the options). Please take it for a spin and report back any issues (either on GitHub or here). seancorfield/depstar {:git/url "<https://github.com/seancorfield/depstar>" :sha "c461ba830e069edf0f011169c18595a4a8f917fc"} Thanks in advance