-
Notifications
You must be signed in to change notification settings - Fork 2
/
settings.gradle
55 lines (47 loc) · 1.71 KB
/
settings.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import groovy.io.FileType
import groovy.io.FileVisitResult
def discoveredProjects = [:] as Map<String, File>
ext {
// To explicitly define sub-project folders, name them in the array like this
niagaraRoots = ['linkster-rt', 'linkster-wb']
// CONFIGURE any directories to exclude from search for nested sub-projects
excludeDirs = ['.git', 'build', 'out', 'src', 'srcTest']
}
// OR set the 'userRepos' gradle property.
//
if (hasProperty('userRepos')) {
settings.ext.niagaraRoots += userRepos.split(",").collect()
}
// my-settings.gradle.
//
def mySettings = file('my-settings.gradle')
if (mySettings.exists()) {
apply from: mySettings
}
// DO NOT MODIFY the niagaraRoots configuration
niagaraRoots.collect({ file(it) }).findAll({ it.exists() }).each { File projectRoot ->
projectRoot.traverse(
type: FileType.DIRECTORIES,
preRoot: true,
preDir: { File projectDir ->
def projectName = projectDir.name
if (excludeDirs.contains(projectName)) {
return FileVisitResult.SKIP_SUBTREE
}
File buildScript = new File(projectDir, "${projectName}.gradle")
if (buildScript.exists()) {
discoveredProjects[projectName] = projectDir
include projectName
return FileVisitResult.SKIP_SUBTREE
}
}
)
}
// Set rootProject.name for your project
rootProject.name = 'linkster'
rootProject.children.each { project ->
project.projectDir = discoveredProjects[project.name]
project.buildFileName = "${project.name}.gradle"
assert project.projectDir.isDirectory()
assert project.buildFile.isFile()
}