The architecture of our system is a little messy. We have a big ball of mud that consists of ~8 clearly different components which, unfortunately, all have to be compiled together. (There are lots of hairy dependency cycles. We want to fix them, but we want a sane build system first.)
I’d like to be able to specify those 8 distinct components as sourceSets, even though they do not compile independently (yet). If I have to specify one giant sourceSet for the whole ball-of-mud, then 1) it’ll be huge and 2) it’ll be hard to remember where we want to draw the lines between those 8 components when it comes time to fix the dependency cycles.
My general feeling is that this will create another ball of mud. Without knowing your specific situation, I think I’d rather have just one source set and draw the component boundaries by structuring the build script(s) accordingly.
But I’m having trouble with the exclusions. You see, for most of those components, I want to exclude ‘**/Mock*.java’, but for one particular component I need to include those files.
But that resulted in an empty sourceSet, which made perfect sense once I read the fine documentation for PatternFilterable (which sset.java is an instance of). OK, fair enough.
(Since component3 and component7 are actually the only ones with any Mock*.java files to exclude; in principal I should list all components except component5 here, but I’m lazy.)
That just plain does not work.The 3 source files that match those two exclusion patterns are included in the sourceSet anyways, making the build fail.
Obviously this isn’t “real”, but I wanted to see if maybe there was a wildcard problem. But this still doesn’t work; Gradle tries to compile those three files regardless.
1 and 2 don’t match the full source file path, but 3 and 4 look fine. Without a reproducible example, it’s hard for me to say what the problem is. Maybe the files are getting compiled by a compile task other than compileMudJava ( e.g. compileTestJava)?
This should be done as a mutli-module build, not a single module as you are attempting. Each ‘component’ should be in a separate module. You can have dependencies between the modules and gradle will build the individual modules (jars) in the correct order.
Once you have the individual modules building their separate jars, you can create an uber-jar module which builds a jar for all the components. This can be done using shadow