OpenAPITools / OpenAPITools/openapi-generator
[BUG] Gradle plugin: incremental build does not work if `outputDir` is not in `$buildDir`
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When I use the GenerateTask and want to target an outputDir 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
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
id "org.openapi.generator" version "5.3.1"
id 'airbyte-python'
id 'airbyte-docker'
}
airbytePython {
moduleDirectory 'octavia_cli'
}
task generateApiClient(type: GenerateTask) {
inputSpec = "$rootDir.absolutePath/airbyte-api/src/main/openapi/config.yaml"
outputDir = "$projectDir/airbyte_api_client"
generatorName = "python"
packageName = "airbyte_api_client"
}
Works as expected when using $buildDir in the outputDir path:
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask
plugins {
id "org.openapi.generator" version "5.3.1"
id 'airbyte-python'
id 'airbyte-docker'
}
airbytePython {
moduleDirectory 'octavia_cli'
}
task generateApiClient(type: GenerateTask) {
inputSpec = "$rootDir.absolutePath/airbyte-api/src/main/openapi/config.yaml"
outputDir = "$buildDir/airbyte_api_client"
generatorName = "python"
packageName = "airbyte_api_client"
}
Related issues/PRs
@HenningWaack PR's https://github.com/OpenAPITools/openapi-generator/pull/6716 introduced support for incremental build.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Gradle plugin's GenerateTask and the incremental-build support introduced by PR 6716. Reproduce the build.gradle examples with outputDir outside and inside $buildDir, then trace how outputs are tracked. Done means the task is UP-TO-DATE outside $buildDir when the input specification is unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100