-
Notifications
You must be signed in to change notification settings - Fork 35
/
build.gradle
271 lines (230 loc) · 6.53 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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
buildscript {
repositories {
mavenCentral()
maven {
name = 'sonatype-nexus-public'
url = 'https://oss.sonatype.org/content/repositories/public/'
}
maven {
name = 'forge-repo'
url = 'http://files.minecraftforge.net/maven/'
}
maven {
name = 'sponge'
url = 'http://repo.spongepowered.org/maven'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.0'
}
}
// Gradle plugins
plugins {
id "maven"
id "signing"
id "com.matthewprenger.cursegradle" version "1.0.9"
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'org.spongepowered.mixin'
apply plugin: 'com.github.johnrengelman.shadow'
// Project repositories
repositories {
mavenLocal()
mavenCentral()
maven {
name = 'sonatype-nexus-public'
url = 'https://oss.sonatype.org/content/repositories/public/'
}
maven {
name = 'sponge'
url = 'http://repo.spongepowered.org/maven'
}
}
// Project dependencies
dependencies {
compile('org.spongepowered:mixin:0.7.4-SNAPSHOT') {
exclude module: 'asm-commons'
exclude module: 'asm-tree'
exclude module: 'launchwrapper'
exclude module: 'guava'
exclude module: 'log4j-core'
}
}
// Gradle default tasks
defaultTasks 'build', 'install'
// Basic project information
group = 'net.malisis'
archivesBaseName = 'malisiscore'
version = '1.12.2-6.5.0-SNAPSHOT'
ext.packaging = 'jar'
// Extended project information
ext.projectName = 'MalisisCore'
ext.description = 'MalisisCore is a framework dedicated to simplify many processes required during a mod development.'
ext.url = 'http://github.com/Ordinastie/MalisisCore'
// Compilation variables
ext.buildNumber = project.hasProperty("buildNumber") ? buildNumber : '0'
ext.ciSystem = project.hasProperty("ciSystem") ? ciSystem : 'unknown'
ext.commit = project.hasProperty("commit") ? commit : 'unknown'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
// MinecraftForge version
minecraft {
version = "1.12.2-14.23.1.2589"
mappings = "snapshot_20180114"
if(file("../../run").exists())
runDir = "../../run/assets"
else
runDir = "run/assets"
replace '${version}', project.version
replaceIn "MalisisCore.java"
}
sourceSets {
main {
ext.refMap = "mixins.malisiscore.refmap.json"
}
}
// Filter, process, and include resources
processResources {
inputs.property "version", version
inputs.property "mcversion", project.minecraft.version
// Include in final JAR
from 'LICENSE.txt'
// Replace variables
from('src/main/resources/mcmod.info') {
expand 'modid': archivesBaseName,
'name': projectName,
'description': project.ext.description,
'version': version,
'buildNumber': buildNumber,
'mcversion': minecraft.version,
'url': url
}
}
jar {
classifier 'base'
manifest {
attributes "Built-By": "Ordinastie",
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": name,
"Implementation-Version": version,
"Implementation-Vendor": url,
"FMLCorePlugin": "net.malisis.core.asm.MalisisCorePlugin",
"FMLCorePluginContainsFMLMod": true,
"ForceLoadAsMod": true,
"TweakClass": "org.spongepowered.asm.launch.MixinTweaker",
"TweakOrder": 0,
"MixinConfigs": "mixins.malisiscore.core.json",
"FMLAT": "malisiscore_at.cfg"
}
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
// disable the crazy super-strict doclint tool in Java 8
options.addStringOption('Xdoclint:none', '-quiet')
}
}
// Javadoc JAR generation
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
// Source JAR generation
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.java.srcDirs
}
// Create a JAR based on deobfuscated code
task deobfJar(type: Jar) {
manifest.from jar.manifest
from sourceSets.main.output
classifier = 'dev'
}
shadowJar {
mainSpec.sourcePaths.clear()
dependsOn reobfJar
classifier ''
exclude 'dummyThing'
dependencies {
include dependency('org.spongepowered:mixin')
}
afterEvaluate {
from zipTree(reobfJar.jar)
}
}
makeStart {
// TODO do this properly with FG2
addReplacement("parseArgs(args);", "parseArgs(args); String __malisis_coremodProp = System.getProperty(\"fml.coreMods.load\", \"\");" +
"__malisis_coremodProp += \"net.malisis.core.asm.MalisisCorePlugin\";" +
"System.setProperty(\"fml.coreMods.load\", __malisis_coremodProp);")
}
// Set all artifacts
artifacts {
archives shadowJar, deobfJar, sourcesJar, javadocJar
}
// Deployment signing
signing {
// Check if uploadArchives task is used
required { gradle.taskGraph.hasTask("uploadArchives") }
// Sign JAR artifacts
sign configurations.archives
}
// Artifact deployment
uploadArchives {
repositories.mavenDeployer {
// Sign Maven POM
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
def username = project.hasProperty('sonatypeUsername') ? project.getProperty('sonatypeUsername') : System.getenv("sonatypeUsername");
def password = project.hasProperty('sonatypePassword') ? project.getProperty('sonatypePassword') : System.getenv("sonatypePassword");
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots") {
authentication(userName: username, password: password)
}
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
authentication(userName: username, password: password)
}
// Maven POM generation
pom.project {
name projectName
artifactId archivesBaseName
packaging packaging
url url
description project.ext.description
scm {
connection 'scm:git:git://github.com/Ordinastie/MalisisCore.git'
developerConnection 'scm:git:ssh://[email protected]:Ordinastie/MalisisCore.git'
url 'https://github.com/Ordinastie/MalisisCore'
}
licenses {
license {
name 'The MIT License'
url 'http://www.tldrlegal.com/license/mit-license'
distribution 'repo'
}
}
developers {
developer {
id 'Ordinastie'
name 'Ordinastie'
}
}
issueManagement {
system 'github'
url 'https://github.com/Ordinastie/MalisisCore/issues'
}
}
}
}
if (project.hasProperty('curseapi')) {
curseforge {
apiKey = curseapi
project {
id = '223896'
releaseType = 'release'
mainArtifact shadowJar
addArtifact deobfJar
addArtifact sourcesJar
addArtifact javadocJar
}
}
}