forked from QuiltMC/quilt-standard-libraries
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
107 lines (92 loc) · 2.76 KB
/
build.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import qsl.internal.Versions
plugins {
id("maven-publish")
id("qsl.common")
}
group = "org.quiltmc.qsl"
version = Versions.QSL_VERSION + (System.getenv("SNAPSHOTS_URL") ? "-SNAPSHOT" : "")
sourceSets {
testmod {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
}
}
// The root project simply just publishes all artifacts.
// For that reason, do not generate a remapped jar.
remapJar {
enabled = false
}
jar {
enabled = false
}
publishing {
publications {
mavenJava(MavenPublication) {
pom.withXml {
def depsNode = asNode().appendNode("dependencies")
rootProject.subprojects.stream().filter {
it.path.count(':') == 1
}.forEach {
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", it.group)
depNode.appendNode("artifactId", it.name)
depNode.appendNode("version", it.version)
depNode.appendNode("scope", "compile")
}
}
}
}
}
// Because we rely on the results of our libraries, we use afterEvaluate to setup the sourcesets and testmod tasks.
afterEvaluate {
// Add sourceSet dependencies on all libraries
// Make this project include the compileClasspath and runtimeClasspath of the libraries.
subprojects.stream().filter {it.path.count(":") == 1 }.each {
project.sourceSets.main.compileClasspath += it.sourceSets.main.compileClasspath
project.sourceSets.main.runtimeClasspath += it.sourceSets.main.runtimeClasspath
project.sourceSets.testmod.compileClasspath += it.sourceSets.testmod.compileClasspath
project.sourceSets.testmod.runtimeClasspath += it.sourceSets.testmod.runtimeClasspath
}
}
loom {
runs {
testmodClient {
client()
configName = "Testmod Client"
source(project.sourceSets.testmod)
}
testmodServer {
server()
configName = "Testmod Server"
source(project.sourceSets.testmod)
}
// Auto test server, a server is ran for a few seconds and testmods run to verify things such as mixin
// application function properly.
// This task is typically ran by the CI server.
autoTestServer {
server()
configName = "Auto test server"
source(project.sourceSets.testmod)
property("quilt.autoTest")
programArg("--nogui")
}
}
}
task checkVersion {
doFirst {
try {
def xml = new URL("https://maven.quiltmc.org/repository/release/org/quiltmc/qsl/maven-metadata.xml").text
def metadata = new groovy.xml.XmlSlurper().parseText(xml)
def versions = metadata.versioning.versions.version*.text()
if (versions.contains(version)) {
throw new RuntimeException("${version} has already been released!")
}
} catch (FileNotFoundException ignored) {
// No existing version of library found
}
}
}
project.getTasksByName("checkLibVersion", true).each {
checkVersion.dependsOn it
}
publish.dependsOn checkVersion