We have a legacy application and legacy build tool we are using to build both our native and Java code. For Java, we tied “JMake” into our build tool, however, it is no longer maintained, does not support JDK 9 and above, and we’re needing to move to Java 9 / 10 / 11.
In our environment, we have “baseline” builds (with full source code) and the developers use “sparse work areas” (only the code they are changing).
I’ve figured out how to get Gradle to find the source files (by giving the required srcDirs and using include “seta/setb/foo/**/*.java”) and that works okay, but when I give both the baseline src area and the developer src are, I get complaints about classes being duplicated.
So, it seems to me that I need to write a plugin that adapts the “java” plugin so that it understand our model and only takes the first java file with a given name that it finds. In other words, when given these areas to search for source files, with “MyFile.java” in both, only the developer’s file should be used:
/developer/src/com/slb/test/MyFile.java <== should be used
/baseline/build-01/src/com/slb/test/MyFile.java <== should be ignored
[it is possible to have multiple layers, all of which may have a MyFile.java; in all cases only the “first” should be used. e.g. /developer/src, /baseline/build-03, /baseline/build-02, /baseline/build-01 – effectively stacked incremental build areas]
- am I correct that I need a special plugin for this because I cannot just give the java plugin a list of files to build?
- if so, can I extend the “java” plugin?
… or must I duplicate all the code from it and then make the changes I need? [I really don’t want to do that]
Alternatively, we already have an Ant-based class that understands the above “search path” model (called GFileSet based on Ant’s FileSet), but I don’t see how I can get this to the java plugin so it will be used instead of the conventional “include **/*.java”.