I am using some task (Swagger codegen Gradle plugin & OpenAPI Style Validator) in my Gradle build that do not support it seems the incremental build feature.
Googling a bit (and checking the Gradle doc) I understood that it seems possible to extend the tasks in order to add some properties, so I gave it a try, but unfortunately it does not seem to work.
Here’s the build.gradle
extension I added:
swaggerSources {
jaxrsServer {
inputFile = file('path/to/spec.yaml')
code {
language = 'jaxrs'
library = 'jersey2'
outputDir = file('build/generated/sources/swagger')
templateDir = file('path/to/templates')
}
}
jaxrsClient {
inputFile = file('path/to/spec.yaml')
code {
language = 'java'
library = 'jersey2'
outputDir = file('build/generated/sources/swagger')
}
}
}
tasks.withType(GenerateSwaggerCode) {
inputs.file('path/to/spec.yaml')
outputs.dir('build/generated/sources/swagger')
}
[...]
openAPIStyleValidator {
inputFile = "$projectDir/path/to/spec.yaml"
validateInfoLicense = false
}
tasks.withType(org.openapitools.openapistylevalidator.gradle.OpenAPIStyleValidatorTask) {
inputs.file("$projectDir/path/to/spec.yaml")
}
And the (truncated) build output:
> Task :module:openAPIStyleValidator
Validating spec: /.../path/to/spec.yaml
[...]
> Task :module:resolveSwaggerTemplate NO-SOURCE
> Task :module:generateSwaggerCodeJaxrsClient
> Task :module:generateSwaggerCodeJaxrsServer
> Task :module:generateSwaggerCode NO-SOURCE
> Task :module:compileJava
Is the task extension wrong? Is there any other way to achieve this?