|
1
2
|
buildscript {
repositories {
|
|
3
|
jcenter()
|
|
4
5
6
7
8
9
10
11
12
13
|
mavenLocal()
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
|
|
14
15
16
17
|
maven {
name = 'sponge'
url = 'http://repo.spongepowered.org/maven'
}
|
|
18
19
|
}
dependencies {
|
|
20
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
|
21
|
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
|
|
22
|
classpath 'org.spongepowered:mixingradle:0.4-SNAPSHOT'
|
|
23
24
25
26
|
}
}
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
|
|
27
|
apply plugin: 'checkstyle'
|
|
28
|
apply plugin: 'maven'
|
|
29
|
apply plugin: 'com.github.johnrengelman.shadow'
|
|
30
31
32
33
|
apply plugin: 'org.spongepowered.mixin'
// Default tasks
defaultTasks 'build'
|
|
34
35
|
ext {
|
|
36
37
|
def isJenkins = project.hasProperty("jenkins")
|
|
38
|
// Artefact details
|
|
39
|
buildNumber = isJenkins ? System.env.BUILD_NUMBER : (project.hasProperty("buildNumber") ? buildNumber : '0')
|
|
40
|
buildVersion = project.hasProperty("buildVersion") ? buildVersion : '0.0'
|
|
41
|
ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
|
|
42
|
commit = isJenkins ? System.env.GIT_COMMIT : (project.hasProperty("commit") ? commit : 'unknown')
|
|
43
44
45
|
classifier = project.hasProperty("buildType") ? buildType : 'SNAPSHOT'
isReleaseBuild = "RELEASE".equals(project.classifier.toUpperCase())
mavenRepo = project.isReleaseBuild ? "mavenUrl" : "mavenSnapshotUrl"
|
|
46
|
brand = isJenkins ? "${project.mcVersion}-SNAPSHOT-r${System.env.GIT_COMMIT.take(7).toUpperCase()}-b${System.env.BUILD_NUMBER}-${System.env.BUILD_ID}" : ""
|
|
47
48
49
50
51
52
53
54
55
|
// Extended project information
projectName = 'LiteLoader'
inceptionYear = '2012'
packaging = 'jar'
startClass = 'com.mumfrey.liteloader.debug.Start'
tweakClass = 'com.mumfrey.liteloader.launch.LiteLoaderTweaker'
}
|
|
56
57
58
59
60
61
62
|
// Basic project information
group = "com.mumfrey"
archivesBaseName = "liteloader"
version = buildVersion + (project.isReleaseBuild ? '' : '-' + project.classifier)
// Minimum version of Java required
|
|
63
64
|
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
|
|
65
|
|
|
66
|
repositories {
|
|
67
|
mavenLocal()
|
|
68
69
70
71
72
73
74
|
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven/'
}
}
dependencies {
|
|
75
76
|
compile 'org.ow2.asm:asm-debug-all:5.2'
compile('org.spongepowered:mixin:0.7.5-SNAPSHOT') {
|
|
77
78
79
80
|
exclude module: 'asm-commons'
exclude module: 'asm-tree'
exclude module: 'launchwrapper'
exclude module: 'guava'
|
|
81
|
exclude module: 'log4j-core'
|
|
82
|
}
|
|
83
84
|
}
|
|
85
86
87
88
89
90
91
92
|
minecraft {
version = project.mcVersion
mappings = project.mcMappings
runDir = "run"
tweakClass = project.tweakClass
}
sourceSets {
|
|
93
|
main {
|
|
94
|
ext.refMap = "mixins.liteloader.core.refmap.json"
|
|
95
|
}
|
|
96
97
|
client {
compileClasspath += main.compileClasspath + main.output
|
|
98
|
ext.refMap = "mixins.liteloader.client.refmap.json"
|
|
99
100
101
102
103
104
|
}
debug {
compileClasspath += client.compileClasspath + client.output
}
}
|
|
105
106
107
108
|
mixin {
defaultObfuscationEnv notch
}
|
|
109
110
|
checkstyle {
configProperties = [
|
|
111
112
113
114
|
"name" : project.name,
"organization": project.organization,
"url" : project.url,
"year" : project.inceptionYear
|
|
115
116
117
118
119
|
]
configFile = file("checkstyle.xml")
toolVersion = '6.13'
}
|
|
120
121
122
123
124
125
|
javadoc {
source sourceSets.client.allJava
source sourceSets.debug.allJava
}
afterEvaluate {
|
|
126
127
|
logger.lifecycle '================================================='
logger.lifecycle ' LiteLoader'
|
|
128
|
logger.lifecycle ' Copyright (C) 2011-2017 Adam Mummery-Smith'
|
|
129
130
131
132
133
134
135
136
137
|
logger.lifecycle ' Running in {} mode', (project.isReleaseBuild ? "RELEASE" : "SNAPSHOT")
logger.lifecycle '================================================='
makeEclipseCleanRunClient {
arguments = ""
jvmArguments = "-Dliteloader.debug=true -Dmixin.debug.verbose=true -Dmixin.debug.verify=true"
}
// hacks for run configs
|
|
138
139
140
141
142
|
def mc = plugins.getPlugin 'net.minecraftforge.gradle.tweaker-client'
mc.replacer.putReplacement '{RUN_CLIENT_MAIN}', project.startClass
mc.replacer.putReplacement '{RUN_CLIENT_TWEAKER}', minecraft.tweakClass
}
|
|
143
144
145
146
147
148
149
150
|
processResources {
inputs.property "brand", project.brand
from (sourceSets.main.resources.srcDirs) {
include 'liteloader.properties'
filter { line -> line.startsWith('brand=') ? line + project.brand : line }
}
}
|
|
151
152
|
// manifest entries for all jars
def jarManifest = {
|
|
153
|
attributes (
|
|
154
155
156
157
158
159
160
161
162
|
'Built-By': System.properties['user.name'],
'Created-By': System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
'Implementation-Title': name,
'Implementation-Version': version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
'Implementation-Vendor': url
)
}
jar {
|
|
163
164
165
|
doFirst {
// Seriously forge?
ant.replace(
|
|
166
|
file: file("${compileJava.temporaryDir}/${sourceSets.main.refMap}"),
|
|
167
168
169
170
|
token: "func_72355_a(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;)V",
value: "initializeConnectionToPlayer(Lnet/minecraft/network/NetworkManager;Lnet/minecraft/entity/player/EntityPlayerMP;Lnet/minecraft/network/NetHandlerPlayServer;)V"
)
}
|
|
171
172
173
174
175
176
177
178
|
from sourceSets.client.output
from sourceSets.debug.output
manifest jarManifest
}
task releaseJar(type: Jar) {
from sourceSets.main.output
from sourceSets.client.output
|
|
179
180
181
182
183
184
|
manifest jarManifest
classifier = 'staging'
}
shadowJar {
|
|
185
|
manifest jarManifest
|
|
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
dependsOn 'reobfReleaseJar'
from sourceSets.main.output
from sourceSets.client.output
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
exclude 'dummyThing'
exclude 'LICENSE.txt'
dependencies {
include(dependency('org.spongepowered:mixin'))
}
|
|
200
201
202
|
classifier = 'release'
}
|
|
203
204
205
206
207
208
209
210
|
sourceJar {
dependsOn retromapReplacedDebug
dependsOn retromapReplacedClient
from zipTree(tasks.retromapReplacedDebug.out)
from zipTree(tasks.retromapReplacedClient.out)
}
|
|
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
// Hey @AbrarSyed why can't we just turn this off >:(
task runClient(type: JavaExec, overwrite: true) {
doFirst {
println "Do not use runClient, it is not compatible with Mixin"
System.exit(-1)
}
}
tasks.withType(JavaCompile) {
|
|
225
226
227
228
|
options.compilerArgs += [
'-Xlint:all',
'-Xlint:-path',
'-Xlint:-rawtypes',
|
|
229
|
'-Xlint:-processing'
|
|
230
|
]
|
|
231
232
233
234
235
236
237
238
239
240
241
242
243
|
options.deprecation = true
options.encoding = 'utf8'
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
options.addStringOption('Xdoclint:none', '-quiet')
}
}
reobf {
jar {
|
|
244
|
mappingType = 'SEARGE'
|
|
245
246
|
}
releaseJar {
|
|
247
|
mappingType = 'NOTCH'
|
|
248
|
classpath = sourceSets.main.compileClasspath
|
|
249
250
|
}
shadowJar {
|
|
251
|
mappingType = 'NOTCH'
|
|
252
|
classpath = sourceSets.main.compileClasspath
|
|
253
254
255
|
}
}
|
|
256
257
258
|
build.dependsOn {[
'reobfReleaseJar',
'reobfShadowJar'
|
|
259
|
]}
|
|
260
261
262
263
264
|
artifacts {
if (project.isReleaseBuild) {
archives jar
}
|
|
265
|
archives shadowJar
|
|
266
267
268
269
|
archives sourceJar
archives javadocJar
}
|
|
270
271
272
|
task deploy(type: Copy, dependsOn: build) {
def libraryDir = new File(new File(System.env.APPDATA), ".minecraft/libraries")
from shadowJar.outputs.files[0]
|
|
273
274
|
into new File(libraryDir, sprintf('%1$s%4$s%2$s%4$s%3$s', project.group.replace('.', File.separator), archivesBaseName, version, File.separatorChar))
rename shadowJar.outputs.files[0].name, sprintf("%s-%s.jar", archivesBaseName, version)
|
|
275
276
|
}
|
|
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
uploadArchives {
repositories {
mavenDeployer {
if (project.hasProperty(project.mavenRepo)) {
repository(url: project.getProperty(project.mavenRepo)) {
authentication(userName: project.mavenUsername, password: project.mavenPassword)
}
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description 'LiteLoader'
url 'http://www.liteloader.com/'
scm {
url 'http://develop.liteloader.com/liteloader/LiteLoader'
connection 'scm:git:http://develop.liteloader.com/liteloader/LiteLoader.git'
developerConnection 'scm:git:http://develop.liteloader.com/liteloader/LiteLoader.git'
}
issueManagement {
system 'GitLab Issues'
url 'http://develop.liteloader.com/liteloader/LiteLoader/issues'
}
}
|
|
304
305
306
307
308
|
whenConfigured {
dependencies = dependencies.findAll {
!it.artifactId.contains('mixin')
}
}
|
|
309
310
311
312
|
}
}
}
}
|
|
313
|
|
|
314
315
316
317
318
319
320
|
install.repositories.mavenInstaller.pom {
whenConfigured {
dependencies = dependencies.findAll {
!it.artifactId.contains('mixin')
}
}
}
|