-
Notifications
You must be signed in to change notification settings - Fork 81
/
settings.gradle
51 lines (46 loc) · 1.5 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
include ':pluglib', ':common_ui'
void scanProject(def settings, File dir) {
if (dir == null || !dir.isDirectory())
return;
File[] files = dir.listFiles();
for (File file : files) {
if (file.isFile() && "build.gradle".equals(file.name)) {
if (isPlugBuildFile(file)) {
String projectPath = file.absolutePath.substring(file.absolutePath.indexOf("plugProject") - 1);
projectPath = projectPath.substring(0, projectPath.indexOf("build.gradle") - 1)
projectPath = projectPath.replace(File.separator, ':')
println("include project : " + projectPath)
settings.include(projectPath)
}
return;
}
}
for (File file : files) {
if (file.isDirectory()) {
scanProject(settings, file);
}
}
}
boolean isPlugBuildFile(File file) {
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(file));
String lineStr = null;
while ((lineStr = reader.readLine()) != null) {
if (lineStr.contains("plug.gradle") || lineStr.contains("com.android.library")) {
return true;
}
}
} catch (IOException e) {
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e1) {
}
}
}
return false;
}
def plugProject = new File("plugProject")
scanProject(settings, plugProject);