include(":core") // Load all modules under /lib File(rootDir, "lib").eachDir { include("lib:${it.name}") } // Load all modules under /lib-multisrc File(rootDir, "lib-multisrc").eachDir { include("lib-multisrc:${it.name}") } // Local development (full project build) include(":multisrc") project(":multisrc").projectDir = File("multisrc") loadAllIndividualExtensions() loadAllGeneratedMultisrcExtensions() fun loadAllIndividualExtensions() { File(rootDir, "src").eachDir { dir -> dir.eachDir { subdir -> val name = ":extensions:individual:${dir.name}:${subdir.name}" include(name) project(name).projectDir = File("src/${dir.name}/${subdir.name}") } } } fun loadAllGeneratedMultisrcExtensions() { File(rootDir, "generated-src").eachDir { dir -> dir.eachDir { subdir -> val name = ":extensions:multisrc:${dir.name}:${subdir.name}" include(name) project(name).projectDir = File("generated-src/${dir.name}/${subdir.name}") } } } fun File.eachDir(block: (File) -> Unit) { val files = listFiles() ?: return for (file in files) { if (file.isDirectory && file.name != ".gradle" && file.name != "build") { block(file) } } }