You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A missing directory that is part of inputs to snapshot can cause issues with the up-to-date checks.
When a missing directory is input for two different tasks, during the first run, snapshot will be evaluated to FileSystemSnapshot.EMPTY for both tasks.
However, in the second run, the 1st task that runs will add the directory snapshot to the FileSystemMirror, and it won't invoke FileSystemMirror.clear() as the task does not run (it is up-to-date). The second task in the second run will get the snapshot information and if there are no patterns set for the directory tree, the PhysicalMissingSnapshot will be used for snapshotting. This is causing the 2nd run of the 2nd task to see a new file in the input.
Here is the build file that reproduces the issue. Running ./gradlew mytask && ./gradlew mytask will execute mytask in both runs. It should mark it as up-to-date in the second run:
File content = new File("content")
content.mkdir()
new File(content, "readme").createNewFile()
FileTree fst = project.fileTree(content)
FileTree snd = project.fileTree(new File("doesNotExist"))
FileTree fc = project.files(snd, fst).getAsFileTree()
def bef = tasks.create("beforeTask", MyTask) {
source = fc
outDir = new File(project.buildDir, "beforeTask")
}
tasks.create("mytask", MyTask) {
source = fc
outDir = new File(project.buildDir, "mytask")
}.dependsOn(bef)
class MyTask extends DefaultTask {
@InputFiles FileTree source
@OutputDirectory File outDir
@TaskAction
void doStuff() {}
}
The text was updated successfully, but these errors were encountered:
A missing directory that is part of inputs to snapshot can cause issues with the up-to-date checks.
When a missing directory is input for two different tasks, during the first run, snapshot will be evaluated to
FileSystemSnapshot.EMPTY
for both tasks.However, in the second run, the 1st task that runs will add the directory snapshot to the
FileSystemMirror
, and it won't invokeFileSystemMirror.clear()
as the task does not run (it is up-to-date). The second task in the second run will get the snapshot information and if there are no patterns set for the directory tree, thePhysicalMissingSnapshot
will be used for snapshotting. This is causing the 2nd run of the 2nd task to see a new file in the input.Here is the build file that reproduces the issue. Running
./gradlew mytask && ./gradlew mytask
will execute mytask in both runs. It should mark it as up-to-date in the second run:The text was updated successfully, but these errors were encountered: