tools-deps

Discuss tools.deps.alpha, tools.build, and the clj/clojure command-line scripts! See also #depstar #clj-new
Janne Sauvala 2020-08-20T05:59:19.000100Z

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:

timo 2020-08-20T12:41:14.001100Z

šŸ‘‹ How do I pass a version to clj -Spom?

timo 2020-08-20T12:43:01.002Z

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

dominicm 2020-08-20T12:48:27.002800Z

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

dominicm 2020-08-20T12:48:49.003400Z

There's garamond which can do that though

2020-08-20T12:48:55.003600Z

Iā€™m using sed šŸ™‚ https://github.com/xapix-io/axel-f/blob/master/.github/workflows/publish.yml#L45-L46

šŸ‘ 1
jose 2020-08-20T12:50:09.004500Z

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

timo 2020-08-20T12:51:08.005400Z

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

jose 2020-08-20T12:52:51.006300Z

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

timo 2020-08-20T13:09:14.007Z

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

timo 2020-08-20T13:15:42.007200Z

sure, this is another option

timo 2020-08-20T13:15:44.007400Z

thanks

jose 2020-08-20T14:41:19.010100Z

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

alexmiller 2020-08-20T14:47:39.010500Z

no, that doesn't seem right

alexmiller 2020-08-20T14:48:02.010900Z

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

šŸ‘ 1
alexmiller 2020-08-20T14:48:53.011600Z

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

seancorfield 2020-08-20T16:06:45.012400Z

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

seancorfield 2020-08-20T16:07:39.013500Z

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...?

borkdude 2020-08-20T16:07:46.013700Z

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

seancorfield 2020-08-20T16:10:04.016500Z

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"?

alexmiller 2020-08-20T16:10:05.016600Z

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

alexmiller 2020-08-20T16:10:16.016800Z

we are reworking all of this stuff right now

seancorfield 2020-08-20T16:10:33.017400Z

Too many unanswered questions šŸ™‚ Needs more Hammock Time!

alexmiller 2020-08-20T16:10:51.017900Z

already did it

borkdude 2020-08-20T16:10:55.018Z

paths replacement = classpath overrides?

alexmiller 2020-08-20T16:11:01.018200Z

no

alexmiller 2020-08-20T16:11:11.018500Z

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

borkdude 2020-08-20T16:11:16.018800Z

right

alexmiller 2020-08-20T16:11:22.019Z

which is admittedly a very unusual use case

borkdude 2020-08-20T16:11:34.019400Z

can be useful for a project within a project?

alexmiller 2020-08-20T16:11:39.019600Z

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

2
borkdude 2020-08-20T16:12:03.020300Z

yeah, that's clearer

seancorfield 2020-08-20T16:12:23.021100Z

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

alexmiller 2020-08-20T16:12:52.022100Z

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

alexmiller 2020-08-20T16:13:02.022600Z

so let me go work on that :)

borkdude 2020-08-20T16:13:09.023Z

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

seancorfield 2020-08-20T16:15:45.025200Z

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

alexmiller 2020-08-20T16:16:18.026300Z

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

seancorfield 2020-08-20T16:16:45.027100Z

(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 šŸ™‚ )

alexmiller 2020-08-20T16:16:58.027400Z

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

alexmiller 2020-08-20T16:17:12.027800Z

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

borkdude 2020-08-20T16:17:28.028Z

no, go on ;)

seancorfield 2020-08-20T16:17:46.028500Z

-F is like -X only without needing an alias šŸ™‚

alexmiller 2020-08-20T16:18:00.028900Z

yeah, invoke ad hoc function

borkdude 2020-08-20T16:18:01.029Z

why even have X then?

alexmiller 2020-08-20T16:18:12.029400Z

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

alexmiller 2020-08-20T16:18:37.030200Z

both useful in different contexts

seancorfield 2020-08-20T16:18:42.030300Z

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

šŸ™ƒ 1
borkdude 2020-08-20T16:18:56.030600Z

you can stuff default args in the function itself though?

seancorfield 2020-08-20T16:19:29.031300Z

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

šŸ’Æ 1
borkdude 2020-08-20T16:19:37.031600Z

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

seancorfield 2020-08-20T16:20:35.032600Z

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

seancorfield 2020-08-20T16:21:46.033700Z

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

borkdude 2020-08-20T16:22:02.034Z

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.

alexmiller 2020-08-20T16:22:20.034100Z

this is coming

šŸ’Æ 1
alexmiller 2020-08-20T16:22:50.034400Z

sure if you bake it into the code

alexmiller 2020-08-20T16:23:01.034700Z

putting it in deps.edn is default but configurable

borkdude 2020-08-20T16:23:12.034900Z

I guess having it closer together is one benefit

seancorfield 2020-08-20T16:23:31.035Z

Yeah, at this point I'm just sort of assuming it will do that šŸ™‚

dominicm 2020-08-20T17:04:58.035600Z

-F seems like -e? But with less (

alexmiller 2020-08-20T17:07:37.036100Z

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