This message was deleted.
# community-support
s
This message was deleted.
t
How do you declare your tasks' inputs and outputs?
p
Ah! I have not done that. I've written a lot of tasks and have never explicitly declared inputs and outputs.
This is the first time that I've tried to iterate a command on a FileTree though. So maybe I've finally gotten to the point that I need to do that?
j
You shouldn’t force to run it always, you should fix inputs and outputs. Anyway, you can mark your task as untracked to avoid caching it
@UntrackedTask
p
I'm searching for the syntax for declaring the input in my task definition. I'm not defining a custom task, the doc on the web seems to focus on code for custom tasks. Can you suggest a way to declare the input
FileTree
?
e
have never explicitly declared inputs and outputs
😲
Can you suggest a way to declare the input
FileTree
?
it is definitely easier with a custom task class
configuring
TaskInputs
ad-hoc might work but the interface is very limited in what you can describe
p
I know my use of Gradle must sounds really weird. But I'm building a documentation toolchain that hangs together based on task dependency. Is it unusual not to use custom task classes? I could write a custom class for this, if only to make declaring the input easier.
e
task dependencies are almost always the wrong solution
p
Maybe I need to redesign my build without relying on dependencies. My use is a little unusual (automating documentation build) so it's hard to find basic examples to start from. Just to clarify my problem here: why does invoking
file.name
in the
println
for each iteration cause Gradle to run the task?
e
I'm pretty sure it doesn't and you're seeing a side-effect of build script up-to-date checks
it's not that dependencies are bad, it's that task dependencies are bad. if you wire up the inputs and outputs as recommended in the Gradle documentation, then Gradle will understand the task dependencies implicitly, and be able to accurately skip, cache, and parallelize them
p
if you wire up the inputs and outputs as recommended in the Gradle documentation, then Gradle will understand the task dependencies implicitly
Thank you! I appreciate the pointer here. I'll see if I can prototype a build that declares inputs and outputs explicitly, and does not rely completely on task dependencies.
v
I think enough was said about that it feels not really right what you doing, so I concentrate on your initial question only. And the answer to your initial question is: The ask as you showed it does always execute. It does not have any input or outputs defined, so it can never be up-to-date as that is a requirement. Be defining inputs and output you would achieve the opposite of what you want.
thank you 1