I believe the 59.4 Gradle doc section may help you.
Using Gradle 1.8, I tried "running another Gradle construct from an assembly", where another Gradle assembly is buildSrc.
This does not apply to codegen, but may be enough to help.
For replication, I have a simple Java project in buildSrc, with build.gradle, which looks like this:
apply plugin: 'java' build << { println "TRACER: hello from buildSrc java build" } task compile2() << { println "TRACER: hello from buildSrc compile2" }
The build task is called automatically through the buildSrc mechanism. The goal is to call 'compile2' from the root. In the root, build.gradle looks like this:
task build1() << { println "TRACER: top-level build1" } task build2(type: GradleBuild) { buildFile = 'buildSrc/build.gradle' tasks = ['compile2'] } build2.dependsOn build1
At the root level, the output is as follows:
$ gradle build2 :buildSrc:compileJava etc etc TRACER: hello from buildSrc java build TRACER: top-level build1 TRACER: hello from buildSrc compile2
This shows that:
- compiled Java project in buildSrc
- the root 'build1' is called (compile your main project here)
- buildSrc 'compile2' is called
The pathpath and codegen classes are nasty, but can be straightforward.
source share