Fork me on GitHub
#tools-deps
<
2020-08-20
>
timo12:08:14

👋 How do I pass a version to clj -Spom?

timo12:08:01

I need it for CI. or is there a more clever way to update the version in the pom.xml for clojars-deployment?

timo13:08:42

sure, this is another option

dominicm12:08:27

@timok generally you cannot. clj -Spom only updates your deps (and generates a basic outline).

dominicm12:08:49

There's garamond which can do that though

jose12:08:09

@timo you can use the maven versions plugin: mvn versions:set versions:set-scm-tag -DnewVersion="${version}"

timo12:08:08

ah thanks @dominicm @jlle. then I will keep the pom.xml in the repo.

jose12:08:51

if you want to publish from github, I wrote a github action: https://github.com/jlesquembre/clojars-publish-action

timo13:08:14

thanks @jlle but it's actually circleci but I will have a look :thumbsup:

jose14:08:19

Do you think that the new -T CLI option can be a better alternative to user.clj? I can imagine moving some repl helpers I have in my user.clj to a function and invoke that function explicitly with -T

Alex Miller (Clojure team)14:08:39

no, that doesn't seem right

Alex Miller (Clojure team)14:08:02

if you're starting a repl, you can use the clojure.main -i to do things like that

👍 3
Alex Miller (Clojure team)14:08:53

-T is for invoking external tools (although I think -T is actually going to go away anyways)

seancorfield16:08:45

Was -T intended to be a specialized -R/`-C` combination?

seancorfield16:08:39

I was looking on the CLI reference page for where you can use :deps in an alias and that seems to just be -T -- but I thought it was valid in some other use case...?

borkdude16:08:46

I think -T did not include the deps on the top level. Which I can see being useful. Kind of like a system wide alias, but for projects

seancorfield16:08:04

It feels "simpler" to just allow :deps / :paths in any alias with the expectation that it overrides the top-level values... but I guess there's always the question of what happens if you specify two aliases and the first has :deps / :paths to override and then the second alias has :extra-deps / :extra-paths to add to those? Will people expect that to work on will :deps / :paths always "win"?

Alex Miller (Clojure team)16:08:05

:deps/paths replacement was previously only available via -A, was pulled out as -T in past

Alex Miller (Clojure team)16:08:16

we are reworking all of this stuff right now

seancorfield16:08:33

Too many unanswered questions 🙂 Needs more Hammock Time!

borkdude16:08:55

paths replacement = classpath overrides?

Alex Miller (Clojure team)16:08:11

:paths replaces the :paths in your project deps.edn

Alex Miller (Clojure team)16:08:22

which is admittedly a very unusual use case

borkdude16:08:34

can be useful for a project within a project?

Alex Miller (Clojure team)16:08:39

we're going to rename these to :replace-deps and :replace-paths

6
borkdude16:08:03

yeah, that's clearer

seancorfield16:08:23

And if there are multiple of those, it'll be like :main-opts and only one gets picked?

Alex Miller (Clojure team)16:08:52

it's not worth me going through all this by piece - it's all getting updated

Alex Miller (Clojure team)16:08:02

so let me go work on that :)

borkdude16:08:09

an analogy with :classpath-overrides {foo/bar nil} could be :remove-deps and :remove-paths

seancorfield16:08:45

FWIW, I'm liking the -X stuff (modulo always wanting :extra-deps to be respected by it) and I'm thinking it will simplify several pieces of tooling at work, since we can remove multiple namespaces containing just a -main function that exists solely to parse/route arguments to other functions that take a hash map 🙂

Alex Miller (Clojure team)16:08:18

that's the idea (and usage stuff will be improved)

seancorfield16:08:45

(our current problem is a couple of our servers are too old to be able to run the install script so I have to update them manually -- but that's not Clojure's problem 🙂 )

Alex Miller (Clojure team)16:08:58

also working on ideas to make ad hoc -F variant a bit more useful for the case of one namespace with many entry point fns

Alex Miller (Clojure team)16:08:12

have I talked about -F yet? I can't even remember now

borkdude16:08:28

no, go on ;)

seancorfield16:08:46

-F is like -X only without needing an alias 🙂

Alex Miller (Clojure team)16:08:00

yeah, invoke ad hoc function

borkdude16:08:01

why even have X then?

Alex Miller (Clojure team)16:08:12

lets you package default args and not repeat the fn at cli

Alex Miller (Clojure team)16:08:37

both useful in different contexts

seancorfield16:08:42

Invoking via an alias is more flexible. Yeah, default args, simpler name, will be even more useful when it respects :extra-deps 🙂

🙃 3
borkdude16:08:56

you can stuff default args in the function itself though?

seancorfield16:08:29

Sure, but you could have different aliases with different default args. That's a use case that we could leverage at work.

💯 3
borkdude16:08:37

-A:foo -F foo/bar, respects extra deps of foo alias?

seancorfield16:08:35

Currently, you'd need -R:foo -X:foo for a function alias -- repetitive! -- so if -X respects :extra-deps you could just do -X:foo

seancorfield16:08:31

Yeah, at this point I'm just sort of assuming it will do that 🙂

seancorfield16:08:46

But -F is definitely useful for ad hoc command-line work.

borkdude16:08:02

instead of creating different aliases with different defaults, one could also just write multiple functions in one namespace. I don't directly see the benefit of one over the other, -A:foo -F foo/foo, -A:bar -F foo/bar.

Alex Miller (Clojure team)16:08:50

sure if you bake it into the code

Alex Miller (Clojure team)16:08:01

putting it in deps.edn is default but configurable

borkdude16:08:12

I guess having it closer together is one benefit

dominicm17:08:58

-F seems like -e? But with less (

Alex Miller (Clojure team)17:08:37

-e is arbitrary expression, -F is "invoke a functional entry point that takes a map" so it's much more specific