-
Notifications
You must be signed in to change notification settings - Fork 1
/
opendaylight-dependencies.groovy
51 lines (38 loc) · 1.47 KB
/
opendaylight-dependencies.groovy
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
/** Determines all dependencies of customized OpenDaylight modules used by NETEMU.
<p> This should be used to update ./opendaylight-dependencies.txt -- whose contents are dynamically added as dependencies in
./build.gradle -- so the customized OpenDaylight modules themselves can be bundled in netemu-*.jar library releases.
*/
final DEPENDENCIES = new HashSet<String>()
def startConsidering = false
def considerLine = false
for (final line in ['gradle', '--quiet', 'dependencies'].execute().inputStream.readLines()) {
/*
if (!startConsidering) {
if (line =~ /^compileClasspath/) {
startConsidering = true
}
continue
}
*/
if (line =~ /^\+.+-ADVA$/) {
considerLine = true // ==> Following lines are applicable
continue
}
if (line =~ /^\+/) {
considerLine = false // ==> Following lines are inapplicable
continue
}
if (line =~ /^\s*$/) { // ==> Finished compileClasspath
considerLine = false // ==> Following lines are inapplicable
continue
}
// Collect non-customized dependencies from applicable lines ...
if (considerLine && !(line =~ /-ADVA\W*$/)) {
// DEPENDENCIES.add line.find(/\w\S+/)
final matcher = line =~ /(?<name>\w\S+):(\S+\s+->\s+)?(?<version>\S+)/
if (matcher.find()) {
DEPENDENCIES.add "${matcher.group 'name'}:${matcher.group 'version'}"
}
}
}
DEPENDENCIES.sort() forEach { println it }