forked from gigabit101/StevesFactoryManager
-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.gradle
526 lines (420 loc) · 22.6 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
521
522
523
524
525
526
//file:noinspection GroovyAssignabilityCheck
plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
id 'antlr'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
id 'application'
}
sourceSets {
main {
resources {
srcDirs += "src/generated/resources"
srcDirs += "src/main/resources"
exclude ".cache"
}
}
// https://docs.gradle.org/current/userguide/java_testing.html#sec:configuring_java_integration_tests
test {
compileClasspath += main.output
}
gametest {
java {
srcDir "src/gametest/java"
}
compileClasspath += main.output
resources {
srcDirs += "src/gametest/resources"
}
}
datagen {
compileClasspath += main.output
}
generated
}
configurations {
extendConfigurations(implementation, gametestImplementation, testImplementation)
extendConfigurations(compileOnly, gametestCompileOnly, testCompileOnly)
extendConfigurations(runtimeOnly, gametestRuntimeOnly, testRuntimeOnly)
datagenImplementation.extendsFrom(minecraft) // don't load mods when doing datagen lol
}
static void extendConfigurations(Configuration base, Configuration... configurations) {
for (def configuration : configurations) {
configuration.extendsFrom(base)
}
}
version = mod_version
group = mod_group_id
base {
archivesName = "${mod_name}-${minecraft_version}"
}
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
// official MCVersion Official field/method names from Mojang mapping files
// parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official
//
// You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
// See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
//
// Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge
// Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: mapping_channel, version: mapping_version
// When true, this property will have all Eclipse run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableEclipsePrepareRuns = true
// When true, this property will have all IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game.
// In most cases, it is not necessary to enable.
// enableIdeaPrepareRuns = true
// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
// copyIdeResources = true
// When true, this property will add the folder name of all declared run configurations to generated IDE run configurations.
// The folder name can be set on a run configuration using the "folderName" property.
// By default, the folder name of a run configuration is the name of the Gradle project containing it.
// generateRunFolders = true
// This property enables access transformers for use in development.
// They will be applied to the Minecraft artifact.
// The access transformer file can be anywhere in the project.
// However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge.
// This default location is a best practice to automatically put the file in the right place in the final jar.
// See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information.
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')
// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'
// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', mod_id
// Ensure mixin dependencies play nice
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
// https://github.com/ChiefArug/ThermalSysteams/blob/main/build.gradle#L27
// https://discord.com/channels/313125603924639766/983834532904042537/1089449308048343090
jvmArgs '-XX:+AllowEnhancedClassRedefinition', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:+AllowRedefinitionToAddDeleteMethods'
mods {
"${mod_id}" {
source sourceSets.main
source sourceSets.gametest
}
}
}
client_teamy {
//noinspection GroovyAssignabilityCheck
parent runs.client
args '--username', 'TeamDman', '--uuid', '83f1df8b-0ba3-4de0-8a26-e51a1fd74318', '--width', '1708', '--height', '960'
}
server {
workingDirectory project.file('runServer')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', mod_id
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
jvmArgs '-XX:+AllowEnhancedClassRedefinition', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:+AllowRedefinitionToAddDeleteMethods'
mods {
"${mod_id}" {
source sourceSets.main
source sourceSets.gametest
}
}
}
// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
workingDirectory project.file('runGameTest')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'forge.enabledGameTestNamespaces', mod_id
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
jvmArgs '-XX:+AllowEnhancedClassRedefinition', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:+AllowRedefinitionToAddDeleteMethods'
mods {
"${mod_id}" {
source sourceSets.main
source sourceSets.gametest
}
}
}
data {
workingDirectory project.file('runData')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg"
jvmArgs '-XX:+AllowEnhancedClassRedefinition', '-XX:+IgnoreUnrecognizedVMOptions', '-XX:+AllowRedefinitionToAddDeleteMethods'
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
ideaModule "${project.name}.datagen"
mods {
"${mod_id}" {
source sourceSets.main
source sourceSets.datagen
}
}
}
}
}
repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver
// flatDir {
// dir 'libs'
// }
maven {
name 'jei'
url 'https://dvs1.progwml6.com/files/maven'
}
maven {
name 'CurseMaven'
url 'https://www.cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
maven {
name 'mekanism'
url 'https://modmaven.dev/'
}
maven {
name 'thermal'
url 'https://maven.covers1624.net/'
// https://nexus.covers1624.net/#browse/browse:cofh-releases
}
}
dependencies {
// Specify the version of Minecraft to use.
// Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact.
// The "userdev" classifier will be requested and setup by ForgeGradle.
// If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"],
// then special handling is done to allow a setup of a vanilla dependency without the use of an external repository.
//noinspection VulnerableLibrariesLocal
minecraft "net.minecraftforge:forge:${minecraft_version}-${neo_version}"
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}")
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}")
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}")
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
antlr 'org.antlr:antlr4:4.9.1'
testImplementation 'com.github.javaparser:javaparser-symbol-solver-core:3.26.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
// add benchmarking dependencies
testImplementation 'org.openjdk.jmh:jmh-core:1.37'
testImplementation 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
testImplementation 'org.openjdk.jmh:jmh-generator-bytecode:1.37'
testAnnotationProcessor 'org.openjdk.jmh:jmh-generator-annprocess:1.37'
runtimeOnly fg.deobf("curse.maven:the-one-probe-245211:3927520") //TheOneProbe - 1.19-6.2.1
compileOnly fg.deobf('mezz.jei:jei-1.19.2-forge:11.6.0.1018')
runtimeOnly fg.deobf('mezz.jei:jei-1.19.2-forge:11.6.0.1018')
// runtimeOnly fg.deobf("curse.maven:jei-238222:3944627") //jei-1.19.2-forge-11.2.0.256.jar
runtimeOnly fg.deobf("curse.maven:powah-633483:4729361") // [FORGE 1.19.2] v4.0.11
runtimeOnly fg.deobf("curse.maven:cloth-config-348521:4973444") // [Forge 1.19-1.19.2] v8.3.115
runtimeOnly fg.deobf("curse.maven:ato-405593:4046926") // alltheores-2.0.2-1.19.2-43.1.3.jar
// https://www.curseforge.com/minecraft/mc-mods/tool-kit/files/3933949
runtimeOnly fg.deobf("curse.maven:tool-kit-324888:3933949")
runtimeOnly fg.deobf("curse.maven:ftb-library-404465:4661834") // ftb-library-forge-1902.4.1-build.236.jar
runtimeOnly fg.deobf("curse.maven:architectury-api-419699:5137942") // [Forge 1.19.2] v6.6.92
// https://www.curseforge.com/minecraft/mc-mods/ex-pattern-provider/files/5250574
runtimeOnly fg.deobf("curse.maven:ex-pattern-provider-892005:5250574") // ExtendedAE-1.19-0.2.2-forge.jar
runtimeOnly fg.deobf("curse.maven:toast-control-271740:4028343") // ToastControl-1.19.2-7.0.0.jar
runtimeOnly fg.deobf("curse.maven:placebo-283644:5180198") // Placebo-1.19.2-7.4.0.jar
runtimeOnly fg.deobf("curse.maven:mouse-tweaks-60089:3871353") // [1.19+] Mouse Tweaks 2.23 Forge
runtimeOnly fg.deobf("curse.maven:inventory-essentials-368825:4751198")
// inventoryessentials-forge-1.19.2-5.4.0.jar
runtimeOnly fg.deobf("curse.maven:balm-531761:4751735") // balm-forge-1.19.2-4.6.0.jar
runtimeOnly fg.deobf("curse.maven:construction-wand-399558:4455719") // constructionwand-1.19.2-2.10.jar
runtimeOnly fg.deobf("curse.maven:worldedit-225608:3922622") // WorldEdit 7.2.12 (Forge/Fabric for MC 1.19.2)
// disable because the seed recipes don't work in phyto without additional scripts
// runtimeOnly fg.deobf("curse.maven:mystical-agriculture-246640:5225677") // MysticalAgriculture-1.19.2-6.0.14.jar
// runtimeOnly fg.deobf("curse.maven:cucumber-272335:4773184") // Cucumber-1.19.2-6.0.10.jar
gametestImplementation fg.deobf("com.teamcofh:cofh_core:1.19.2-10.2.0.+")
runtimeOnly fg.deobf("com.teamcofh:cofh_core:1.19.2-10.2.0.+")
gametestImplementation fg.deobf("com.teamcofh:thermal_core:1.19.2-10.2.0.+")
runtimeOnly fg.deobf("com.teamcofh:thermal_core:1.19.2-10.2.0.+")
gametestImplementation fg.deobf("com.teamcofh:thermal_expansion:1.19.2-10.2.0.+")
runtimeOnly fg.deobf("com.teamcofh:thermal_expansion:1.19.2-10.2.0.+")
implementation fg.deobf("appeng:appliedenergistics2-forge:12.9.9")
compileOnly fg.deobf("appeng:appliedenergistics2-forge:12.9.9:api")
// don't use cursemaven for CoFH since the maven gives better IDE inspections
// // https://legacy.curseforge.com/minecraft/mc-mods/thermal-foundation/files/4382373
// // thermal_foundation-1.19.2-10.2.0.47.jar
// gametestImplementation fg.deobf("curse.maven:thermal-foundation-222880:4382373")
// runtimeOnly fg.deobf("curse.maven:thermal-foundation-222880:4382373")
//
// // https://legacy.curseforge.com/minecraft/mc-mods/thermal-expansion/files/4382371
// // thermal_expansion-1.19.2-10.2.0.21.jar
// gametestImplementation fg.deobf("curse.maven:thermal-expansion-69163:4382371")
// runtimeOnly fg.deobf("curse.maven:thermal-expansion-69163:4382371")
//
// // https://legacy.curseforge.com/minecraft/mc-mods/cofh-core/files
// // cofh_core-1.19.2-10.2.1.40.jar
// gametestImplementation fg.deobf("curse.maven:cofh-core-69162:4385216")
// runtimeOnly fg.deobf("curse.maven:cofh-core-69162:4385216")
runtimeOnly fg.deobf("curse.maven:titanium-287342:4152837") //titanium-1.19.2-3.7.1-24.jar
runtimeOnly fg.deobf("curse.maven:patchouli-306770:4031402") //Patchouli-1.19.2-77.jar
runtimeOnly fg.deobf("curse.maven:industrial-foregoing-266515:4459182")// industrial-foregoing-1.19.2-3.3.2.3-5.jar
gametestImplementation fg.deobf("curse.maven:industrial-foregoing-266515:4459182")
gametestImplementation fg.deobf("curse.maven:titanium-287342:4152837") //titanium-1.19.2-3.7.1-24.jar
gametestImplementation fg.deobf("curse.maven:patchouli-306770:4031402") //Patchouli-1.19.2-77.jar
implementation fg.deobf("curse.maven:mekanism-268560:4644795") //Mekanism-1.19.2-10.3.9.13.jar
implementation "mekanism:Mekanism:1.19.2-10.3.8.477:api"
// https://legacy.curseforge.com/minecraft/mc-mods/sophisticated-core/files/4503931
// sophisticatedcore-1.19.2-0.5.51.251.jar
gametestImplementation fg.deobf("curse.maven:sophisticated-core-618298:4503931")
runtimeOnly fg.deobf("curse.maven:sophisticated-core-618298:4503931")
// https://www.curseforge.com/minecraft/mc-mods/sophisticated-storage/files/4503929
// sophisticatedstorage-1.19.2-0.6.29.335.jar
gametestImplementation fg.deobf("curse.maven:sophisticated-storage-619320:4503929")
runtimeOnly fg.deobf("curse.maven:sophisticated-storage-619320:4503929")
runtimeOnly fg.deobf("curse.maven:extreme-sound-muffler-363363:4821189")
// Extreme sound muffler 3.39 - Forge 1.19.2
implementation fg.deobf("curse.maven:botania-225643:5608807") // Botania-1.19.2-440.2-FORGE.jar
implementation fg.deobf("curse.maven:ars-nouveau-401955:5171729") // ars_nouveau-1.19.2-3.23.0.jar
implementation fg.deobf("curse.maven:curios-309927:5494603") // curios-forge-1.19.2-5.1.6.3.jar
implementation fg.deobf("curse.maven:flux-networks-248020:4620438") // Flux-Networks-1.19.2-7.1.4
implementation fg.deobf("curse.maven:project-e-226410:4860858") // ProjectE-1.19.2-PE1.1.0.jar
}
// This block of code expands all declared replace properties in the specified resource tar+gets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
neo_version_range : neo_version_range,
loader_version_range : loader_version_range,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description,
mod_issue_tracker : mod_issue_tracker
]
processResources {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
inputs.properties replaceProperties
replaceProperties.put 'project', project
filesMatching(resourceTargets) {
expand replaceProperties
}
}
processGametestResources {
duplicatesStrategy(DuplicatesStrategy.EXCLUDE)
}
test {
useJUnitPlatform()
}
// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
// Example configuration to allow publishing using the maven-publish plugin
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
// publish.dependsOn('reobfJar')
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
generateGrammarSource {
arguments = [
"-visitor",
"-Xexact-output-dir" // https://stackoverflow.com/a/79058733/11141271 fixes "can't find .tokens file" error for TomlParser.g4
]
outputDirectory = file("${project.buildDir}/generated-src/antlr/main/ca/teamdman/langs")
// include 'sfml/SFML.g4'
// // Include the lexer first
// include 'toml/TomlLexer.g4'
// include 'toml/TomlParser.g4'
}
compileJava {
dependsOn generateGrammarSource
}
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
// However, this causes gradle to throw "Error getting artifact" so keep it commented out to retain your sanity
//idea {
// module {
// downloadSources = true
// downloadJavadoc = true
// }
//}
// List of fully qualified entry point classes
def entryPoints = [
'ca.teamdman.ai.ProjectTestMethodLister',
'ca.teamdman.ai.ProjectEverythingLister'
// Add more classes here as needed
]
entryPoints.each { className ->
// Extract simple class name for the task name (e.g., ProjectTestMethodLister)
def simpleClassName = className.substring(className.lastIndexOf('.') + 1)
// Define a task name, e.g., runProjectTestMethodLister
def taskName = "run${simpleClassName}"
// Create the JavaExec task
//noinspection ConfigurationAvoidance
task(taskName, type: JavaExec) {
group = 'Execution'
description = "Runs the ${className} class"
// Set the main class to run
mainClass.set(className)
// Set the classpath to include compiled test classes and dependencies
classpath = sourceSets.test.runtimeClasspath
// Optional: Set JVM arguments if needed
// e.g., jvmArgs = ['-Xmx1G']
}
}