forked from ldtteam/minecolonies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
278 lines (232 loc) · 7.28 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
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.0.9"
}
repositories {
maven {
name 'DVS1 Maven FS'
url 'http://dvs1.progwml6.com/files/maven'
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "modmaven.k-4u.nl"
}
maven {
url 'http://dogforce-games.com/maven'
}
}
apply plugin: 'idea'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'jacoco'
jacocoTestReport {
reports {
xml.enabled true
}
}
sourceSets {
api {
java {
srcDir 'src/api/java'
}
resources {
srcDir 'src/api/resources'
}
}
blockOut {
java {
srcDir 'src/blockout/java'
}
resources {
srcDir 'src/blockout/resources'
}
compileClasspath += sourceSets.api.compileClasspath
}
structures {
java {
srcDir 'src/structures/java'
}
resources {
srcDir 'src/structures/resources'
}
compileClasspath += sourceSets.api.compileClasspath
}
main {
java {
srcDir 'src/main/java'
}
resources {
srcDir 'src/main/resources'
}
compileClasspath += sourceSets.structures.output
compileClasspath += sourceSets.blockOut.output
compileClasspath += sourceSets.api.output
}
test {
java {
srcDir 'src/test/java'
}
resources {
srcDir 'src/test/resources'
}
}
}
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
dependencies {
deobfCompile "slimeknights.mantle:Mantle:1.12-${config.mantle_version}"
deobfCompile "slimeknights:TConstruct:1.12-${config.tinker_version}"
deobfCompile "gigaherz.guidebook:Guidebook-1.12.2:${config.guidebook_version}"
deobfCompile "gigaherz.commons:gigaherz.commons-1.12.1:${config.guidebook_core_version}"
compile "mod.chiselsandbits:chiselsandbits:${config.c_b_version}"
structuresCompile sourceSets.api.output
//blockOutCompile sourceSets.api.output
// compile against the JEI API but do not include it at runtime
deobfProvided "mezz.jei:jei_${config.minecraft_version}:${config.jei_version}:api"
// at runtime, use the full JEI jar
runtime "mezz.jei:jei_${config.minecraft_version}:${config.jei_version}"
testCompile sourceSets.structures.output
testCompile sourceSets.blockOut.output
testCompile 'junit:junit:4.11'
testCompile "org.mockito:mockito-core:1.+"
testCompile group: 'org.powermock', name: 'powermock-module-junit4', version: '1.6.5'
testCompile group: 'org.powermock', name: 'powermock-api-mockito', version: '1.6.5'
testCompile group: 'org.powermock', name: 'powermock-module-junit4-rule-agent', version: '1.6.5'
testCompile 'org.assertj:assertj-core:3.9.0'
testCompile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
compile 'com.intellij:annotations:+@jar'
}
group = "com.minecolonies"
version = config.minecraft_version.toString() + "-" + System.getenv()["Version"]
archivesBaseName = "minecolonies"
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
minecraft {
version = config.minecraft_version + "-" + config.forge_version
runDir = "run"
mappings = "${config.mappings}"
replace "@VERSION@", project.version
replaceIn "util/constant/Constants.java"
if (project.hasProperty("signature"))
replace "@FINGERPRINT@", signature
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
task apiJar(type: Jar) {
from sourceSets.api.output
classifier 'api'
}
task blockOutJar(type: Jar) {
from sourceSets.blockOut.output
classifier 'blockOut'
}
task structuresJar(type: Jar){
from sourceSets.structures.output
classifier 'structures'
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
jar {
from sourceSets.api.output
from sourceSets.blockOut.output
from sourceSets.structures.output
from sourceSets.main.output
classifier = 'universal'
manifest {
attributes 'FMLAT': "minecolonies_at.cfg"
}
}
javadoc {
source += sourceSets.api.allSource
source += sourceSets.blockOut.allSource
source += sourceSets.structures.allSource
}
idea {
module {
inheritOutputDirs = true
}
}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf { // Skip the task if our secret data isn't available
project.hasProperty('keyStore')
}
if (project.hasProperty('keyStore')) {
keyStore = project.keyStore // This needs to be a path to the keystore file
alias = project.keyStoreAlias
storePass = project.keyStorePass
keyPass = project.keyStoreKeyPass
inputFile = jar.archivePath
outputFile = jar.archivePath
}
}
build.dependsOn signJar
curseforge {
if (System.getenv().CURSEAPIKEY != null && System.getenv().CURSERELEASETYPE != null)
{
apiKey = System.getenv().CURSEAPIKEY
project {
id = '245506'
changelog = file('build/changelog.md')
changelogType = 'markdown'
releaseType = System.getenv().CURSERELEASETYPE
addArtifact deobfJar
addArtifact apiJar
addArtifact blockOutJar
addArtifact structuresJar
}
}
else
{
logger.lifecycle("Cannot run the CurseUpload sequence. No API-Key or release type has been provided.")
}
}
task("createChangelog") {
group = 'upload'
doLast {
def teamCityURL = "https://teamcity.minecolonies.com/"
def file = new FileOutputStream("build/changelog.md")
def out = new BufferedOutputStream(file)
def changesXML = new XmlSlurper().parse(teamCityURL + "guestAuth/app/rest/changes?locator=build:(id:" + teamcity["teamcity.build.id"] + ")")
def changes = changesXML.change
println("createChangelog: Identified " + changes.size() + " changes to be written into the changelog.")
out << "# Minecolonies Changelog \n"
out << "## Version: _" + version + "_ \n"
if (changes.size() > 0) {
for (int i = 0; i < changes.size(); i++) {
def changeDetailsURL = teamCityURL + "guestAuth/app/rest/changes/id:" + changes[i].@id.text()
def changeDetailsXml = new XmlSlurper().parse(changeDetailsURL)
def changeComment = changeDetailsXml.comment.text().trim()
out << "* " + changeComment + "\n"
}
} else {
out << "No Changes detected!"
}
out.close()
}
}