build.gradle
5.23 KB
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
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.0-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle.tweaker-client'
apply plugin: 'maven'
// Artefact details
ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
ext.commit = project.hasProperty("commit") ? commit : 'unknown'
ext.classifier = project.hasProperty("buildType") ? buildType : 'SNAPSHOT'
ext.isReleaseBuild = "RELEASE".equals(project.classifier.toUpperCase())
ext.mavenRepo = project.isReleaseBuild ? "mavenUrl" : "mavenSnapshotUrl"
// Basic project information
group = "com.mumfrey"
archivesBaseName = "liteloader"
version = buildVersion + (project.isReleaseBuild ? '' : '-' + project.classifier)
// Extended project information
ext.projectName = 'LiteLoader'
ext.inceptionYear = '2012'
ext.packaging = 'jar'
ext.startClass = 'com.mumfrey.liteloader.debug.Start'
ext.tweakClass = 'com.mumfrey.liteloader.launch.LiteLoaderTweaker'
// Minimum version of Java required
sourceCompatibility = '1.6'
targetCompatibility = '1.6'
minecraft {
version = project.mcVersion
mappings = project.mcMappings
runDir = "run"
tweakClass = project.tweakClass
}
sourceSets {
client {
compileClasspath += main.compileClasspath + main.output
}
debug {
compileClasspath += client.compileClasspath + client.output
}
}
javadoc {
source sourceSets.client.allJava
source sourceSets.debug.allJava
}
// hacks for run configs
afterEvaluate {
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
}
// manifest entries for all jars
def jarManifest = {
mainAttributes (
'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 {
from sourceSets.client.output
from sourceSets.debug.output
manifest jarManifest
}
task releaseJar(type: Jar) {
from sourceSets.main.output
from sourceSets.client.output
manifest jarManifest
classifier = 'release'
}
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) {
options.compilerArgs += ['-Xlint:all', '-Xlint:-path']
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 {
useSrgSrg()
}
releaseJar {
useNotchSrg()
classpath = sourceSets.main.compileClasspath
}
}
compileJava.doFirst {
println '------------------------------------------------------------'
println 'Running ' + (project.isReleaseBuild ? "RELEASE" : "SNAPSHOT") + ' build'
println '------------------------------------------------------------'
}
build.dependsOn "reobfReleaseJar"
artifacts {
if (project.isReleaseBuild) {
archives jar
}
archives releaseJar
archives sourceJar
archives javadocJar
}
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'
}
}
}
}
}
}