[core] Share DefaultGenerator's "file was written" step in one helper
Refactor only; no generated output changes.
DefaultGenerator repeated the same block in eleven places after writing a file: add it to the list of generated files and, unless this is a dry run, pass it to config.postProcessFile with its file type. This replaces those copies with a private addGeneratedFile(files, written, fileType).
PR checklist
- Read the contribution guidelines.
- Run the following to build the project and update samples:
(For Windows users, please run the script in WSL)./mvnw clean package || exit ./bin/generate-samples.sh ./bin/configs/*.yaml || exit ./bin/utils/export_docs_generators.sh || exit
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*.
IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed. - If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
Summary by cubic
Refactors DefaultGenerator so the "file was written" step (adding the file to the generated list and calling postProcessFile unless it's a dry run) lives in a single private addGeneratedFile helper instead of being duplicated across eleven call sites. The generateVersionMetadata path keeps its own block because it tracks a different File instance. No generated output changes. Adds two tests: one verifying the file type passed to postProcessFile for models, APIs, and supporting files, and one confirming postProcessFile is skipped during dry runs.