In my plugin I have defined my own module type, and I want the following external build process for a single module:
- My pre-Java builder
- My post-Java builder
In other words, I want to do something before the Java files are compiled, compile the Java files, and then do something after that.
From this post and this reference I get that I should implement some ModuleLevelBuilders with the right BuilderCategory. I did that, and return then from my overridden BuilderService.createModuleLevelBuilders() method, whose BuilderService class is registered as a service. This seems to work, but only for normal Java projects. My ModuleLevelBuilder's build() method never gets called for modules of my custom module type. How can I get my ModuleLevelBuilders to be called with a custom module type?
Alternatively, I tried this: to implement a ModuleBasedTarget and ModuleBasedBuildTargetType, and use a TargetBuilder to execute my build. Its build() method gets called as expected, but I don't know how I can execute a Java build before executing my post-java TargetBuilder, and more importantly, execute my pre-Java TargetBuilder before the Java build.
Any help or pointers are greatly appreciated.