Fork me on GitHub
#tools-deps
<
2020-08-19
>
borkdude11:08:25

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

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

borkdude11:08:28

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

alexmiller13:08:29

you can use clojure -A:test to do that

alexmiller13:08:07

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

vlaaad11:08:25

I think :test exists in install deps?

dharrigan11:08:11

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

alexmiller17:08:05

-Scp is an existing clj option btw

borkdude17:08:19

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.

alexmiller17:08:36

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

Janne Sauvala19:08:26

@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? šŸ™‚

seancorfield20:08:12

I suspect the answers are "no" and "maybe" -- depending on your definition of "soon" šŸ™‚

alexmiller20:08:38

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

Janne Sauvala05:08:19

Gotcha. Iā€™m exited to hear tools.build could be a thing. I really enjoy working with tools.deps and the latest features look great :thumbsup::skin-tone-2:

alexmiller17:08:42

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

vlaaad17:08:14

Features like...? :)

alexmiller17:08:03

well, still designing :)

alexmiller18:08:26

but really trying to simplify invocation in several ways

šŸ‘ 3
seancorfield18:08:16

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.

alexmiller18:08:39

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

3
alexmiller18:08:21

all over it!

alexmiller17:08:48

and easier to use

borkdude17:08:34

@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

seancorfield18:08:59

@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).

seancorfield18:08:25

So @daniel415ā€™s example will work exactly as he would like.

seancorfield20:08:22

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 "" :sha "c461ba830e069edf0f011169c18595a4a8f917fc"} Thanks in advance