-
Notifications
You must be signed in to change notification settings - Fork 329
Expand file tree
/
Copy pathbuild.gradle
More file actions
400 lines (333 loc) · 12 KB
/
Copy pathbuild.gradle
File metadata and controls
400 lines (333 loc) · 12 KB
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
buildscript {
repositories {
maven {
url = "https://maven.minecraftforge.net"
}
}
}
plugins {
id 'java-library'
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'pmd'
id 'net.neoforged.moddev' version '2.0.120'
}
ext.configFile = file('build.properties')
ext.depsFile = file('dependencies.properties')
ext.config = parseConfig(configFile)
ext.deps = parseConfig(depsFile)
version = "${config.version}-${config.build_number}"
group = "org.violetmoon.${config.mod_id}" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
base.archivesName = config.mod_name
compileJava.options.compilerArgs << "-Xlint:all,-classfile,-processing,-deprecation"
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
if (System.getenv().RELEASE_MODE != "true") {
version += '-SNAPSHOT'
}
sourceSets {
main {
resources { srcDir 'src/generated/resources' }
}
//Weird hack for the clientBonus and serverBonus run configurations; MDG only allows
//the runtime classpath of one source-set to populate the runtime classpath of a runconfig AFAIK.
bonus { runtimeClasspath += main.runtimeClasspath }
}
// Used in order to keep Zeta up to date.
configurations.configureEach {
resolutionStrategy.cacheChangingModulesFor 1, 'hours'
}
neoForge {
version = deps.neoforge_version
//our accesstransformer.cfg is in the default location (meta-inf/accesstransformer.cfg)
//so its path doesn't need to be manually configured in mdg
validateAccessTransformers = true
mods {
quark {
sourceSet(sourceSets.main)
}
}
runs {
configureEach {
//tag the new run configs just so we remember to click them instead of the old NeoGradle run configs
ideName = ideName.get() + " (MDG)"
systemProperties.putAll ([
"mixin.debug.export": "true",
"forge.logging.markers": ["REGISTRIES"].join(","), //SCAN / REGISTRIES / REGISTRYDUMP
"forge.logging.console.level": org.slf4j.event.Level.DEBUG.toString(),
"quark.auditMixins": "true",
])
jvmArguments.addAll(
"-XX:+IgnoreUnrecognizedVMOptions", //not all VMs support this next flag:
"-XX:+AllowEnhancedClassRedefinition",
)
}
client {
client()
gameDirectory = project.file("run")
}
clientBonus {
client()
gameDirectory = project.file("run")
sourceSet = sourceSets.bonus
}
server {
server()
gameDirectory = project.file("runServer")
programArgument("--nogui")
}
serverBonus {
server()
gameDirectory = project.file("runServer")
programArgument("--nogui")
sourceSet = sourceSets.bonus
}
data {
data()
gameDirectory = project.file('runs/data')
programArguments.addAll ([
'--mod', 'quark',
'--all',
'--output', file('src/generated/resources').getAbsolutePath(),
'--existing', file('src/main/resources').getAbsolutePath()
])
}
}
parchment {
minecraftVersion = "1.21.1"
mappingsVersion = "2024.11.17"
}
}
repositories {
mavenLocal()
flatDir {
dirs 'localJars'
}
//Mainly for pmd
mavenCentral()
maven {
name = "blamejared"
url = "https://maven.blamejared.com"
content {
includeGroup("org.violetmoon.zeta")
includeGroup("mezz.jei")
includeGroup("noobanidus.mods.lootr")
includeGroup("blusunrize.immersiveengineering")
}
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com"
content {
includeModule("com.terraformersmc", "biolith-neoforge")
includeModule("dev.emi", "emi-neoforge")
}
}
maven {
name = "TheIllusiveC4"
url = "https://maven.theillusivec4.top/"
content {
includeGroup("top.theillusivec4.curios")
}
}
maven {
name = "Create"
url = "https://maven.createmod.net"
content {
includeGroup("net.createmod.ponder")
includeGroup("dev.engine-room.flywheel")
}
}
maven {
url "https://maven.squiddev.cc"
content {
includeGroup("cc.tweaked")
}
}
maven {
name = "cursemaven"
url = "https://www.cursemaven.com"
content {
includeGroup("curse.maven")
}
}
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
content {
includeGroup("maven.modrinth")
}
}
maven {
name = "Jitpack"
url = "https://jitpack.io"
content {
includeGroupByRegex("com\\.github\\..*")
}
}
//K4Unl's mirror of other modding-related mavens, in case they are down.
//Should be checked last; should **not** be the primary source for any artifact.
maven {
name = "ModMaven"
url = "https://modmaven.dev/"
content {
includeGroup("org.violetmoon.zeta")
includeGroup("mezz.jei")
// includeModule("com.terraformersmc", "biolith-neoforge") //Not mirrored
includeModule("net.fabricmc", "sponge-mixin")
includeGroup("top.theillusivec4.curios")
// includeGroup("net.createmod.ponder") //Not mirrored
}
}
}
dependencies {
//Zeta
implementation("org.violetmoon.zeta:Zeta:${deps.zeta_version}-SNAPSHOT") {
setChanging(true)
}
//Ponder - TODO, I think the plan is to jarJar this
// implementation("net.createmod.ponder:Ponder-NeoForge-${config.mc_version}:${deps.ponder_version}") { transitive = false }
// runtimeOnly("dev.engine-room.flywheel:flywheel-neoforge-${config.mc_version}:${deps.flywheel_version}")
//JEI
compileOnly("mezz.jei:jei-${config.mc_version}-neoforge-api:${deps.jei_version}")
runtimeOnly("mezz.jei:jei-${config.mc_version}-neoforge:${deps.jei_version}")
//Curios
runtimeOnly("top.theillusivec4.curios:curios-neoforge:${deps.curios_version}")
compileOnly("top.theillusivec4.curios:curios-neoforge:${deps.curios_version}:api")
//Biolith
implementation(jarJar("com.terraformersmc:biolith-neoforge:${deps.biolith_version}"))
//Flan - TODO, integration disabled
implementation("curse.maven:flan-forge-493246:${deps.flan_curse_file_id}")
//Lootr
implementation("noobanidus.mods.lootr:lootr-neoforge:${deps.lootr_version}")
//Optimized Block Entities
implementation("maven.modrinth:obe:${deps.obe_version}")
// Spark, which while kinda an extra in a sense, I feel is vital enough to development and testing where it should be in.
runtimeOnly("maven.modrinth:spark:${deps.spark_modrinth_file_id}")
// Jade
implementation "maven.modrinth:jade:${deps.jade_version}+neoforge"
//Extra dev-env toys - only present in ClientBonus and ServerBonus run configs
bonusRuntimeOnly("curse.maven:just-enough-resources-jer-240630:${deps.just_enough_resources_curse_file_id}")
bonusRuntimeOnly("curse.maven:nofog-296468:${deps.nofog_curse_file_id}") //PLEASE WORK
bonusRuntimeOnly("dev.emi:emi-neoforge:${deps.emi_version}")
bonusRuntimeOnly("maven.modrinth:blueprint:${deps.blueprint_modrinth_file_id}") //for Woodworks
bonusRuntimeOnly("maven.modrinth:woodworks:${deps.woodworks_modrinth_file_id}")
bonusRuntimeOnly("curse.maven:farmers-delight-398521:${deps.farmers_delight_curse_file_id}")
bonusRuntimeOnly("cc.tweaked:cc-tweaked-${config.mc_version}-forge:${deps.cct_version}") // Tests for a specific RegistryAccess issue basically.
bonusRuntimeOnly("blusunrize.immersiveengineering:ImmersiveEngineering:${deps.ie_version}")
}
pmd {
toolVersion '6.42.0'
incrementalAnalysis = true
threads = Runtime.getRuntime().availableProcessors()
ruleSets = []
ruleSetFiles = files("spotless/pmd-ruleset.xml")
//consoleOutput = true //TODO: Extremely spammy because the damn thing hasnt been running for weeks
}
tasks.register("checkSyntax") {
group "verification"
dependsOn tasks.pmdMain
}
processResources {
// copy everything excluding psd files
from(sourceSets.main.resources.srcDirs) {
exclude '**/psd/**'
duplicatesStrategy 'include'
}
// Formats 1.0-13.58 to 1.0-13 (removes the build number)
String zetaVer = deps.zeta_version.substring(0, deps.zeta_version.lastIndexOf('.'))
String curiosVer = deps.curios_version;
Map<String, ?> properties = Map.of(
"zeta_ver", zetaVer,
"curios_ver", curiosVer,
// Replaces FML's magic file.jarVersion string with the correct version at build time.
"file", [jarVersion: project.version]
)
properties.forEach((k, v) -> inputs.property(k, v))
filesMatching("META-INF/neoforge.mods.toml") {
expand properties
}
}
def parseConfig(File config) {
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
}
jar {
manifest {
attributes([
"Specification-Title": "${config.mod_id}",
"Specification-Vendor": "vazkii",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": "${config.mod_id}",
"Implementation-Version": "${version}",
"Implementation-Vendor" :"vazkii",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "quark.mixins.json,quark_integrations.mixins.json"
])
}
exclude "**/*.bat"
exclude "**/*.psd"
exclude "**/*.exe"
exclude "**/unused"
exclude "**/genscripts"
exclude ".cache"
}
//Omit all jar-in-jar dependencies for slimmer maven publishing
tasks.register("pureJar", Jar) {
dependsOn tasks.jar
archiveClassifier = "pure"
tasks.jar.outputs.files.forEach { j -> it.from(zipTree(j)) }
exclude "META-INF/jarjar/**"
}
tasks.register("sourcesJar", Jar) {
archiveClassifier = "sources"
from sourceSets.main.allJava
}
artifacts {
archives jar
archives pureJar
archives sourcesJar
}
publish.dependsOn(tasks.named("assemble"))
publish.mustRunAfter(tasks.named("build"))
publishing {
publications {
mavenJava(MavenPublication) {
groupId project.group
artifactId project.archivesBaseName
version project.version
from components.java
// Never publish any dependencies to maven
pom.withXml {
asNode().dependencies.dependency.each { dep ->
println 'Surpressing artifact ' + dep.artifactId.last().value().last() + ' from maven dependencies.'
assert dep.parent().remove(dep)
}
}
artifact pureJar //doesn't contain jar-in-jars
artifact sourcesJar
}
}
repositories {
maven {
url "file://" + System.getenv("local_maven")
}
}
}
// Disables Gradle's custom module metadata from being published to maven. The
// metadata includes mapped dependencies which are not reasonably consumable by
// other mod developers.
tasks.withType(GenerateModuleMetadata).configureEach {
enabled = false
}
allprojects {
gradle.projectsEvaluated {
tasks.withType(JavaCompile).configureEach {
options.compilerArgs << "-Xmaxerrs" << "5000"
}
}
}