forked from CyclopsMC/IntegratedTerminals
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
371 lines (323 loc) · 11.9 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
272
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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
// For those who want the bleeding edge
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'com.github.jengelman.gradle.plugins:shadow:4.0.4'
}
}
plugins {
// For people who want stable
//id "net.minecraftforge.gradle.forge" version "2.0.2"
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.github.kt3k.coveralls' version '2.8.2'
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'jacoco'
import net.minecraftforge.gradle.common.task.SignJar
loadProperties()
version = config.mod_version
group = "org.cyclops.integratedterminals"
archivesBaseName = "IntegratedTerminals"
sourceCompatibility = 1.8
targetCompatibility = 1.8
def loadProperties() {
// Config file with custom properties
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
// grab buildNumber
ext.buildnumber = "DEV" // this will be referenced as simply project.buildnumber from now on.
if (System.getenv().BUILD_NUMBER)
project.buildnumber = System.getenv().BUILD_NUMBER
if (System.getenv().TRAVIS_BUILD_NUMBER)
project.buildnumber = System.getenv().TRAVIS_BUILD_NUMBER
if (System.getenv().GITHUB_RUN_ID)
project.buildnumber = System.getenv().GITHUB_RUN_NUMBER
if (System.getenv().RELEASE || System.getenv().TRAVIS_TAG)
project.buildnumber = "RELEASE"
logger.lifecycle "BUILDING VERSION: " + project.buildnumber
}
sourceSets {
main
test
}
configurations {
shadow.setTransitive(true);
}
test {
testLogging {
exceptionFormat = 'full'
}
}
repositories {
mavenCentral()
mavenLocal()
maven {
name "Cyclops Repo"
url "https://maven.pkg.github.com/CyclopsMC/packages"
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("MAVEN_USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("MAVEN_KEY")
}
}
}
dependencies {
minecraft "net.minecraftforge:forge:${config.minecraft_version}-${config.forge_version}"
// Add something like 'cyclopscore_version_local=0.1.0-DEV' to your gradle.properties if you want to use a custom local CyclopsCore version.
if(project.hasProperty("cyclopscore_version_local")) {
compile "org.cyclops.cyclopscore:cyclopscore:${config.minecraft_version}-${project.cyclopscore_version_local}:deobf"
} else {
compile "org.cyclops.cyclopscore:cyclopscore:${config.minecraft_version}-${config.cyclopscore_version}:deobf"
}
// Add something like 'integrateddynamics_version_local=0.1.0-DEV' to your gradle.properties if you want to use a custom local Integrated Tunnels Compat version.
if(project.hasProperty("integrateddynamics_version_local")) {
compile ("org.cyclops.integrateddynamics:integrateddynamics:${project.integrateddynamics_version_local}:deobf") {
transitive = false
}
} else {
compile ("org.cyclops.integrateddynamics:integrateddynamics:${config.integrateddynamics_version}:deobf") {
transitive = false
}
}
// Add something like 'integratedcrafting_version_local=0.1.0-DEV' to your gradle.properties if you want to use a custom local Integrated Tunnels Compat version.
if(project.hasProperty("integratedcrafting_version_local")) {
compile "org.cyclops.integratedcrafting:integratedcrafting:${project.integratedcrafting_version_local}:deobf"
} else {
compile ("org.cyclops.integratedcrafting:integratedcrafting:${config.integratedcrafting_version}:deobf") {
transitive = false
}
}
// Add something like 'integratedterminalscompat_version_local=0.1.0-DEV' to your gradle.properties if you want to use a custom local Integrated Tunnels Compat version.
if(project.hasProperty("integratedterminalscompat_version_local")) {
shadow("org.cyclops.integratedterminalscompat:integratedterminals-compat:${project.integratedterminalscompat_version_local}") {
transitive = false
}
} else {
shadow("org.cyclops.integratedterminalscompat:integratedterminals-compat:${config.integratedterminalscompat_version}") {
transitive = false
}
}
if(project.hasProperty("commoncapabilities_version_local")) {
compile ("org.cyclops.commoncapabilities:commoncapabilities:${project.commoncapabilities_version_local}:deobf") {
transitive = false
}
} else {
compile ("org.cyclops.commoncapabilities:commoncapabilities:${config.commoncapabilities_version}:deobf") { // https://dl.bintray.com/cyclopsmc/dev/org/cyclops/commoncapabilities/CommonCapabilities/
transitive = false
}
}
runtime "com.google.re2j:re2j:1.1"
// Project lombok
compileOnly "org.projectlombok:lombok:1.16.4"
testCompile "junit:junit:4.12"
}
minecraft {
mappings channel: "${config.mcp_mappings_channel}", version: "${config.mcp_mappings_version}"
runs {
client {
workingDirectory project.file('run')
//property 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP'
property 'forge.logging.console.level', 'debug'
mods {
integratedterminals {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
mods {
integratedterminals {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
args '--mod', 'integratedterminals', '--all', '--output', file('src/generated/resources/')
mods {
integratedterminals {
source sourceSets.main
}
}
}
}
}
if (project.buildnumber.equals("RELEASE"))
version = "${config.minecraft_version}-${config.mod_version}"
else
version = "${config.minecraft_version}-${config.mod_version}-${buildnumber}"
jar {
manifest {
attributes([
"Specification-Title": "${project.name}",
"Specification-Vendor": "rubensworks",
"Specification-Version": "${config.mod_version}",
"Implementation-Title": "${project.name}",
"Implementation-Version": "${config.mod_version}",
"Implementation-Vendor" :"rubensworks",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
task signJar(type: SignJar, dependsOn: jar) {
onlyIf {
System.getenv().SIGN_KEYSTORE
}
keyStore = System.getenv().SIGN_KEYSTORE
alias = System.getenv().SIGN_ALIAS
storePass = System.getenv().SIGN_STOREPASS
keyPass = System.getenv().SIGN_KEYPASS
inputFile = jar.archivePath
outputFile = jar.archivePath
}
build.dependsOn signJar
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
manifest {
attributes([
"Specification-Title": "${project.name}",
"Specification-Vendor": "rubensworks",
"Specification-Version": "${config.mod_version}",
"Implementation-Title": "${project.name}",
"Implementation-Version": "${config.mod_version}",
"Implementation-Vendor" :"rubensworks",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
task sourceJar(type: Jar) {
classifier = "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier 'javadoc'
}
shadowJar {
configurations = [project.configurations.shadow]
classifier '' // Replace the default JAR
append 'META-INF/mods.toml'
relocate 'com.google.re2j', 'vendors.com.google.re2j' // Because Forge blocks all com.google.* class loading...
}
reobf {
shadowJar {} // Reobfuscate the shadowed JAR
}
artifacts {
archives deobfJar
archives sourceJar
archives javadocJar
}
curseforge {
if(project.hasProperty("curseforge_key")) {
apiKey = project.curseforge_key
} else if((System.getenv().TRAVIS || System.getenv().GITHUB_ACTIONS) && System.getenv().CURSEFORGE_KEY_SECRET) {
apiKey = System.getenv().CURSEFORGE_KEY_SECRET
}
project {
id = "295910" // my project url is http://minecraft.curseforge.com/mc-mods/295910/
releaseType = project.config.release_type
mainArtifact(jar) {
relations {
requiredDependency 'cyclops-core'
requiredDependency 'integrated-dynamics'
requiredDependency 'integrated-tunnels'
optionalDependency 'integrated-crafting'
}
}
changelog = ""
if (new File("resources/changelog/${project.version}.txt").exists()) {
changelog = new File("resources/changelog/${project.version}.txt").text
}
addArtifact deobfJar
addArtifact sourceJar
addArtifact javadocJar
}
}
configurations {
deployerJars
}
dependencies {
deployerJars "org.apache.maven.wagon:wagon-ftp:2.2"
}
uploadArchives {
repositories {
add getProject().repositories.mavenLocal()
}
repositories.mavenDeployer {
configuration = configurations.deployerJars
if (project.hasProperty("filesmaven_url")) {
logger.info('Publishing to files server')
repository(url: project.filesmaven_url) {
authentication(userName: project.filesmaven_username, password: project.filesmaven_key)
}
} else if (System.getenv().MAVEN_URL) {
logger.info('Publishing to files server')
repository(url: System.getenv().MAVEN_URL) {
authentication(userName: System.getenv().MAVEN_USERNAME, password: System.getenv().MAVEN_KEY)
}
} else {
logger.info('Publishing to repo folder')
repository(url: 'file://localhost/' + project.file('~/.m2/repository').getAbsolutePath())
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName.toLowerCase()
}
pom.project {
name project.archivesBaseName
packaging 'jar'
description 'todo'
url 'https://github.com/CyclopsMC/IntegratedTerminals'
scm {
url 'https://github.com/CyclopsMC/IntegratedTerminals'
connection 'scm:git:git://github.com/CyclopsMC/IntegratedTerminals.git'
developerConnection 'scm:git:[email protected]:CyclopsMC/IntegratedTerminals.git'
}
issueManagement {
system 'github'
url 'https://github.com/CyclopsMC/IntegratedTerminals/issues'
}
developers {
developer {
id 'rubensworks'
name 'rubensworks'
roles { role 'developer' }
}
}
}
}
}
uploadArchives.dependsOn build
idea {
module {
for (String excludeDirName in ["run", "out", "logs", "gradle"]) {
File excludeDir = new File(projectDir, excludeDirName)
excludeDirs.add(excludeDir)
}
}
}
jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
}
}