A lot of libraries/frameworks use some kind of code generator to convert easy-to-read IDL files into source code. A few that I've used with C++ projects include:
Using CMake, it's relatively straightforward to set up a custom target for running the code generator and make the application target depend on it, so that the generator will be re-run automatically if the IDL file changes.
Now, I need to do the same thing for an Android application, and I'm not finding much help for this online. The closest question I found on this site was:
But the OP for that question just wanted to run the code generator manually and include it in his project. I've already figured out how to do that, now I want Android Studio/Gradle do it for me.
To make the question more concrete, I'm currently running this command to generate FacialRecognitionContext.java
from the file FacialRecognition.sm
:
$ java ./smc/bin/Smc.jar -java FacialRecognition.sm
How can I instruct Gradle to do this for me automatically whenever FacialRecognition.sm
changes?
UPDATE
Further searching led to this SO question and this tutorial, both of which seem to imply that the 'best'(?) way to handle .proto
files is using the Protobuf Plugin for Gradle. I have to say, this is rather vexing. When I look at the sources for the protobuf plugin, I see that it contains nine Groovy files(?!) Do I really need to write an entire SMC plugin just to generate a single file?