forked from QuiltMC/quilt-loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
239 lines (189 loc) · 5.7 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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
plugins {
id "java-library"
id 'idea'
id 'eclipse'
id 'maven-publish'
id("org.cadixdev.licenser") version "0.5.0"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
archivesBaseName = "quilt-loader"
def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
repositories {
mavenCentral()
maven {
name = 'Quilt'
url = 'https://maven.quiltmc.org/repository/release'
}
maven {
name = 'Mojang'
url = 'https://libraries.minecraft.net/'
}
}
dependencies {
// TODO: Remove when we bump major version
api("com.google.code.gson:gson:2.8.0")
// FIXME: Match logger from MC for now until we detach from it
implementation("org.apache.logging.log4j:log4j-api:2.14.1")
implementation("org.apache.logging.log4j:log4j-core:2.14.1")
implementation("org.ow2.asm:asm:$project.asmVersion")
implementation("org.ow2.asm:asm-analysis:$project.asmVersion")
implementation("org.ow2.asm:asm-commons:$project.asmVersion")
implementation("org.ow2.asm:asm-tree:$project.asmVersion")
implementation("org.ow2.asm:asm-util:$project.asmVersion")
// ASM is required for the mixin annotation processor
annotationProcessor("org.ow2.asm:asm:$project.asmVersion")
annotationProcessor("org.ow2.asm:asm-analysis:$project.asmVersion")
annotationProcessor("org.ow2.asm:asm-commons:$project.asmVersion")
annotationProcessor("org.ow2.asm:asm-tree:$project.asmVersion")
annotationProcessor("org.ow2.asm:asm-util:$project.asmVersion")
implementation("org.quiltmc:sponge-mixin:$project.mixinVersion") {
exclude module: "launchwrapper"
exclude module: "guava"
}
implementation("org.quiltmc:quilt-json5:$project.json5Version") // TODO: shadow me
implementation("org.quiltmc:tiny-mappings-parser:$project.tinyMappingsParserVersion")
implementation("org.quiltmc:tiny-remapper:$project.tinyRemapperVersion")
implementation("org.quiltmc:access-widener:$project.accessWidenerVersion")
implementation("com.google.jimfs:jimfs:$project.jimfsVersion") {
exclude module: "guava"
}
// FIXME: Shadow this in jimfs
implementation("com.google.guava:guava:21.0")
implementation("org.quiltmc:quilt-loader-sat4j:$project.sat4jVersion")
// launchwrapper + dependencies
implementation("net.minecraft:launchwrapper:$project.launchwrapperVersion") {
transitive = false
}
implementation("net.sf.jopt-simple:jopt-simple:$project.joptsimpleVersion")
testCompileOnly("org.jetbrains:annotations:$project.jbAnnotationsVersions")
// Unit testing
testImplementation(platform("org.junit:junit-bom:$project.junitVersion"))
testImplementation("org.junit.jupiter:junit-jupiter")
}
test {
useJUnitPlatform()
}
processResources {
inputs.property "version", project.version
filesMatching("fabric.mod.json") {
expand "version": project.version
}
}
java {
withJavadocJar()
withSourcesJar()
}
jar {
manifest {
attributes (
"Main-Class": "org.quiltmc.impl.launch.server.QuiltServerLauncher"
)
}
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
}
}
task copyJson(type: Copy, dependsOn: ["jar"]) {
from('src/main/resources/quilt-installer.json') {
rename { "${archivesBaseName}-${version}.json" }
}
into 'build/libs'
}
task copyJsonLw(type: Copy, dependsOn: ["jar"]) {
from('src/main/resources/quilt-installer.launchwrapper.json') {
rename { "${archivesBaseName}-${version}.launchwrapper.json" }
}
into 'build/libs'
}
tasks.build.dependsOn "copyJson"
tasks.build.dependsOn "copyJsonLw"
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
// Target JDK 8
if (JavaVersion.current().isJava9Compatible()) {
it.options.release = 8
}
}
javadoc {
options {
if (file("README.html").exists()) {
overview = "README.html"
}
source = "8"
encoding = 'UTF-8'
charSet = 'UTF-8'
memberLevel = JavadocMemberLevel.PACKAGE
links(
'https://asm.ow2.io/javadoc/',
'https://docs.oracle.com/javase/8/docs/api/',
'https://logging.apache.org/log4j/2.x/log4j-api/apidocs/'
)
// Disable the crazy super-strict doclint tool in Java 8
addStringOption('Xdoclint:none', '-quiet')
}
source sourceSets.main.allJava.srcDirs
classpath = sourceSets.main.compileClasspath + sourceSets.main.output // compile impl stuff for dep as well
include("**/api/**")
// workaround as one of the api stuff use that package
failOnError = false
}
license {
header file("codeformat/FABRIC-HEADER")
include '**/*.java'
}
publishing {
publications {
mavenJava(MavenPublication) {
// add all the jars that should be included when publishing to maven
artifact(file("${project.buildDir}/libs/$archivesBaseName-${version}.jar")) {
builtBy jar
}
artifact(sourcesJar) {
builtBy sourcesJar
}
artifact javadocJar
artifact(file('src/main/resources/quilt-installer.json')) {
builtBy jar
}
artifact(file('src/main/resources/quilt-installer.launchwrapper.json')) {
builtBy jar
classifier = "launchwrapper"
}
}
}
repositories {
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}
// Refresh meta after publish
tasks.register("refreshMeta", RefreshMetaTask)
class RefreshMetaTask extends DefaultTask {
@TaskAction
void doTask() {
def ENV = System.getenv()
if (ENV.META_UPDATE_URL) {
logger.lifecycle("Refreshing meta")
URL url = new URL(ENV.META_UPDATE_URL)
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.requestMethod = "GET"
try (InputStream _ = connection.inputStream) {
}
if (connection.responseCode != 200) {
throw GradleException("Failed to refresh meta server")
}
logger.lifecycle("Meta refresh done")
} else {
logger.lifecycle("META_UPDATE_URL not specified, not refreshing meta")
}
}
}