forked from ldtteam/vanilla-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
222 lines (179 loc) · 5.65 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
import net.minecraftforge.gradle.user.TaskSingleReobf
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'
apply plugin: 'maven'
jacocoTestReport {
reports {
xml.enabled true
}
}
ext.configFile = file "build.properties"
configFile.withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
dependencies {
// 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 '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.SuperTools"
version = config.minecraft_version.toString() + "-" + System.getenv()["Version"]
archivesBaseName = "SuperTools"
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'
}
jar {
from sourceSets.api.output
from sourceSets.main.output
manifest {
attributes 'FMLAT': 'supertools_at.cfg',
'Maven-Artifact': "${project.group}:${project.archivesBaseName}:${project.version}"
}
}
javadoc {
source += sourceSets.api.allSource
source += sourceSets.main.allJava
}
// add a javadoc jar
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from 'build/docs/javadoc'
}
reobf {
jar {}
apiJar{}
}
artifacts {
archives jar
archives javadocJar
archives apiJar
archives sourceJar
}
javadoc {
source += sourceSets.api.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 = '298744'
changelog = file('build/changelog.md')
changelogType = 'markdown'
releaseType = System.getenv().CURSERELEASETYPE
addArtifact apiJar
addArtifact sourceJar
}
}
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 << "# SuperTools 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][email protected]()
def changeDetailsXml = new XmlSlurper().parse(changeDetailsURL)
def changeComment = changeDetailsXml.comment.text().trim()
out << "* " + changeComment + "\n"
}
} else {
out << "No Changes detected!"
}
out.close()
}
}