Custom code generator


I’m trying to port the existing project to Gradle. The project contains
the code generator, written in C++, that emits C++ and Java code.
Generated code is then built using regular tools (gcc, javac, jar)
alongside hand-written code.

I wonder what would be the right Gradle project structure? I’m currently
thinking about splitting it into the following sub-projects:

  • Code generator executable (‘codegen-bin’).
    It will be built using stock ‘cpp’ plugin.
  • Code generator plugin (‘codegen’).
    It will be written in Groovy, and will depend on ‘codegen-bin’.
  • Application code (‘app’).
    It will be built using my ‘codegen’, and stock ‘cpp’ and ‘java’ plugins.

Is this the right direction, or is there a better way to structure the
build scripts?