-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
264 lines (233 loc) · 8.27 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
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://maven.maxhenkel.de/repository/public' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath group: 'de.maxhenkel.forge-update', name: 'forge-update', version: '1.0.2'
}
}
plugins {
// https://github.com/matthewprenger/CurseGradle
id "com.matthewprenger.cursegradle" version "1.4.0"
id "com.github.johnrengelman.shadow" version "7.1.0"
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'forge-update'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
version = mod_version
group = mod_packagename
archivesBaseName = mod_id
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
minecraft {
mappings channel: 'official', version: mod_minecraft_version
runs {
client {
workingDirectory project.file('run').canonicalPath
property 'forge.logging.console.level', 'debug'
//properties 'mixin.env.disableRefMap': 'true'
args = ['--username', 'henkelmax']
source sourceSets.main
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
mod_id {
source sourceSets.main
}
}
}
server {
workingDirectory project.file('run/server').canonicalPath
property 'forge.logging.console.level', 'debug'
source sourceSets.main
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
mod_id {
source sourceSets.main
}
}
}
data {
workingDirectory project.file('run')
property 'forge.logging.console.level', 'debug'
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
mod_id {
source sourceSets.main
}
}
}
}
}
sourceSets.main.resources { srcDir 'src/generated/resources' }
dependencies {
minecraft "net.minecraftforge:forge:${mod_minecraft_version}-${forge_version}"
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}")
// compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${theoneprobe_mc_version}:${theoneprobe_mc_version}-${theoneprobe_version}:api")
// runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${theoneprobe_mc_version}:${theoneprobe_mc_version}-${theoneprobe_version}")
// runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}")
// runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:additions")
// runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:generators")
// runtimeOnly fg.deobf("mekanism:Mekanism:${mekanism_version}:tools")
implementation fg.deobf("curse.maven:the-one-probe-245211:${theoneprobe_id}")
implementation fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}:api")
runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:${patchouli_version}")
shadow fg.deobf("de.maxhenkel.corelib:corelib:${mod_minecraft_version}-${corelib_version}:api")
runtimeOnly fg.deobf("de.maxhenkel.corelib:corelib:${mod_minecraft_version}-${corelib_version}")
runtimeOnly fg.deobf("de.maxhenkel.corelib:corelib:${mod_minecraft_version}-${corelib_version}:javadoc")
implementation 'com.google.code.findbugs:jsr305:3.0.2'
}
jar {
manifest {
attributes(["Specification-Title" : mod_name,
"Specification-Vendor" : mod_vendor,
"Specification-Version" : "1",
"Implementation-Title" : mod_name,
"Implementation-Version" : mod_version,
"Implementation-Vendor" : mod_vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
}
}
processResources {
filesMatching("**/*.toml") {
expand 'mod_id': mod_id,
'mod_version': mod_version,
'mod_vendor': mod_vendor,
'mod_name': mod_name,
'mod_forge_version': mod_forge_version,
'mod_loader_version': mod_loader_version,
'mod_minecraft_version': mod_minecraft_version,
'patchouli_version_range': patchouli_version_range,
'camera_version_range': camera_version_range
}
}
curseforge {
def apiKeyFile = file('curseforge_api_key.txt')
if (System.env.CURSEFORGE_API_KEY != null) {
apiKey = System.env.CURSEFORGE_API_KEY;
} else if (apiKeyFile.exists()) {
apiKey = apiKeyFile.text
} else {
apiKey = ''
}
project {
id = curse_id
changelogType = 'markdown'
changelog = file('changelog.md')
releaseType = curse_release_type
addGameVersion mod_minecraft_version
mainArtifact(jar) {
displayName = "[${mod_minecraft_version}] ${mod_name} ${mod_version}"
relations {
requiredDependency 'camera-mod'
requiredDependency 'patchouli'
}
}
}
}
forgeUpdate {
def messages = []
file('changelog.md').eachLine { String line ->
if (line.trim().startsWith('-')) {
messages.add(line.replaceFirst('-', '').trim())
}
}
def apiKeyFile = file('forge_update_api_key.txt')
if (System.env.FORGE_UPDATE_API_KEY != null) {
apiKey = System.env.FORGE_UPDATE_API_KEY;
} else if (apiKeyFile.exists()) {
apiKey = apiKeyFile.text
} else {
apiKey = ''
}
serverURL = 'https://update.maxhenkel.de/'
modID = mod_id
gameVersion = mod_minecraft_version
modVersion = mod_version
updateMessages = messages
releaseType = curse_release_type
tags = recommended == 'true' ? ['recommended'] : []
}
repositories {
maven {
name = "Progwml6 maven"
url = "https://dvs1.progwml6.com/files/maven/"
}
maven {
name = "ModMaven"
url = "https://modmaven.k-4u.nl"
}
maven {
name = "henkelmax.public"
url = 'https://maven.maxhenkel.de/repository/public'
}
maven {
name 'tterrag maven'
url "https://maven.tterrag.com/"
}
maven { url 'https://modmaven.dev/' }
maven { url 'https://maven.blamejared.com' }
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
mavenLocal()
}
javadoc {
failOnError = false
}
task deobfJar(type: Jar) {
classifier 'deobf'
from sourceSets.main.output
manifest {
attributes(["Specification-Title" : mod_name,
"Specification-Vendor" : mod_vendor,
"Specification-Version" : "1",
"Implementation-Title" : mod_name,
"Implementation-Version" : mod_version,
"Implementation-Vendor" : mod_vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],)
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
task sourcesJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier 'javadoc'
from javadoc.getDestinationDir()
}
artifacts {
archives deobfJar
archives sourcesJar
archives javadocJar
archives shadowJar
}
jar.finalizedBy('reobfJar')
shadowJar {
project.configurations.shadow.setTransitive(true);
configurations = [project.configurations.shadow]
classifier ''
relocate 'de.maxhenkel.corelib', "de.maxhenkel.${mod_id}.corelib"
}
reobf {
shadowJar {}
}