-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
228 lines (191 loc) · 5.29 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
buildscript {
repositories {
maven { url = "https://files.minecraftforge.net/maven" }
maven { url = "https://plugins.gradle.org/m2/" }
jcenter()
mavenCentral()
}
dependencies {
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "3.+", changing: true
classpath "gradle.plugin.com.matthewprenger:CurseGradle:1.4.0"
}
}
apply from: "https://gradle-files.u-team.info/default-project.gradle"
apply plugin: "net.minecraftforge.gradle"
apply plugin: "eclipse"
apply plugin: "com.matthewprenger.cursegradle"
apply plugin: "maven"
group = "info.u-team"
archivesBaseName = generateArchivesBaseName()
version = generateVersion()
sourceCompatibility = targetCompatibility = "1.8"
minecraft {
mappings channel: config.forge.mapping_channel, version: config.forge.mapping
runs {
client = {
workingDirectory project.file("run/client").canonicalPath
mods {
"${config.mod.modid}" {
source sourceSets.main
}
}
}
server = {
workingDirectory project.file("run/server").canonicalPath
mods {
"${config.mod.modid}" {
source sourceSets.main
}
}
}
data = {
workingDirectory project.file("run/data").canonicalPath
args "--mod", config.mod.modid, "--all", "--output", "\"" + file("src/generated/resources").toString() + "\"", "--validate", "--existing", "\"" + sourceSets.main.resources.srcDirs[0] + "\""
mods {
"${config.mod.modid}" {
source sourceSets.main
}
}
}
}
}
jar {
classifier = ""
from "LICENSE"
exclude(".cache")
manifest normalManifest
}
task deobfJar(type: Jar) {
classifier = "dev"
from sourceSets.main.output
from "LICENSE"
exclude(".cache")
manifest normalManifest
}
task sourcesJar(type: Jar) {
classifier = "sources"
from sourceSets.main.allJava
from "LICENSE"
}
task docJar(type: Jar) {
classifier = "javadoc"
from javadoc
from "LICENSE"
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addStringOption('encoding', 'UTF-8')
options.addStringOption('charSet', 'UTF-8')
}
}
artifacts {
archives deobfJar
archives sourcesJar
archives docJar
archives jar
}
signAllJars()
sourceSets {
main {
java
resources {
srcDirs += "src/generated/resources"
}
}
}
dependencies {
minecraft getForgeDependency()
compile getUTeamCoreDependency()
compile fg.deobf(getJeiApiDependency())
runtime fg.deobf(getJeiDependency())
}
curseforge {
afterEvaluate {
tasks."curseforge${config.curse.id}".onlyIf {
getValue("token") != null
}
}
tasks.curseforge.dependsOn build
apiKey = getValueDefault("token")
project {
id = config.curse.id
releaseType = config.curse.type
addGameVersion config.forge.mcversion
addGameVersion "Forge"
options {
forgeGradleIntegration = false
}
relations {
requiredDependency "u-team-core"
}
mainArtifact(jar) {
displayName = "${config.curse.display}-${config.forge.mcversion}-${project.version}"
changelogType = "html"
changelog = "<a href=\"" + generateChangelogUrl() + "\">Changelog of ${project.version}</a>"
}
addArtifact(deobfJar) {
displayName = "${config.curse.display}-${config.forge.mcversion}-${project.version}-dev"
changelogType = "text"
changelog = "Mappings: ${config.forge.mapping_channel}_${config.forge.mapping}"
}
}
}
uploadArchives {
onlyIf {
getValue("mavenpass") != null
}
tasks.uploadArchives.dependsOn build
repositories {
mavenDeployer {
repository(url: "https://repo.u-team.info") {
authentication(userName: "maven", password: getValue("mavenpass"))
}
pom {
groupId = project.group
artifactId = project.archivesBaseName
version = project.version
project {
name project.archivesBaseName
packaging "jar"
description "${config.github.name}"
url "https://github.com/MC-U-Team/${config.github.name}"
scm {
url "https://github.com/MC-U-Team/${config.github.name}"
connection "scm:git:git://github.com/MC-U-Team/${config.github.name}.git"
developerConnection "scm:git:git@github.com:MC-U-Team/${config.github.name}.git"
}
issueManagement {
system "github"
url "https://github.com/MC-U-Team/${config.github.name}/issues"
}
licenses {
license {
name "Apache License 2.0"
url "https://github.com/MC-U-Team/${config.github.name}/blob/${config.github.branch}/LICENSE"
distribution "repo"
}
}
developers {
developer {
name "HyCraftHD"
}
}
}
setConfigurations(null) // Prevent all dependencies in the pom file
}
}
}
}
task uploadBoth {
tasks.uploadBoth.dependsOn build
tasks.uploadBoth.dependsOn uploadArchives
tasks.uploadBoth.dependsOn "curseforge${config.curse.id}"
tasks.uploadBoth.dependsOn setBuildNumber
doLast {
println "Published both"
}
}
gradle.taskGraph.whenReady {
if (gradle.taskGraph.hasTask(":curseforge${config.curse.id}") || gradle.taskGraph.hasTask(":uploadArchives")) {
validateBuild()
}
}