Skip to content

Commit 9728a95

Browse files
committed
build updates & 37a
1 parent 371b70b commit 9728a95

9 files changed

Lines changed: 143 additions & 125 deletions

File tree

build.gradle.kts

Lines changed: 7 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,11 @@ import me.modmuss50.mpp.ModPublishExtension
22
import me.modmuss50.mpp.ReleaseType
33

44
plugins {
5-
id("java-library")
5+
id("common-conventions")
66
id("net.neoforged.moddev")
77
id("me.modmuss50.mod-publish-plugin") version "0.8.4" apply false
88
}
99

10-
val getGitCommit = providers.exec {
11-
commandLine("git", "rev-parse", "--short", "HEAD")
12-
}.standardOutput.asText.map { it.trim() }
13-
1410
val aw2at = Aw2AtTask.configureDefault(
1511
project,
1612
layout.projectDirectory.file("src/main/resources/moonrise.accesswidener").asFile,
@@ -24,71 +20,21 @@ neoForge {
2420
}
2521

2622
dependencies {
27-
compileOnly("net.fabricmc:sponge-mixin:0.15.4+mixin.0.8.7")
28-
compileOnly("io.github.llamalad7:mixinextras-common:0.4.1")
23+
compileOnly(libs.mixin)
24+
compileOnly(libs.mixinExtras)
2925
// work around minecraft (MDG) forcing ASM 9.3 which is incompatible with the above deps...
3026
components.withModule("net.neoforged:minecraft-dependencies", RemoveAsmConstraint::class.java)
3127

32-
api("ca.spottedleaf:concurrentutil:${rootProject.property("concurrentutil_version")}") { isTransitive = false }
33-
api("ca.spottedleaf:yamlconfig:${rootProject.property("yamlconfig_version")}") { isTransitive = false }
34-
api("org.yaml:snakeyaml:${rootProject.property("snakeyaml_version")}")
28+
api(libs.concurrentutil) { isTransitive = false }
29+
api(libs.yamlconfig) { isTransitive = false }
30+
api(libs.snakeyaml)
3531

3632
// todo: does cloth publish a platform-agnostic jar in mojang mappings?
37-
compileOnly("me.shedaniel.cloth:cloth-config-neoforge:${rootProject.property("cloth_version")}")
38-
}
39-
40-
allprojects {
41-
group = rootProject.property("maven_group").toString()
42-
version = rootProject.property("mod_version").toString() + "+" + getGitCommit.get()
43-
44-
plugins.apply("java-library")
45-
46-
java {
47-
withSourcesJar()
48-
49-
toolchain {
50-
languageVersion = JavaLanguageVersion.of(21)
51-
}
52-
}
53-
54-
dependencies {
55-
testImplementation("org.junit.jupiter:junit-jupiter:${rootProject.property("junit_version")}")
56-
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
57-
}
58-
59-
tasks.test {
60-
useJUnitPlatform()
61-
}
62-
63-
// make build reproducible
64-
tasks.withType<AbstractArchiveTask>().configureEach {
65-
isPreserveFileTimestamps = false
66-
isReproducibleFileOrder = true
67-
}
68-
69-
tasks.withType<JavaCompile>().configureEach {
70-
options.release.set(21)
71-
}
72-
73-
val archivesBaseName = rootProject.base.archivesName.get()
74-
tasks.named<org.gradle.jvm.tasks.Jar>("jar").configure {
75-
from(rootProject.file("LICENSE")) {
76-
rename { "${it}_${archivesBaseName}" }
77-
}
78-
}
33+
compileOnly(libs.clothConfig.neoforge)
7934
}
8035

8136
subprojects {
8237
plugins.apply("me.modmuss50.mod-publish-plugin")
83-
plugins.apply("com.gradleup.shadow")
84-
85-
configurations.create("libs")
86-
configurations.named("shadow") {
87-
extendsFrom(configurations.getByName("libs"))
88-
}
89-
configurations.named("implementation") {
90-
extendsFrom(configurations.getByName("libs"))
91-
}
9238

9339
configure<ModPublishExtension> {
9440
if (project.version.toString().contains("-beta.")) {
@@ -112,16 +58,4 @@ subprojects {
11258
minecraftVersions = supportedMcVersions
11359
}
11460
}
115-
116-
// Setup a run with lithium for compatibility testing
117-
configurations.create("lithium")
118-
dependencies {
119-
var coordinates = "maven.modrinth:lithium:"
120-
if (project.name == "Moonrise-NeoForge") {
121-
coordinates += rootProject.property("neo_lithium_version").toString()
122-
} else {
123-
coordinates += rootProject.property("fabric_lithium_version").toString()
124-
}
125-
add("lithium", coordinates)
126-
}
12761
}

buildSrc/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ repositories {
1414
dependencies {
1515
implementation("net.fabricmc:access-widener:2.1.0")
1616
implementation("dev.architectury:at:1.0.1")
17+
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:9.1.0")
1718
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id("java-library")
3+
}
4+
5+
val getGitCommit = providers.exec {
6+
commandLine("git", "rev-parse", "--short", "HEAD")
7+
}.standardOutput.asText.map { it.trim() }
8+
9+
version = version.toString() + "+" + getGitCommit.get()
10+
11+
java {
12+
withSourcesJar()
13+
14+
toolchain {
15+
languageVersion = JavaLanguageVersion.of(21)
16+
}
17+
}
18+
19+
dependencies {
20+
testImplementation("org.junit.jupiter:junit-jupiter:${rootProject.property("junit_version")}")
21+
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
22+
}
23+
24+
tasks.test {
25+
useJUnitPlatform()
26+
}
27+
28+
// make build reproducible
29+
tasks.withType<AbstractArchiveTask>().configureEach {
30+
isPreserveFileTimestamps = false
31+
isReproducibleFileOrder = true
32+
}
33+
34+
tasks.withType<JavaCompile>().configureEach {
35+
options.release = 21
36+
}
37+
38+
tasks.named<Jar>("jar").configure {
39+
val archivesBaseName = rootProject.base.archivesName.get()
40+
val licenseFile = rootProject.file("LICENSE")
41+
from(licenseFile) {
42+
rename { "${it}_${archivesBaseName}" }
43+
}
44+
}
Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
2-
id("java-library")
2+
id("common-conventions")
3+
id("com.gradleup.shadow")
34
}
45

56
extensions.create<RunConfigCommon>("runConfigCommon")
@@ -8,3 +9,27 @@ extensions.configure<RunConfigCommon>("runConfigCommon") {
89
systemProperties.put("Moonrise.MaxViewDistance", "128")
910
jvmArgs.addAll(listOf("-XX:+UseZGC", "-XX:+ZGenerational", "-XX:+UseDynamicNumberOfGCThreads", "-XX:-ZUncommit"))
1011
}
12+
13+
configurations.create("libs")
14+
configurations.named("shadow") {
15+
extendsFrom(configurations.getByName("libs"))
16+
}
17+
configurations.named("implementation") {
18+
extendsFrom(configurations.getByName("libs"))
19+
}
20+
21+
// Setup a run with lithium for compatibility testing
22+
configurations.create("lithium")
23+
dependencies {
24+
var coordinates = "maven.modrinth:lithium:"
25+
if (project.name == "Moonrise-NeoForge") {
26+
coordinates += rootProject.property("neo_lithium_version").toString()
27+
} else {
28+
coordinates += rootProject.property("fabric_lithium_version").toString()
29+
}
30+
add("lithium", coordinates)
31+
}
32+
33+
tasks.shadowJar {
34+
mergeServiceFiles()
35+
}

fabric/build.gradle.kts

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,28 @@ if (gui) {
1414
}
1515

1616
dependencies {
17-
minecraft("com.mojang:minecraft:${rootProject.property("minecraft_version")}")
17+
minecraft(libs.fabricMinecraft)
1818
mappings(loom.officialMojangMappings())
19-
modImplementation("net.fabricmc:fabric-loader:${rootProject.property("loader_version")}")
20-
testImplementation("net.fabricmc:fabric-loader-junit:${rootProject.property("loader_version")}")
19+
modImplementation(libs.fabricLoader)
20+
testImplementation(libs.fabricLoader.junit)
2121

2222
runtimeOnly(rootProject.sourceSets.main.get().output)
2323
shadow(project(":"))
2424
compileOnly(project(":"))
2525

26-
libs("ca.spottedleaf:concurrentutil:${rootProject.property("concurrentutil_version")}") { isTransitive = false }
27-
libs("ca.spottedleaf:yamlconfig:${rootProject.property("yamlconfig_version")}") { isTransitive = false }
28-
libs("org.yaml:snakeyaml:${rootProject.property("snakeyaml_version")}")
26+
libs(libs.concurrentutil) { isTransitive = false }
27+
libs(libs.yamlconfig) { isTransitive = false }
28+
libs(libs.snakeyaml)
2929

3030
if (gui) {
3131
add("guiCompileOnly", project(":"))
3232
runtimeOnly(sourceSets.named("gui").get().output)
3333
shadow(sourceSets.named("gui").get().output)
34-
add("modGuiImplementation", "me.shedaniel.cloth:cloth-config-fabric:${rootProject.property("cloth_version")}")
35-
modRuntimeOnly("me.shedaniel.cloth:cloth-config-fabric:${rootProject.property("cloth_version")}")
36-
include("me.shedaniel.cloth:cloth-config-fabric:${rootProject.property("cloth_version")}")
37-
add("modGuiImplementation", "com.terraformersmc:modmenu:${rootProject.property("modmenu_version")}")
38-
modRuntimeOnly("com.terraformersmc:modmenu:${rootProject.property("modmenu_version")}")
34+
add("modGuiImplementation", libs.clothConfig.fabric)
35+
modRuntimeOnly(libs.clothConfig.fabric)
36+
include(libs.clothConfig.fabric)
37+
add("modGuiImplementation", libs.modmenu)
38+
modRuntimeOnly(libs.modmenu)
3939
}
4040

4141
modImplementation(platform(fabricApiLibs.bom))
@@ -56,9 +56,8 @@ if (gui) {
5656
tasks.processResources {
5757
val properties = mapOf(
5858
"version" to project.version,
59-
"minecraft_version" to rootProject.property("minecraft_version").toString(),
60-
"loader_version" to rootProject.property("loader_version").toString(),
61-
"mod_version" to rootProject.property("mod_version").toString()
59+
"minecraft_version" to libs.versions.minecraft.get(),
60+
"loader_version" to libs.versions.fabricLoader.get(),
6261
)
6362
inputs.properties(properties)
6463
filesMatching("fabric.mod.json") {
@@ -68,7 +67,6 @@ tasks.processResources {
6867

6968
tasks.shadowJar {
7069
archiveClassifier.set("dev-all")
71-
destinationDirectory.set(layout.buildDirectory.dir("libs"))
7270
configurations = listOf(project.configurations.getByName("shadow"))
7371
relocate("ca.spottedleaf.concurrentutil", "ca.spottedleaf.moonrise.libs.ca.spottedleaf.concurrentutil")
7472
relocate("ca.spottedleaf.yamlconfig", "ca.spottedleaf.moonrise.libs.ca.spottedleaf.yamlconfig")
@@ -119,15 +117,12 @@ tasks.test {
119117
systemProperty("fabric.classPathGroups", classPathGroups)
120118
}
121119

122-
afterEvaluate {
123-
val runConfigCommon = extensions.getByType(RunConfigCommon::class)
124-
loom.runs.configureEach {
125-
runConfigCommon.systemProperties.get().forEach {
126-
property(it.key, it.value)
127-
}
128-
runConfigCommon.jvmArgs.get().forEach {
129-
vmArgs.add(it)
130-
}
120+
loom.runs.configureEach {
121+
runConfigCommon.systemProperties.get().forEach {
122+
property(it.key, it.value)
123+
}
124+
runConfigCommon.jvmArgs.get().forEach {
125+
vmArgs.add(it)
131126
}
132127
}
133128

gradle.properties

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
1-
# Done to increase the memory available to gradle.
1+
version=0.7.0-SNAPSHOT
2+
group=ca.spottedleaf.moonrise
3+
archives_base_name=moonrise
4+
25
org.gradle.jvmargs=-Xmx2G
36
org.gradle.parallel=true
47
org.gradle.caching=true
58
org.gradle.configuration-cache=true
6-
# Fabric Properties
7-
# check these on https://fabricmc.net/develop/
8-
minecraft_version=25w36b
9-
loader_version=0.17.2
10-
supported_minecraft_versions=25w36b
11-
neoforge_version=21.8.1-beta
12-
neoform_version=25w36b-20250902.170629
9+
10+
# comma separated list for modrinth/curseforge
11+
supported_minecraft_versions=25w37a
12+
13+
# parchment param mappings and javadoc for common/neo
1314
neoForge.parchment.parchmentArtifact=io.papermc.parchment.data:parchment-25w36a:2025.09.02
15+
16+
# https://projects.neoforged.net/neoforged/neoforge
17+
neoforge_version=21.8.1-beta
18+
# https://projects.neoforged.net/neoforged/neoform
19+
neoform_version=25w37a-20250909.153457
20+
21+
# https://fabricmc.net/develop/
1422
fabric_api_version=0.133.1+1.21.9
15-
snakeyaml_version=2.3
16-
concurrentutil_version=0.0.3
17-
yamlconfig_version=1.0.2
18-
cloth_version=19.0.147
19-
modmenu_version=15.0.0-beta.3
23+
2024
# set to false when modmenu/cloth is not updated for the current minecraft version
2125
enable_gui=false
26+
2227
junit_version=5.11.3
28+
2329
# version ids from modrinth
2430
fabric_lithium_version=nhc57Td2
2531
neo_lithium_version=P5VT33Jo
26-
# Mod Properties
27-
mod_version=0.7.0-SNAPSHOT
28-
maven_group=ca.spottedleaf.moonrise
29-
archives_base_name=moonrise

gradle/libs.versions.toml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# https://fabricmc.net/develop/
2+
3+
[versions]
4+
# https://maven.shedaniel.me/me/shedaniel/cloth/
5+
cloth = "19.0.147"
6+
fabricLoader = "0.17.2"
7+
minecraft = "25w37a"
8+
9+
[plugins]
10+
11+
[libraries]
12+
mixin = "org.spongepowered:mixin:0.8.7"
13+
mixinExtras = "io.github.llamalad7:mixinextras-common:0.4.1"
14+
15+
fabricLoader = { module = "net.fabricmc:fabric-loader", version.ref = "fabricLoader" }
16+
fabricLoader-junit = { module = "net.fabricmc:fabric-loader-junit", version.ref = "fabricLoader" }
17+
fabricMinecraft = { module = "com.mojang:minecraft", version.ref = "minecraft" }
18+
19+
concurrentutil = "ca.spottedleaf:concurrentutil:0.0.3"
20+
21+
yamlconfig = "ca.spottedleaf:yamlconfig:1.0.2"
22+
snakeyaml = "org.yaml:snakeyaml:2.3"
23+
24+
clothConfig-neoforge = { module = "me.shedaniel.cloth:cloth-config-neoforge", version.ref = "cloth" }
25+
clothConfig-fabric = { module = "me.shedaniel.cloth:cloth-config-fabric", version.ref = "cloth" }
26+
modmenu = "com.terraformersmc:modmenu:15.0.0-beta.3"

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pluginManagement {
2525
plugins {
2626
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
2727
id("quiet-fabric-loom") version "1.11.325"
28+
// https://projects.neoforged.net/neoforged/moddevgradle
2829
id("net.neoforged.moddev.repositories") version "2.0.107"
29-
id("com.gradleup.shadow") version "9.1.0" apply false
3030
}
3131

3232
dependencyResolutionManagement {

src/main/java/ca/spottedleaf/moonrise/mixin/chunk_system/ChunkMapMixin.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -738,13 +738,4 @@ public void waitForLightBeforeSending(final ChunkPos centerPos, final int radius
738738
public int size() {
739739
return ((ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler().chunkHolderManager.size();
740740
}
741-
742-
/**
743-
* @reason Route to new chunk system
744-
* @author Spottedleaf
745-
*/
746-
@Overwrite
747-
public Iterable<ChunkHolder> getChunks() {
748-
return ((ChunkSystemServerLevel)this.level).moonrise$getChunkTaskScheduler().chunkHolderManager.getOldChunkHoldersIterable();
749-
}
750741
}

0 commit comments

Comments
 (0)