Configure path sensitivity of tasks' file inputs

Closes gh-22359
pull/22996/head
Andy Wilkinson 4 years ago
parent b49cf70a28
commit e080dcf8a4

@ -27,6 +27,8 @@ import org.gradle.api.file.RegularFile;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskExecutionException;
import org.springframework.boot.build.artifactory.ArtifactoryRepository;
@ -50,6 +52,7 @@ public abstract class AbstractPackageManagerDefinitionTask extends DefaultTask {
}
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
public RegularFile getArchive() {
return this.archive.get();
}
@ -59,6 +62,7 @@ public abstract class AbstractPackageManagerDefinitionTask extends DefaultTask {
}
@InputFile
@PathSensitive(PathSensitivity.RELATIVE)
public File getTemplate() {
return this.template;
}

@ -24,6 +24,8 @@ import org.gradle.api.Task;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction;
import org.springframework.boot.build.context.properties.DocumentOptions.Builder;
@ -40,6 +42,7 @@ public class DocumentConfigurationProperties extends DefaultTask {
private File outputDir;
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
public FileCollection getConfigurationPropertyMetadata() {
return this.configurationPropertyMetadata;
}

@ -26,6 +26,7 @@ import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.tasks.Internal;
import org.gradle.api.tasks.JavaExec;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskExecutionException;
import org.gradle.process.internal.ExecException;
import org.slf4j.Logger;
@ -50,7 +51,7 @@ public class MavenExec extends JavaExec {
public void setProjectDir(File projectDir) {
this.projectDir = projectDir;
getInputs().file(new File(projectDir, "pom.xml"));
getInputs().file(new File(projectDir, "pom.xml")).withPathSensitivity(PathSensitivity.RELATIVE);
}
@Override

@ -36,6 +36,8 @@ import org.gradle.api.artifacts.Configuration;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputDirectory;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction;
import org.springframework.util.StringUtils;
@ -75,6 +77,7 @@ public class DocumentStarters extends DefaultTask {
}
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
public FileCollection getStarters() {
return this.starters;
}

@ -34,6 +34,8 @@ import org.gradle.api.Task;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.PathSensitive;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.TaskAction;
import org.springframework.util.ClassUtils;
@ -51,6 +53,7 @@ public class DocumentTestSlices extends DefaultTask {
private File outputFile;
@InputFiles
@PathSensitive(PathSensitivity.RELATIVE)
public FileCollection getTestSlices() {
return this.testSlices;
}

@ -39,6 +39,7 @@ import org.gradle.api.Task;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.PathSensitivity;
import org.gradle.api.tasks.SourceSet;
import org.gradle.api.tasks.TaskAction;
@ -62,8 +63,10 @@ public class TestSliceMetadata extends DefaultTask {
private File outputFile;
public TestSliceMetadata() {
getInputs().dir((Callable<File>) () -> this.sourceSet.getOutput().getResourcesDir());
getInputs().files((Callable<FileCollection>) () -> this.sourceSet.getOutput().getClassesDirs());
getInputs().dir((Callable<File>) () -> this.sourceSet.getOutput().getResourcesDir())
.withPathSensitivity(PathSensitivity.RELATIVE);
getInputs().files((Callable<FileCollection>) () -> this.sourceSet.getOutput().getClassesDirs())
.withPathSensitivity(PathSensitivity.RELATIVE);
}
public void setSourceSet(SourceSet sourceSet) {

Loading…
Cancel
Save