First class support for code generation in all types of projects

(Dimitar Dimitrov) #1

Looking at the release notes for Gradle 1.11, I noticed the code generation support for native projects. Are there any plans to implement this functionality for Java projects as well?

Ideally, this would take the shape of allowing generatedBy clause to be attached to Java source-set definitions, which would trigger the generating task.

In addition, right now it is not clear whether in the case of native codegen, the generator task needs to be in the same project or can be in different project. If the latter, how would that work with the parallel builds?


Yes, once the model for generated source sets has solidified a little, the plan is to roll it out to other language domains as well.

While untested, it’s theoretically possible to use ‘generatedBy’ for java sources by accessing the ‘’ via something like ‘’. Note that this uses a new, incubating DSL for source sets, but the underlying ‘org.gradle.api.file.SourceDirectorySet’ should be the same (at least it is at present).