I have seen various approaches of implementing code generation in Gradle, so I would be interested if there are any best practices about:
- Is it better to generate the output under the sources directory (i.e.
src/main/java-foobar-generated) or under the output (i.e.
- If the generation is driven from a model that is not required at runtime, would you put that as a resource in a separate source-set (i.e.
src/foobar-gen/resources/my-model.txt), or as a directory under existing source sets (i.e.
- What would be a good way to remove stale generated sources (i.e. if the generator provides a list of created files and we want to remove the leftovers)
- Whether the code generation task should extend from
Any tips and pointers to best practices or Gradle facilities that may come in handy, would be appreciated.