Skip to content

Commit

Permalink
build: Replace hacky workarounds for run configs
Browse files Browse the repository at this point in the history
  • Loading branch information
jpenilla committed Dec 5, 2024
1 parent 1f4ee85 commit 371424f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
5 changes: 4 additions & 1 deletion mod-shared/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,8 @@ sourceSets {
}

tasks.jar {
manifest.attributes("FMLModType": "GAMELIBRARY")
manifest.attributes(
"FMLModType": "GAMELIBRARY",
"Automatic-Module-Name": "net.kyori.adventure.platform.mod.shared"
)
}
17 changes: 2 additions & 15 deletions neoforge/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import net.neoforged.moddevgradle.internal.RunGameTask

plugins {
id("net.neoforged.moddev")
id("publishing-conventions")
Expand All @@ -17,11 +15,9 @@ neoForge {
runs {
register("client") {
client()
mods.set(emptySet()) // Work around classpath issues by using the production jar for dev runs
}
register("server") {
server()
mods.set(emptySet()) // Work around classpath issues by using the production jar for dev runs
}
}

Expand All @@ -32,25 +28,16 @@ neoForge {
}
}

// Work around classpath issues by using the production jar for dev runs
tasks.withType<RunGameTask>().configureEach {
dependsOn(tasks.jar)
doFirst {
val jar = file("run/mods/main.jar")
jar.parentFile.mkdirs()
tasks.jar.get().archiveFile.get().asFile.copyTo(jar, true)
}
}

configurations.jarJar {
extendsFrom(configurations.jarInJar.get())
}

dependencies {
additionalRuntimeClasspath(project(":adventure-platform-neoforge:adventure-platform-neoforge-services"))
implementation(project(":adventure-platform-neoforge:adventure-platform-neoforge-services"))
jarJar(project(":adventure-platform-neoforge:adventure-platform-neoforge-services"))

compileOnlyApi(project(":adventure-platform-mod-shared"))
api(project(":adventure-platform-mod-shared"))
jarJar(project(":adventure-platform-mod-shared"))
}

Expand Down
16 changes: 1 addition & 15 deletions neoforge/tester/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import java.nio.file.Files
import net.neoforged.moddevgradle.internal.RunGameTask

plugins {
id("net.neoforged.moddev")
alias(libs.plugins.indra.checkstyle)
Expand All @@ -14,17 +11,16 @@ neoForge {
runs {
register("client") {
client()
mods.set(HashSet())
}
register("server") {
server()
mods.set(HashSet())
}
}

mods {
register("adventure-platform-neoforge-tester") {
sourceSet(sourceSets.main.get())
sourceSet(project(":test-resources").sourceSets.main.get())
}
}
}
Expand All @@ -33,16 +29,6 @@ tasks.jar {
from(project(":test-resources").sourceSets.main.get().output)
}

tasks.withType(RunGameTask::class.java).configureEach {
dependsOn(tasks.jar)
doFirst {
val jar = file("run/mods/main.jar")
jar.parentFile.mkdirs()
if (jar.exists()) jar.delete()
Files.copy(tasks.jar.get().archiveFile.get().asFile.toPath(), jar.toPath())
}
}

dependencies {
implementation(project(":adventure-platform-neoforge"))
jarJar(project(":adventure-platform-neoforge"))
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pluginManagement {
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
id("fabric-loom") version "1.9.2"
id("net.neoforged.moddev.repositories") version "1.0.23"
id("net.neoforged.moddev.repositories") version "2.0.52-beta"
}

rootProject.name = "adventure-platform-mod-parent"
Expand Down

0 comments on commit 371424f

Please sign in to comment.