forked from Blankj/AndroidUtilCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle
42 lines (37 loc) · 1012 Bytes
/
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
includeModule ':app',
':buildSrc',
':bus-gradle-plugin',
':launcher',
':lib',
':subutil',
':utilcode'
def includeModule(String... names) {
names.each {
def fileName
if (it.startsWith(":")) {
fileName = it.substring(1, it.length())
} else {
fileName = it;
}
File f = file(fileName)
if (!f.exists() || !f.isDirectory()) return
if (isModule(f)) {
include it
} else {
f.eachDir { dir ->
if (!isModule(dir)) return
include "${fileName}-${dir.name}"
project(":${fileName}-${dir.name}").projectDir = dir
}
}
}
}
static boolean isModule(File dir) {
File[] files = dir.listFiles(new FilenameFilter() {
@Override
boolean accept(File file, String name) {
return name == 'build.gradle' || name == 'src'
}
})
return files.size() == 2
}