Welcome! Please see the About page for a little more info on how this works.

0 votes
in tools.deps by
closed by

It appears that an :exec-args attribute in a :deps/prep-lib's :alias is not honored, i.e. it's not possible to declare default args for the prep :fn.

Given the following statement in the Deps and CLI Reference on :deps/prep-lib:

Those libs will run the command specified there by alias and function, as if: clj -T:<alias> <fn>.

And this one on -T:

The function is invoked with a map in the same way as -X execution, built from :exec-args if found in aliases and key/vals provided on the command line.

It seems like this should be possible. Is this a bug in the implementation, in the documentation or in my understanding? :-)

closed with the note: Now available in 1.11.1.1177

1 Answer

0 votes
by
selected by
 
Best answer

:deps/prep-lib does not use :exec-fn or :exec-args by design.

What is your use case for needing the arg map?

by
> :deps/prep-lib does not use :exec-fn or :exec-args by design.

Thanks! I suggest to mention this in the first sentence I quoted then so that it doesn't contradict the second one.

> What is your use case for needing the arg map?

For parameterizing a generic build task implementation. See https://github.com/borkdude/tools/pull/5 for the patch that prompted the question - as you can see, I've just made up a custom attribute for the same purpose instead now :-)
by
We want the function to be explicit (like -T), so no :exec-fn. And we don't want to allow ad hoc args from an external perspective as prep is something that happens once per user, regardless of which project depends on a project, so it cannot be externally parameterizable. But supporting internal parameters (:exec-args) does make sense as a way to reuse a build function either within or across projects.  Logged as https://clojure.atlassian.net/browse/TDEPS-231
...