This message was deleted.
# plugin-development
s
This message was deleted.
j
outputs can be used outside of Gradle. For example Dokka generates docs in a specific output which you need to know in order to be able to upload to a hosting
m
You can still know from the task name, the task name is kind of public API
j
You mean autogenerating the output path based on task name and so on?
m
yep
I get the "historical reasons" so it'll have to be progressive but if I'm writing a new plugin, I'd love to have Gradle allocate something for me
j
if one task can get the outputs of other tasks I don’t think specifying manually that path is relevant
for me it is a good idea to remove that
plus1 1
Indeed it should help to non file outputs as Gradle implementation should write those outputs somehow in a file which is not indicated by the user to recover them later
So it would be a good moment to unify that behavior is that is on the roadmap
m
non file outputs
This was one of my question actually. Is it possible to have
String
outputs for an example?
From reading the documentation only, I wasn't 100% clear
j
I think there is an open issue about that so I think it is not possible
👍 1
m
Makes sense 👍
v
There is no way to auto-select an output path. You could do something like
layout.buildDirectory.dir(task.name)
or similar.
m
I can do it manually but nothing beats something enforced by Gradle so that no one is ever tempted to overlap with my outputs.
Or at least not without violating/ignoring some warnings 😄
v
It could always happen, but at least newer Gradle versions detect such overlapping outputs, for example if you have task A with output to A task B which also outputs to A and task C which uses task A output as input, then Gradle will complain that C uses output of B wihtout an ordering constraing.
In Gradle 7 that was a deprecation warning, in Gradle 8 it is a hard failure
m
Agreed, I'm coming here from Gradle 8 failures actually. Just feels like this should be enforced before runtime
Also makes it easier to develop plugin, feels like having a default location for outputs is a win in all cases
v
Feel free to open a feature request for it if there is none yet. 🙂
👍 1
p
Some tasks must differentiate their output by some runtime variable. I have developed tasks that generate native code, and those tasks output path were something like "${task.name}/${task.target}/${project.name}.ext"
m
@Pedro Lamarão not sure I follow. Make the runtime variable an input and re-generate the output when it changes?
Or do you need to archive the outputs of different runs?
I guess there could be "advanced" use cases similar to
createTempFile
where you can give a prefix but Gradle still owns the namespace
p
Yes, in my case, it is very convenient to have both outputs present. One may archive or publish them all at together.
👍 1