Declare a task's outputs, enabling incremental build and caching

This specific task runs an external command, and we consider the task
successful if that command exits without error.  We don't actually
examine the stdout or stderr of the command being run.

However, it is still useful to log the stdout and stderr to a file,
and to declare that file to be the output of the task.  Otherwise, the
task has no declared outputs at all.  A task with no outputs is
ineligible for caching and is always considered to be out-of-date.

squash! Declare a task's outputs, enabling incremental build and caching
This commit is contained in:
Ben Liblit 2018-08-04 04:08:12 -05:00
parent e0ad8fd9f7
commit a7cef8e77a
1 changed files with 9 additions and 0 deletions

View File

@ -111,6 +111,15 @@ model {
// all combined as a colon-delimited path list
args pathElements.join(':')
// log output to file, although we don't validate it
final def outFile = file("$temporaryDir/stdout-and-stderr.log")
outputs.file outFile
doFirst {
final def fileStream = new FileOutputStream(outFile)
standardOutput fileStream
errorOutput fileStream
}
}
check.dependsOn checkSmoke_main