People who do many modules, do you group them under folders, i.e payment/api, ui or put everything...
u
People who do many modules, do you group them under folders, i.e payment/api, ui or put everything in root and create hierarchy via dashes? i.e. payment-api, payment-ui etc
📁 4
d
Typically flat here, normally within a
subprojects
directory - makes working with the project easier I find, and IIRC parent directories are implicit parent projects
I also typically do something like this:
Copy code
import groovy.io.FileType

rootProject.name = "myproject"

file('subprojects').eachFile(FileType.DIRECTORIES) {
    def dirName = it.name
    def projectName = "${rootProject.name}-$dirName"

    include projectName

    def project = project(":$projectName")
    project.projectDir = new File(rootProject.projectDir, "subprojects/$dirName")
    project.buildFileName = "${dirName}.gradle"
}
Means you’re not presented by a wall of
build.gradle
files when you’re trying to open them in the IDE or whatever
Also a good idea to camelcase the project names, removing the hyphens - works better for Gradle autocomplete at the command line - but that takes more work to retain the hyphenated names for archives etc. so it’s a bit of a tradeoff
(These are all things that https://github.com/gradle/gradle/ does incidentally)
u
so youre saying this?
Copy code
subprojects/payment-api
subprojects/payment-impl
subprojects/payment-ui

etc?
what bothers me about the folder is that, say the payment-ui needs to be used by 2 apps, then what, create a folder per app, or just stick a suffix like
payment-ui-app1
?
and if it were folder then they need to move physically and the gif diff is giant then
-- also for me it seems gradle doesnt like the folder, since I need to make the names unique globally, the path it self is not enought -> i.e. it should be
payment/api
, however im forced to name it
payment/payment-api
if there are more like say
user/api
, so
user/user-api
@danny yea Im trying to folder it, and its fighting me a lot, intellij that is
puts brackets with hyphented path next to my folder/module name etc, stupid
but I really dont see the point of this its just reinvented folders
folders mostly work, but it cries a lot when the leaf module has the same name in different folder, for example
project1/app
,
project2/app
-- it automagically displays it at project1-app etc, but only on those which are duplicated, inconsitency maddens me