-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.gradle
42 lines (35 loc) · 1.1 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
rootProject.name = "whypie"
findModule(rootDir)
def findModule(File directory) {
directory.eachDir { it ->
def gradleFile = new File(it, "build.gradle")
if (gradleFile.exists()) {
includeModule(it)
} else {
findModule(it)
}
}
}
def includeModule(File moduleDir) {
def modulePath = moduleDir.toString()
def moduleName = makeProjectName(
modulePath.substring(
modulePath.indexOf(rootDir.name), modulePath.length()
).substring(rootDir.name.length() + 1)
)
include(moduleName)
project(moduleName).projectDir = moduleDir
println "module include complete => ${moduleName}, ${moduleDir}"
}
def makeProjectName(directoryName) {
def path = ":"
if (System.properties['os.name'].toLowerCase().contains('windows')) {
directoryName.toString().tokenize("\\").each {
path = path.concat("${it}-")
}
} else {
directoryName.toString().tokenize("/").each {
path = path.concat("${it}-") }
}
return path.substring(0, path.length() - 1)
}