Clean openApiGenerate output dir before generating #2502
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Before compiling SolrJ, the gradle build creates an OpenAPI Spec ("OAS") describing our JAX-RS v2 APIs and then uses that spec to generate SolrRequest ".java" files. The responsible task (
solr:solrj:openApiGenerate
) adds newly generated code tosolrj/build/generated
, but it doesn't (by default) wipe the directory at the start of each invocation.This can cause generated files to "leak" across branches - sticking around in
solrj/build/generated
even when the developer has changed to a branch that shouldn't contain the file.These leaks can cause compilation issues, as pointed out by @dsmiley recently on the dev list.
Solution
The solution is to have the
solr:solrj:openApiGenerate
task clear its output directory each time it runs. Luckily the OpenAPI tooling supports this, and it's a one-line change in build.gradle.Tests
Manual build testing.
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.