-
Notifications
You must be signed in to change notification settings - Fork 18
/
build.gradle
212 lines (177 loc) · 4.74 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
plugins {
id "com.diffplug.spotless" version "6.22.0" apply false
id "me.modmuss50.remotesign" version "0.4.0" apply false
}
def ENV = System.getenv()
allprojects {
apply plugin: "java"
apply plugin: "java-library"
apply plugin: "maven-publish"
apply plugin: "checkstyle"
apply plugin: "com.diffplug.spotless"
apply plugin: "me.modmuss50.remotesign"
group "net.fabricmc"
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 8
}
checkstyle {
configFile = rootProject.file("checkstyle.xml")
toolVersion = project.checkstyle_tool_version
}
repositories {
mavenCentral()
}
dependencies {
compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
testImplementation "net.neoforged:srgutils:${srgutils_version}"
testImplementation "org.cadixdev:lorenz:${lorenz_version}"
testImplementation "org.cadixdev:lorenz-io-enigma:${lorenz_version}"
testImplementation "org.cadixdev:lorenz-io-jam:${lorenz_version}"
testImplementation "org.junit.jupiter:junit-jupiter:${junit_jupiter_version}"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
testCompileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
}
spotless {
java {
licenseHeaderFile(rootProject.file("HEADER")).yearSeparator(", ")
targetExclude 'src/test/java/net/fabricmc/mappingio/lib/**/*.java',
'src/main/java/net/fabricmc/mappingio/tree/AlphanumericComparator.java'
}
}
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
test {
useJUnitPlatform()
}
javadoc {
failOnError = false
options {
// Disable the crazy super-strict doclint tool in Java 8
addStringOption('Xdoclint:none', '-quiet')
}
}
assemble.dependsOn javadocJar
if (ENV.SIGNING_SERVER) {
remoteSign {
requestUrl = ENV.SIGNING_SERVER
pgpAuthKey = ENV.SIGNING_PGP_KEY
jarAuthKey = ENV.SIGNING_JAR_KEY
sign (jar, sourcesJar, javadocJar)
afterEvaluate {
sign publishing.publications.mavenJava
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
if (ENV.SIGNING_SERVER) {
artifact(signJar.output) {
classifier null
builtBy signJar
}
artifact(signSourcesJar.output) {
classifier "sources"
builtBy signSourcesJar
}
artifact(signJavadocJar.output) {
classifier "javadoc"
builtBy signJavadocJar
}
} else {
from components.java
}
pom {
name = base.archivesName.get()
description = 'A library for working with mapping files.'
url = 'https://github.com/FabricMC/mapping-io'
scm {
connection = "scm:git:https://github.com/FabricMC/mapping-io.git"
developerConnection = "scm:git:git@github.com:FabricMC/mapping-io.git"
url = "https://github.com/FabricMC/mapping-io"
}
issueManagement {
system = "GitHub"
url = "https://github.com/FabricMC/mapping-io/issues"
}
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
developers {
developer {
id = "modmuss50"
name = "modmuss50"
email = "modmuss50@fabricmc.net"
}
developer {
id = "sfPlayer"
name = "Player"
email = "player@fabricmc.net"
}
}
}
}
}
repositories {
mavenLocal()
if (ENV.MAVEN_URL) {
repositories.maven {
name "fabric"
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
if (ENV.MAVEN_CENTRAL_URL) {
repositories.maven {
name "central"
url ENV.MAVEN_CENTRAL_URL
credentials {
username ENV.MAVEN_CENTRAL_USERNAME
password ENV.MAVEN_CENTRAL_PASSWORD
}
}
}
}
}
}
base {
archivesName = "mapping-io"
}
jar {
manifest {
attributes("Automatic-Module-Name": "net.fabricmc.mappingio")
}
}
tasks.register("generateTestMappings", JavaExec) {
dependsOn("testClasses")
classpath = sourceSets.test.runtimeClasspath
mainClass = 'net.fabricmc.mappingio.TestFileUpdater'
}
tasks.register("updateTestMappings", Copy) {
dependsOn("generateTestMappings")
from 'build/resources/test/'
into 'src/test/resources/'
}
// A task to ensure that the version being released has not already been released.
tasks.register("checkVersion") {
doFirst {
def xml = new URL("https://maven.fabricmc.net/net/fabricmc/mapping-io/maven-metadata.xml").text
def metadata = new XmlSlurper().parseText(xml)
def versions = metadata.versioning.versions.version*.text();
if (versions.contains(version)) {
throw new RuntimeException("${version} has already been released!")
}
}
}
publish.mustRunAfter checkVersion