I have the following project structure
-->Starnderd Location
-->Project1
-->settings.gradle
-->build.gradle
Building up on earlier answers this is what I came out with.
interface Includer {
def include(String... args)
}
def applyFrom(String folder) {
apply from: folder + '/settings.gradle'
def includer = [
include: { args ->
args.each {
project(it.startsWith(':') ? it : ':' + it).projectDir =
new File(rootDir, folder + "/" + (it.startsWith(':') ? it.substring(1) : it).replace(':', '/'))
}
}] as Includer
apply from: folder + '/settings.gradle', to: includer
}
applyFrom('A')
applyFrom('B')
The advantage is no duplication.