|
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.1-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
63
64
65
|
// Basic project information
group = "com.mumfrey"
archivesBaseName = "liteloader"
version = buildVersion + (project.isReleaseBuild ? '' : '-' + project.classifier)
// Minimum version of Java required
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
|
|
66
|
repositories {
|
|
67
|
mavenLocal()
|
|
68
69
70
71
72
73
74
|
maven {
name = 'sponge'
url = 'https://repo.spongepowered.org/maven/'
}
}
dependencies {
|
|
75
|
compile('org.spongepowered:mixin:0.6.8-SNAPSHOT') {
|
|
76
77
78
79
80
|
exclude module: 'asm-commons'
exclude module: 'asm-tree'
exclude module: 'launchwrapper'
exclude module: 'guava'
}
|
|
81
82
|
}
|
|
83
84
85
86
87
88
89
90
|
minecraft {
version = project.mcVersion
mappings = project.mcMappings
runDir = "run"
tweakClass = project.tweakClass
}
sourceSets {
|
|
91
92
93
|
main {
refMap = "mixins.liteloader.core.refmap.json"
}
|
|
94
95
|
client {
compileClasspath += main.compileClasspath + main.output
|
|
96
|
refMap = "mixins.liteloader.client.refmap.json"
|
|
97
98
99
100
101
102
|
}
debug {
compileClasspath += client.compileClasspath + client.output
}
}
|
|
103
104
105
106
|
mixin {
defaultObfuscationEnv notch
}
|
|
107
108
|
checkstyle {
configProperties = [
|
|
109
110
111
112
|
"name" : project.name,
"organization": project.organization,
"url" : project.url,
"year" : project.inceptionYear
|
|
113
114
115
116
117
|
]
configFile = file("checkstyle.xml")
toolVersion = '6.13'
}
|
|
118
119
120
121
122
123
|
javadoc {
source sourceSets.client.allJava
source sourceSets.debug.allJava
}
afterEvaluate {
|
|
124
125
|
logger.lifecycle '================================================='
logger.lifecycle ' LiteLoader'
|
|
126
|
logger.lifecycle ' Copyright (C) 2011-2016 Adam Mummery-Smith'
|
|
127
128
129
130
131
132
133
134
135
|
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
|
|
136
137
138
139
140
|
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
}
|
|
141
142
143
144
145
146
147
148
|
processResources {
inputs.property "brand", project.brand
from (sourceSets.main.resources.srcDirs) {
include 'liteloader.properties'
filter { line -> line.startsWith('brand=') ? line + project.brand : line }
}
}
|
|
149
150
|
// manifest entries for all jars
def jarManifest = {
|
|
151
|
attributes (
|
|
152
153
154
155
156
157
158
159
160
|
'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 {
|
|
161
162
163
|
doFirst {
// Seriously forge?
ant.replace(
|
|
164
|
file: file("${compileJava.temporaryDir}/${sourceSets.main.refMap}"),
|
|
165
166
167
168
|
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"
)
}
|
|
169
170
171
172
173
174
175
176
|
from sourceSets.client.output
from sourceSets.debug.output
manifest jarManifest
}
task releaseJar(type: Jar) {
from sourceSets.main.output
from sourceSets.client.output
|
|
177
178
179
180
181
182
|
manifest jarManifest
classifier = 'staging'
}
shadowJar {
|
|
183
|
manifest jarManifest
|
|
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
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'))
}
|
|
198
199
200
|
classifier = 'release'
}
|
|
201
202
203
204
205
206
207
208
|
sourceJar {
dependsOn retromapReplacedDebug
dependsOn retromapReplacedClient
from zipTree(tasks.retromapReplacedDebug.out)
from zipTree(tasks.retromapReplacedClient.out)
}
|
|
209
210
211
212
213
214
215
216
217
218
219
220
221
222
|
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) {
|
|
223
224
225
226
|
options.compilerArgs += [
'-Xlint:all',
'-Xlint:-path',
'-Xlint:-rawtypes',
|
|
227
|
'-Xlint:-processing'
|
|
228
|
]
|
|
229
230
231
232
233
234
235
236
237
238
239
240
241
|
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 {
|
|
242
|
mappingType = 'SEARGE'
|
|
243
244
|
}
releaseJar {
|
|
245
|
mappingType = 'NOTCH'
|
|
246
|
classpath = sourceSets.main.compileClasspath
|
|
247
248
|
}
shadowJar {
|
|
249
|
mappingType = 'NOTCH'
|
|
250
|
classpath = sourceSets.main.compileClasspath
|
|
251
252
253
|
}
}
|
|
254
255
256
|
build.dependsOn {[
'reobfReleaseJar',
'reobfShadowJar'
|
|
257
|
]}
|
|
258
259
260
261
262
|
artifacts {
if (project.isReleaseBuild) {
archives jar
}
|
|
263
|
archives shadowJar
|
|
264
265
266
267
|
archives sourceJar
archives javadocJar
}
|
|
268
269
270
|
task deploy(type: Copy, dependsOn: build) {
def libraryDir = new File(new File(System.env.APPDATA), ".minecraft/libraries")
from shadowJar.outputs.files[0]
|
|
271
272
|
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)
|
|
273
274
|
}
|
|
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
|
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'
}
}
|
|
302
303
304
305
306
|
whenConfigured {
dependencies = dependencies.findAll {
!it.artifactId.contains('mixin')
}
}
|
|
307
308
309
310
|
}
}
}
}
|
|
311
|
|
|
312
313
314
315
316
317
318
|
install.repositories.mavenInstaller.pom {
whenConfigured {
dependencies = dependencies.findAll {
!it.artifactId.contains('mixin')
}
}
}
|