Open alafanechere opened 2 years ago
Hi I dug a bit deeper as i am experiencing the same issue but in my case it was my own fault.
To investigate the bug please run you gradle command with --info
it will show you why the task is re-run.
If you get an output message such as "From property outputDir
file "xyz" was removed" you can use the following code to find whats going wrong
Set<File> bev;
tasks.openApiGenerate.doFirst {
println "Before : " + it.outputs.files.asFileTree.files.size()
bev = it.outputs.files.asFileTree.files
}
tasks.openApiGenerate.doLast { it ->
println "After : " + it.outputs.files.asFileTree.files.size()
var newOut = new HashSet<>(it.outputs.files.asFileTree.files);
newOut.removeAll(bev);
println "Diff (ADDED) : " + newOut
bev.removeAll(it.outputs.files.asFileTree.files)
println "Diff (REMOVED) : " + bev
}
This just compares the diff between the output dir before and after the task
Bug Report Checklist
Description
When I use the
GenerateTask
and want to target anoutputDir
which path is not in the$buildDir
the client I'm generating is generated on each build and I don't benefit from incremental builds (UP-TO-DATE
flag on task). I'm wondering if this is something related to Gradle our this plugin specifically and if there's an existing workaround.If I use the $buildDir in the outputDir path the incremental build works, and my client get generated only upon spec updates.
openapi-generator version
5.3.1
Steps to reproduce
No incremental builds with the following
build.gradle
Works as expected when using
$buildDir
in theoutputDir
path:task generateApiClient(type: GenerateTask) { inputSpec = "$rootDir.absolutePath/airbyte-api/src/main/openapi/config.yaml" outputDir = "$buildDir/airbyte_api_client"
}
Related issues/PRs
@HenningWaack PR's https://github.com/OpenAPITools/openapi-generator/pull/6716 introduced support for incremental build.