not change > outputs are still there and did not change > shown as UP-TO-DATE > change detection via > snapshot of input & output files > hash of contents of each file > snapshots persisted until next execution Incremental Builds
Add annotation to each field or getter method Incremental Builds @Input // for binary inputs, only path check @InputFile //checks path and file contents @InputFiles @InputDirectory @OutputFile @OutputFiles @OutputDirectory
task: inferred dependency (instead of using dependsOn) Chain tasks task('myJavadoc', type: Javadoc) { source sourceSets.main.allJava destinationDir file("${project.docsDir}/myjavadoc") } task('zipJavadoc', type: Zip){ from myJavadoc.outputs } Outputs are exposed as FileCollection and can be directly used as an input because from accepts tasks as input (uses project.files() for evaluation)
... } expensiveTests.enabled = false expensiveTests.onlyIf { System.getEnv('I_AM_JENKINS') } > Skip tasks with onlyIf method e.g. when on CI/dev > Evaluates the given closure:
Build will continue normally and marked as SUCCESSFUL Skipping tasks task('expensiveTests') { doFirst{ if (skipThisTask) { throw new StopExecutionException() } } ... }
> Force a task to run every time Skipping tasks task('runAlways') { ... outputs.upToDateWhen { false } } task('storeToDB') { ... outputs.upToDateWhen { checkMyDatabase() } }