So after I have done the compilation of my core subproject, I have a code generator (just compiled) that needs to run, and then that class compiled in as well. It’s probably easiest to do this as a separate subproject, but I would prefer to have it live in the same directory with all the core source.
So, question one is, can I have two subprojects that live in the same directory? (One is a subdirectory of the other.)
If not, this is close to what I want to do, but I haven’t got the dependencies right, and the classpath is wrong as well. I want it to be able to use the classes just compiled in the compileJava step. I thought classpath=configurations.runtime would do that, but it doesn’t have the newly compiled classes in there, just the libraries it needs.
So the coercionGenerate task is supposed to run the code generator just compiled in by compileJava, but my runtime isn’t correct, and the inputs and outputs aren’t triggering this task to run as I would have expected it to.
task coercionGenerate(type: JavaExec, dependsOn:compileJava) {
inputs.file file('src/main/java/com/temboo/arcturus/util/CoercionGeneratorTask.java')
outputs.file file('src/main/java/com/temboo/arcturus/coercion/TypeCoercion.java')
main = 'com.temboo.arcturus.util.CoercionGeneratorTask'
classpath = configurations.runtime
args = [file('src/main/java/com/temboo/arcturus/coercion/TypeCoercion.java')]
}
This second task is supposed to depend on the above task, and compile the one file which it created, with the .class file going where all the other classfiles went during compileJava.
task coercionCompile(type:JavaCompile, dependsOn:coercionGenerate) {
inputs.file file('src/main/java/com/temboo/arcturus/coercion/TypeCoercion.java')
classpath = configurations.runtime
source = file('src/main/java/com/temboo/arcturus/coercion/TypeCoercion.java')
}
Is there an easy way to make this work or do I really need to do surgery and make this a bonafide subproject?
Thanks,
Monty