Morgan Pittkin
12/07/2021, 6:18 PMinternal
in each layer should only be visible to other code in that layer (and its corresponding test sourceSet).
Code outside of the module (jar) should only be able to see public code in the infrastructure layer. That is what comprises the public API for the whole jar file, and it is tiny. Just a couple of extension functions, interfaces, and classes.
The compilation should result in only a single jar file.
Is that something I can get working with sourceSets? Would JPMS modules be a better fit? I've never played around with JPMS, and I'm still learning Gradle.
I know I can mostly achieve this by just extracting the layers into their own projects, but then it's hard to enforce the encapsulation because other projects can simply declare a dependency on those. I considered using a composite build but then I can't share dependencies or convention plugins between the components. We aren't a huge team, so it wouldn't be the end of the world, but if I can come up with a better solution then that would be ... better!
Thanks a lot,
Morgan