do i have to explicitly supply inputs and outputs for all my gradle tasks?

StackOverflow https://stackoverflow.com/questions/23488661

  •  16-07-2023
  •  | 
  •  

문제

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"
}
도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top