8000 Many ProviderFactory-returned providers do not preserve task dependencies of their inputs · Issue #22799 · gradle/gradle · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Many ProviderFactory-returned providers do not preserve task dependencies of their inputs #22799
Open
@SgtSilvio

Description

@SgtSilvio

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:bughas:workaroundIndicates that the issue has a workaroundin:configuration-modellazy api, domain object containerin:provider-apiproperty lazy provider MapProperty ListProperty DirectoryProperty

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0