Open
Description
Expected Behavior
Calling providers.fileContents(Provider<RegularFile>)
where Provider<RegularFile>
is a task output property preserves the task dependency in the providers returned from asText
and asBytes
.
Current Behavior
Calling providers.fileContents(Provider<RegularFile>)
where Provider<RegularFile>
is a task output property does not preserve the task dependency in the providers returned from asText
and asBytes
.
Context
Steps to Reproduce
This can be reproduced with the following build.gradle.kts
:
abstract class XXX : DefaultTask() {
@get:OutputFile
val file = project.objects.fileProperty()
@TaskAction
protected fun run() {
file.get().asFile.writeText(System.nanoTime().toString())
}
}
val xxx by tasks.registering(XXX::class) {
file.set(layout.buildDirectory.file("xxx.txt"))
outputs.upToDateWhen { false }
}
val yyy by tasks.registering {
inputs.property("time", providers.fileContents(xxx.get().file).asText)
// inputs.property("time", xxx.get().file.flatMap { providers.fileContents(it).asText })
doLast {
inputs.properties.forEach { (name, value) -> println("$name: $value") }
}
}
Running ./gradlew yyy --dry-run
only shows:
:yyy SKIPPED
Instead it should show:
:xxx SKIPPED
:yyy SKIPPED
Your Environment
Build scan URL: