Skip to content
This repository has been archived by the owner on Nov 23, 2024. It is now read-only.

False usage of gradle cache on new code generator version #290

Open
NilsDammenhayn opened this issue Jan 8, 2022 · 1 comment
Open

False usage of gradle cache on new code generator version #290

NilsDammenhayn opened this issue Jan 8, 2022 · 1 comment
Labels

Comments

@NilsDammenhayn
Copy link

NilsDammenhayn commented Jan 8, 2022

I'm running a service with two gradle modules - service and model - where the model only contains the code generation to leverage the usage of gradle cache in builds. If the version of the used generator changes the models are not freshly generated but taken from the cache, although the task has no way of knowing if the new sources will be the same as the old ones.

This can lead to breaking later builds although the initial build that updated the generator looked fine.

A workaround is to define this version as an additional property but imho this should not be necessary as the plugin can never assume anything about the sources generated by a new version. So this version should always be part of the tasks inputs to influence the gradle cache's key.

To Reproduce:
Build a module with any code generator -> change version of said generator -> building again will take the results from the gradle cache instead of creating new sources.

Expected behavior:
Sources are freshly generated if the generator version changes.

Environment

Plugin version: 2.19.1
Swagger Codegen version: io.swagger.codegen.v3:swagger-codegen-cli:3.0.30 / io.swagger.codegen.v3:swagger-codegen-cli:3.0.31
Gradle version: 7.3.3
Java version: 11.0.13
OS: macOS Big Sur 11.6.2

@reaver585
Copy link

Bumping this issue since I have run into the same problem recently.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants