forked from FabricMC/mapping-io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
183 lines (153 loc) · 3.56 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
plugins {
id "java"
id "java-library"
id "checkstyle"
id "maven-publish"
id "com.diffplug.spotless" version "5.8.2"
id "me.modmuss50.remotesign" version "0.4.0"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
group "net.fabricmc"
archivesBaseName = "mapping-io"
def ENV = System.getenv()
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 8
}
}
checkstyle {
configFile = project.file("checkstyle.xml")
toolVersion = project.checkstyle_tool_version
}
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
mavenCentral()
}
dependencies {
implementation "org.ow2.asm:asm:${project.asm_version}"
compileOnly "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
implementation "net.fabricmc:tiny-remapper:${tiny_remapper_version}"
}
spotless {
java {
licenseHeaderFile(rootProject.file("HEADER")).yearSeparator(", ")
}
}
java {
withSourcesJar()
withJavadocJar()
}
jar {
manifest {
attributes("Automatic-Module-Name": "net.fabricmc.mappingio")
}
}
javadoc {
failOnError = false
}
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 = 'mapping-io'
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:[email protected]: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 = "[email protected]"
}
developer {
id = "sfPlayer"
name = "Player"
email = "[email protected]"
}
}
}
}
}
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
}
}
}
}
}
// A task to ensure that the version being released has not already been released.
task 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