-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsettings.gradle.kts
68 lines (62 loc) · 2.54 KB
/
settings.gradle.kts
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
rootProject.name = "FastScript"
/**
* @author Score2
* @version 1.2
*/
class MergeBuilder {
val nodes: MutableList<String>
constructor(vararg nodes: String): this(nodes.toMutableList())
constructor(nodes: MutableList<String>) {
this.nodes = nodes
}
constructor(merge: MergeBuilder, vararg addNodes: String): this(merge.nodes, addNodes.toMutableList())
constructor(merge: MergeBuilder, addNodes: MutableList<String>): this(merge.nodes, addNodes)
constructor(nodes: MutableList<String>, vararg addNodes: String): this(nodes, addNodes.toMutableList())
constructor(nodes: MutableList<String>, addNodes: MutableList<String>) {
this.nodes = nodes.also { it.addAll(addNodes) }
}
fun add(vararg addNodes: String) = add(addNodes.toMutableList())
fun add(addNodes: MutableList<String> = mutableListOf()) {
val editedList = mutableListOf<String>().also { it.addAll(nodes); it.addAll(addNodes) }
val finallyNode = java.lang.StringBuilder()
for (i in 0 until editedList.size) {
finallyNode.append(":${editedList[i]}")
}
include(finallyNode.toString())
}
fun merge(vararg addNodes: String) = merge(addNodes.toMutableList())
fun merge(addNodes: MutableList<String> = mutableListOf()): MergeBuilder {
val editedList = mutableListOf<String>().also { it.addAll(nodes); it.addAll(addNodes) }
val finallyNode = java.lang.StringBuilder()
for (i in 0 until editedList.size) {
val currentNode = java.lang.StringBuilder()
for (j in 0..i) {
currentNode.append(if (currentNode.isEmpty()) editedList[j] else "-${editedList[j]}")
// println(" j $currentNode")
}
if (currentNode.isNotEmpty())
finallyNode.append(":$currentNode")
// println("i $finallyNode")
}
include(finallyNode.toString())
return this
}
fun newBuilder(vararg addNodes: String): MergeBuilder = newBuilder(addNodes.toMutableList())
fun newBuilder(addNodes: MutableList<String>): MergeBuilder {
return MergeBuilder(nodes, addNodes)
}
}
inline fun setupSubproject(name: String, block: ProjectDescriptor.() -> Unit) {
include(name)
project(":$name").apply(block)
}
setupSubproject("FastScript-common") {
projectDir = file("common")
}
MergeBuilder("version-control").also {
it.add("FastScript-bukkit")
it.add("FastScript-bungee")
it.add("FastScript-sponge")
it.add("FastScript-velocity")
it.add("FastScript-nukkit")
}