-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
settings.gradle
54 lines (44 loc) · 1.42 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
51
52
53
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.6.0'
}
rootProject.name = 'neoform'
ext.versions = [] as Set
def addDirectory(path) {
path.eachDir() {
def relative = rootDir.toPath().relativize(it.toPath()).toFile()
include relative.path
project(':' + relative.path).name = it.name
versions.add(it.name)
}
}
ext.local = new Properties()
if (file('local.properties').exists()) {
local.load(file('local.properties').newDataInputStream())
}
def hasLocalProperty(name) {
return local.containsKey(name) || hasProperty(name)
}
def getLocalProperty(name) {
return local.getProperty(name) ?: getProperty(name)
}
def type = hasLocalProperty('type') ? getLocalProperty('type').toLowerCase() : 'release'
if ('release'.equals(type)) {
addDirectory(new File(rootDir, 'versions/release/'))
} else if ('snapshot'.equals(type)) {
if (hasLocalProperty('ver')) {
addDirectory(new File(rootDir, 'versions/snapshot/' + getLocalProperty('ver')))
} else {
new File(rootDir, 'versions/snapshot/').eachDir() {
addDirectory(it)
}
}
} else if ('pre'.equals(type)) {
if (hasLocalProperty('ver')) {
addDirectory(new File(rootDir, 'versions/pre/' + getLocalProperty('ver')))
} else {
new File(rootDir, 'versions/pre/').eachDir() {
addDirectory(it)
}
}
}
println('Versions: ' + versions)