-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.gradle
520 lines (468 loc) · 18.1 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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
plugins {
// id "architectury-plugin" version "3.4-SNAPSHOT"
// id "dev.architectury.loom" version "1.2-SNAPSHOT"
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'net.neoforged.gradle' version "${forgegradle_version}"
id 'org.spongepowered.mixin' version "${mixingradle_version}"
id 'org.parchmentmc.librarian.forgegradle' version "${librarian_version}"
id 'org.jetbrains.gradle.plugin.idea-ext' version '1.1.6'
id 'maven-publish'
id 'eclipse'
id 'idea'
}
//apply from: 'https://raw.githubusercontent.com/SizableShrimp/Forge-Class-Remapper/main/classremapper.gradle'
//apply from: 'https://raw.githubusercontent.com/SizableShrimp/ForgeUpdatesRemapper/main/remapper.gradle'
group = 'com.teammoeg'
version = "${minecraft_version}-${mod_version}"
archivesBaseName = 'frostedheart'
compileJava.options.encoding = "UTF-8"
compileTestJava.options.encoding = "UTF-8"
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
sourceSets {
client{java{srcDirs=[]} resources{srcDirs=[]}}
server{java{srcDirs=[]} resources{srcDirs=[]}}
main {
resources {
srcDirs = [
"$rootDir/src/main/resources",
]
exclude 'assets/frostedheart/lang/**/'
exclude 'assets/frostedheart/font/unifont/*'
}
}
noDatagen{java{srcDirs=[]} resources{srcDirs=[]}}
datagen {
compileClasspath += main.compileClasspath
runtimeClasspath += main.runtimeClasspath
compileClasspath += main.output
runtimeClasspath += main.output
resources {
srcDirs = [
"$rootDir/src/datagen/resources",
]
exclude 'assets/frostedheart/lang/**/'
}
}
}
minecraft {
mappings channel: 'parchment', version: "${parchment_version}-${minecraft_version}"
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
runs {
client {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
//jvmArgs '-Xdebug','-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=9009'
// For Mac OS X users with an Apple Silicon chip,
// you would need the latest GLFW version that supports Apple Silicon.
// You can download the latest GLFW version from https://www.glfw.org/download.html
// and set the LIBGLFW_PATH_MACOS environment variable to the path of the
// GLFW library file libglfw.3.dylib
// NOTE for IDEA user: You need to manually set the JVM arg
// and the environment variable in the IDEA run configuration.
if (System.env.LIBGLFW_PATH_MACOS != null) {
println "LIBGLFW_PATH_MACOS is set to ${System.env.LIBGLFW_PATH_MACOS}"
jvmArgs "-Dorg.lwjgl.glfw.libname=${System.env.LIBGLFW_PATH_MACOS}"
}
// Similar steps for Linux users
if (System.env.LIBGLFW_PATH != null) {
jvmArgs "-Dorg.lwjgl.glfw.libname=${System.env.LIBGLFW_PATH}/lib/libglfw.so"
}
jvmArgs "-DFile.Encoding=UTF-8"
arg "-mixin.config=" + "frostedheart.mixins.json"
mods {
frostedheart {
source sourceSets.noDatagen
source sourceSets.main
source sourceSets.client
}
}
}
server {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
arg "-mixin.config=" + "frostedheart.mixins.json"
mods {
frostedheart {
source sourceSets.noDatagen
source sourceSets.main
source sourceSets.server
}
}
}
data {
workingDirectory project.file('run')
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
args "-mixin.config=" + "frostedheart.mixins.json",'--mod', 'frostedheart','--all','--output', file('src/generated/resources/'), 'validate', '--existing', file('src/main/resources/')
mods {
frostedheart {
source sourceSets.main
source sourceSets.datagen
}
}
}
}
}
sourceSets.main.resources {
srcDir 'src/generated/resources'
}
mixin {
add sourceSets.main, "frostedheart.refmap.json"
}
repositories {
mavenCentral()
mavenLocal()
maven {
// location of the maven that hosts JEI files since January 2023
name = "Jared's maven"
url = "https://maven.blamejared.com/"
content {
includeGroup "mezz.jei"
includeGroup "blusunrize.immersiveengineering"
includeGroup "org.embeddedt"
}
}
maven {
// location of a maven mirror for JEI files, as a fallback
name = "ModMaven"
url = "https://modmaven.dev"
content {
includeGroup "mezz.jei"
}
}
maven {
//location of the maven for mixed mappings, create, registrate, and flywheel
name = "tterrag maven"
url = "https://maven.tterrag.com/"
content {
includeGroup "com.jozufozu.flywheel"
includeGroup "com.tterrag.registrate"
includeGroup "com.simibubi.create"
}
}
// Needed for Curios API
maven {
name = "theillusivec4 maven"
url = "https://maven.theillusivec4.top/"
content {
includeGroup "top.theillusivec4.curios"
}
}
maven {
name = "architectury maven"
url = "https://maven.architectury.dev/"
content {
includeGroup "dev.architectury"
}
}
maven {
name = "saps maven"
url = "https://maven.saps.dev/releases"
content {
includeGroup "dev.ftb.mods"
}
}
// maven {
// name = "TeamMoeg COS Maven"
// url = "https://maven-1301510336.cos.ap-guangzhou.myqcloud.com"
//// content {
//// includeGroup "gloridifice.watersource"
//// includeGroup "com.alcatrazescapee.primalwinter"
//// includeGroup "java.moze_intel"
//// excludeGroup "curse.maven"
//// }
// }
// maven {
// name = "ftbMavenReleases"
// url = "https://maven.ftb.dev/releases"
// content {
// includeGroup "dev.ftb.mods"
// }
// }
maven {
name "firstdarkdev"
url "https://maven.firstdarkdev.xyz/snapshots"
content {
includeGroup "com.lowdragmc.ldlib"
}
}
maven {
name "modrinth"
url "https://api.modrinth.com/maven"
content {
includeGroup "maven.modrinth"
}
}
maven {
name = "Curse Maven"
url = "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.36'
annotationProcessor 'org.projectlombok:lombok:1.18.36'
testCompileOnly 'org.projectlombok:lombok:1.18.36'
testAnnotationProcessor 'org.projectlombok:lombok:1.18.36'
minecraft "net.neoforged:forge:${minecraft_version}-${forge_version}"
// implementation fileTree(include: ['*.jar'], dir: 'libs')
// IE
implementation fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}")
datagenImplementation fg.deobf("blusunrize.immersiveengineering:ImmersiveEngineering:${ie_version}:datagen")
// Create
implementation fg.deobf("com.simibubi.create:create-${minecraft_version}:${create_version}:slim") { transitive = false }
implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${minecraft_version}:${flywheel_version}")
implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}")
// create maven is no up to date
// implementation fg.deobf("curse.maven:create-328085:5838779")
// JEI
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}"))
implementation(fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}"))
// Curios
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}")
// FTB mods
implementation fg.deobf("dev.architectury:architectury-forge:${architectury_version}")
implementation fg.deobf("dev.ftb.mods:ftb-library-forge:${ftb_library_version}")
implementation fg.deobf("dev.ftb.mods:ftb-teams-forge:${ftb_teams_version}")
implementation fg.deobf("dev.ftb.mods:ftb-chunks-forge:${ftb_chunks_version}")
compileOnly fg.deobf("dev.ftb.mods:ftb-quests-forge:${ftb_quests_version}")
noDatagenRuntimeOnly fg.deobf("dev.ftb.mods:ftb-quests-forge:${ftb_quests_version}")
// Tetra
compileOnly fg.deobf("curse.maven:tetra-289712:5957838")
// noDatagenRuntimeOnly fg.deobf("curse.maven:tetra-289712:5957838") // somehow, when datagening, you must set to compileOnly
//
compileOnly fg.deobf("curse.maven:mutil-351914:4824501")
// Caupona
compileOnly fg.deobf("curse.maven:caupona-656147:5116975")
// implementation fg.deobf("curse.maven:caupona-656147:5116975")
// LDLib
compileOnly fg.deobf("com.lowdragmc.ldlib:ldlib-forge-${minecraft_version}:${ldlib_version}") { transitive = false }
// oculus
compileOnly fg.deobf("maven.modrinth:oculus:${oculus_version}")
// embeddium
compileOnly fg.deobf("org.embeddedt:embeddium-${minecraft_version}:${embeddium_version}")
// Comforts
// implementation fg.deobf("curse.maven:comforts-276951:5503516")
// Terralith
// implementation "curse.maven:terralith-513688:5512076"
// Primal Winter
// implementation fg.deobf("curse.maven:primal-winter-393321:4575861")
// Datagen only
// datagenImplementation fg.deobf("curse.maven:supplementaries-412082:5676069")
// datagenImplementation fg.deobf("curse.maven:crock-pot-404523:5458905")
// datagenImplementation fg.deobf("curse.maven:charcoal-pit-reloaded-534602:5861935")
// datagenImplementation fg.deobf("curse.maven:selene-499980:5854670") // supp api
// FG5 requires 0.8.3
annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
testAnnotationProcessor "org.spongepowered:mixin:${mixin_version}:processor"
//gradle data processing
implementation 'org.codehaus.groovy:groovy-json:3.0.9'
}
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
tasks.register('joinLang') {
ext {
buildDir=new File(project.buildDir,"jointLang");
}
inputs.dir "$rootDir/src/main/resources/assets/$mod_id/lang"
if(new File("$rootDir/src/generated/resources/assets/$mod_id/lang").exists())
inputs.dir "$rootDir/src/generated/resources/assets/$mod_id/lang"
outputs.dir buildDir
doLast{
def langList=new File("$rootDir/src/main/resources/assets/$mod_id/lang").listFiles({ f -> f.isDirectory() } as FileFilter)
langList.each{fn->
def langFile=new TreeMap<String, String>();
def generatedLang=new File("$rootDir/src/generated/resources/assets/$mod_id/lang/"+fn.name+".json")
if(generatedLang.exists())
new JsonSlurper().parse(generatedLang).each{key,value->langFile.put(key,value)}
//files in alphabetical order
fileTree(fn).files.sort().each { childFile ->
new JsonSlurper().parse(childFile).each{key,value->langFile.put(key,value)}
}
//write to output
buildDir.mkdirs()
new File(buildDir,fn.name+".json").text=JsonOutput.prettyPrint(JsonOutput.toJson(langFile))
}
}
}
tasks.register('zipUnifont', Zip) {
ext {
buildDir=new File(project.buildDir,"zipUnifont");
}
inputs.dir "$rootDir/src/main/resources/assets/frostedheart/font/unifont"
outputs.dir buildDir
archiveFileName = "default.zip"
destinationDirectory = buildDir
from new File("$rootDir/src/main/resources/assets/frostedheart/font/unifont")
}
processResources.dependsOn(joinLang)
processResources.dependsOn(zipUnifont)
tasks.processResources {
duplicatesStrategy = DuplicatesStrategy.WARN
from( tasks.joinLang.buildDir){ into 'assets/frostedheart/lang/'}
from( tasks.zipUnifont.buildDir){ into 'assets/frostedheart/font/'}
}
jar {
manifest {
attributes([
"Specification-Title" : "Frosted Heart",
"Specification-Vendor" : "TeamMoeg",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.version,
"Implementation-Vendor" : "TeamMoeg",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "frostedheart.mixins.json"
])
}
}
jar.finalizedBy('reobfJar')
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
archiveClassifier.set('sources')
}
task deobfJar(type: Jar) {
from sourceSets.main.output
archiveClassifier.set('deobf')
}
tasks.sourcesJar {
duplicatesStrategy = DuplicatesStrategy.WARN
}
tasks.deobfJar {
duplicatesStrategy = DuplicatesStrategy.WARN
}
artifacts {
archives sourcesJar
archives deobfJar
}
jar {
/*with copySpec {
from 'src/main/resources/frostedheart.mixins.json'
filter{l -> l.replaceAll('"create.MixinSmartTileEntity",','')};
}*/
}
String getChangelogText() {
def changelogFile = file('changelog.txt')
String str = ''
int lineCount = 0
boolean done = false
changelogFile.eachLine {
if (done || it == null) {
return
}
if (it.size() > 1) {
def temp = it
if (lineCount == 0) {
temp = "Frosted Heart for The Winter Rescue Modpack ${version}"
temp = "<span style=\"font-size: 18px; color: #333399;\">Frosted Heart for The Winter Rescue Modpack v${mod_version}</span> <em>for Minecraft ${minecraft_version}</em><br/>"
} else if (it.startsWith('-')) {
temp = " $temp<br/>"
temp = temp.replaceAll("(\\S+\\/\\S+)#([0-9]+)\\b", "<a href=\"https://github.com/\$1/issues/\$2\">\$0</a>");
temp = temp.replaceAll("#([0-9]+)\\b(?!<\\/a>)", "<a href=\"https://github.com/$github_project/issues/\$1\">\$0</a>");
} else {
temp = "<h4>$temp</h4>"
}
str += temp
lineCount++
} else {
str += "<p>Please submit any Issues you come across on the <a href=\"https://github.com/${github_project}/issues\" rel=\"nofollow\">Issue Tracker</a>.</p>"
done = true
}
}
return str
}
/*
* Copyright (c) 2024 TeamMoeg
*
* This file is part of Frosted Heart.
*
* Frosted Heart is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* Frosted Heart is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Frosted Heart. If not, see <https://www.gnu.org/licenses/>.
*
*/
// changelog debugging
//new File("changelog.html").write getChangelogText()
curseforge {
project {
def envApiKey = System.getenv('CURSEFORGE_API_KEY')
apiKey = envApiKey == null ? 'nope' : envApiKey
id = project.projectId
changelog = getChangelogText()
changelogType = 'html'
releaseType = project.curse_type
addGameVersion project.minecraft_version
mainArtifact (jar) {
relations {
requiredDependency 'create'
requiredDependency 'immersive-engineering'
requiredDependency 'caupona'
requiredDependency 'tetra'
requiredDependency 'mutil'
requiredDependency 'curios'
optionalDependency 'patchouli'
optionalDependency 'steam-powered-create'
optionalDependency 'immersive-industry'
optionalDependency 'charcoal-pit-reloaded'
optionalDependency 'neolithic-world'
optionalDependency 'comforts'
optionalDependency 'crockpot'
// requiredDependency 'snow-real-magic'
// requiredDependency 'kiwi'
// requiredDependency 'primal-winter'
}
}
}
}
// Automatically apply a license header when running checkLicense / updateLicense
//license {
// header = project.file('HEADER.txt')
// ignoreFailures = true
// include '**/*.java'
//}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact deobfJar
artifact sourcesJar
}
}
repositories {
// maven {
// name = "TeamMoeg"
// url = "http://server.teammoeg.com:8888/releases"
// credentials {
// username = System.getenv('TEAMMOEG_USER')
// password = System.getenv('TEAMMOEG_TOKEN')
// }
// authentication {
// basic(BasicAuthentication)
// }
// }
maven {
name = "COS"
url = "http://127.0.0.1:9999"
}
}
}