Index: subprojects/core/src/integTest/groovy/org/gradle/api/internal/changedetection/state/TaskTypeUpToDateIntegrationTest.groovy =================================================================== diff -u -N -r39e6b15eef5750dc0074140335f8ee52ab6e46bf -ra41dfa4e9a7f46c60f15f8eaca40156c51905998 --- subprojects/core/src/integTest/groovy/org/gradle/api/internal/changedetection/state/TaskTypeUpToDateIntegrationTest.groovy (.../TaskTypeUpToDateIntegrationTest.groovy) (revision 39e6b15eef5750dc0074140335f8ee52ab6e46bf) +++ subprojects/core/src/integTest/groovy/org/gradle/api/internal/changedetection/state/TaskTypeUpToDateIntegrationTest.groovy (.../TaskTypeUpToDateIntegrationTest.groovy) (revision a41dfa4e9a7f46c60f15f8eaca40156c51905998) @@ -16,9 +16,13 @@ package org.gradle.api.internal.changedetection.state +import org.gradle.api.tasks.incremental.IncrementalTaskInputs import org.gradle.integtests.fixtures.AbstractIntegrationSpec +import org.gradle.work.InputChanges import spock.lang.Issue +import spock.lang.Unroll +@Unroll class TaskTypeUpToDateIntegrationTest extends AbstractIntegrationSpec { def "task is up-to-date after unrelated change to build script"() { @@ -176,6 +180,33 @@ then: skipped(":copy") } + @Issue("https://github.com/gradle/gradle/issues/9723") + def "declaring a task action receiving #incrementalChangesType without declaring outputs is deprecated"() { + def input = file('input.txt').createFile() + buildFile << """ + class IncrementalTask extends DefaultTask { + @InputFile File input + + @TaskAction execute(${incrementalChangesType} inputChanges) { + } + } + + task noOutput(type: IncrementalTask) { + input = file('${input.name}') + } + """ + + when: + executer.expectDeprecationWarning() + run 'noOutput' + then: + outputContains("Using the incremental task API without declaring any outputs has been deprecated. This is scheduled to be removed in Gradle 6.0. Please declare output files for your task or use `task.upToDateWhen { true }`.") + noneSkipped() + + where: + incrementalChangesType << [IncrementalTaskInputs.simpleName, InputChanges.simpleName] + } + private static String declareSimpleCopyTask(boolean modification = false) { """ ${declareSimpleCopyTaskType(modification)}