Lazy Configuration with ProcessResources Task

I am working on a custom Plugin / Task that is using input from both the javaCompile task as well as (ideally) processResources task. After a bit of a learning curve I think do understand lazy configuration using the javaCompile task and it works as expected by basically setting the input property of my custom task with the javaCompile Task’s getDestinationDirectory() property. This also covers incremental changes nicely.

Here is my question: How would this work for the ProcessResources task?
It does not provide a way to return a DirectoryProperty. ProcessResources only provides getDestinationDir which returns a File. My understanding is that getDestinationDir is part of the old APIs as the javaCompile task has this property as well but that is deprecated.

Therefore, is there are way for the processResources task to support Lazy Configuration? Is that a missing feature? If not, what is the idiomatic way to use its output in custom tasks? Is it best to use the old-school “dependsOn”?

Is it best to use the old-school “dependsOn”?

Practically never.

If you want all outputs of a task, just use the task itself.
In the case of JavaCompile it has outputs you are not interested in, namely previousCompilationData so in the case of JavaCompile you only want a specific ouput and thus using the destinationDirectory property is a good way.

If you would have a similar situation with processResources without the outputs being available via Property/Provider API, you could do things like processResourcesTaskProvider.map { it.destinationDir } to still not need explicit dependsOn.

Btw. actually, it sounds like you instead want to use sourceSets.main.map { it.output }.