-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsettings.gradle
45 lines (37 loc) · 1004 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
40
41
42
43
44
45
// include holder project for gretty
include 'jetty'
project(':jetty').setProjectDir(file('target/jetty'))
// dynamically discovered app modules
for (app in findApps(file('.'), 0)) {
include toFullProjectName(app.parentFile, app.name)
}
def findApps(File currentDir, int level) {
def apps = [];
if (level >= 2) {
return apps;
}
currentDir.eachFile() { f ->
if (!f.isDirectory()) { /* ignore */ }
else if (f.name == 'buildSrc') { /* ignore */ }
// check if the module is an app folder
else if (isAppDir(f)) {
apps << f;
} else {
apps.addAll(findApps(f, level+1));
}
}
return apps
}
def isAppDir(File dir) {
if (!dir.isDirectory()) {
return false;
}
if (!(new File(dir, 'plugin.properties').isFile())) {
return false;
}
return true;
}
def toFullProjectName(File parentFolder, String projectName) {
String relPath = rootProject.projectDir.toPath().relativize(parentFolder.toPath()).toString();
relPath.replace('/', ':').replace('\\', ':') + ':' + projectName
}