Question

I am scripting up a custom gradle build and have noticed that I'm placing inputs and outputs definitions for all of my tasks.

Is this necessary for the predefined tasks or do they 'know' about their consequences and dependencies? for example, are the inputs/outputs here necessary?:

task compileGradleWrapperDependencies(type: GroovyCompile){
    source = fileTree("buildSrc/src/main/groovy") {
        include "com/example/plugins/dsl/SomeFile.groovy"
        include "com/example/plugins/dsl/OtherFile.groovy"
    }
    destinationDir = "$buildDir/tempBuildSrcCompiled"
    classpath = ...
    ...
    inputs.files fileTree("buildSrc/src/main/groovy") {
        include "com/example/plugins/dsl/SomeFile.groovy"
        include "com/example/plugins/dsl/OtherFile.groovy"
    }
    outputs.files "$buildDir/tempBuildSrcCompiled"
}
Was it helpful?

Solution

The task classes that ship with Gradle already define their inputs and outputs (where it makes sense). Declaring the inputs and outputs above is redundant (which you can easily verify yourself).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top