[*] Introduce Fabric helper and adjust a bunch of stuff
This commit is contained in:
@@ -6,6 +6,8 @@ plugins {
|
||||
|
||||
dependencies {
|
||||
implementation("de.siphalor.tweed5:tweed5-conventions")
|
||||
implementation("de.siphalor.tweed5:tweed5-conventions-helpers")
|
||||
implementation(pluginMarker(mcCommonLibs.plugins.fabric.loom))
|
||||
implementation(pluginMarker(mcCommonLibs.plugins.jcyo))
|
||||
implementation(pluginMarker(libs.plugins.lombok))
|
||||
}
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
import de.siphalor.tweed5.gradle.plugin.minecraft.mod.MinecraftModded
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
java
|
||||
id("fabric-loom")
|
||||
id("de.siphalor.tweed5.expanded-sources-jar")
|
||||
id("de.siphalor.jcyo")
|
||||
id("io.freefair.lombok")
|
||||
id("de.siphalor.tweed5.shadow.explicit")
|
||||
id("de.siphalor.tweed5.minecraft.mod.base")
|
||||
}
|
||||
|
||||
@@ -23,11 +28,20 @@ val shortVersion = project.property("tweed5.version").toString()
|
||||
val minecraftVersion = getMcCatalogVersion("minecraft")
|
||||
version = "$shortVersion+mc$minecraftVersion"
|
||||
|
||||
sourceSets {
|
||||
create("testmod") {
|
||||
compileClasspath += sourceSets.main.get().compileClasspath
|
||||
runtimeClasspath += sourceSets.main.get().runtimeClasspath
|
||||
val testmod by sourceSets.creating {
|
||||
compileClasspath += sourceSets.main.get().compileClasspath
|
||||
runtimeClasspath += sourceSets.main.get().runtimeClasspath
|
||||
}
|
||||
|
||||
loom {
|
||||
runs {
|
||||
create("testmodClient") {
|
||||
client()
|
||||
name("${properties["module.name"]} Test Mod (client)")
|
||||
source(testmod)
|
||||
}
|
||||
}
|
||||
createRemapConfigurations(testmod)
|
||||
}
|
||||
|
||||
// For some reason dependencyResolutionManagement from the settings.gradle doesn't seem to be passed through correctly,
|
||||
@@ -49,6 +63,14 @@ repositories {
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
named("testmodRuntimeClasspath") {
|
||||
attributes {
|
||||
attribute(MinecraftModded.MINECRAFT_MODDED_ATTRIBUTE, objects.named(MinecraftModded.MODDED))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft(mcCatalog.findLibrary("minecraft").get())
|
||||
mappings(loom.layered {
|
||||
@@ -56,6 +78,48 @@ dependencies {
|
||||
parchment("org.parchmentmc.data:parchment-$minecraftVersion:${getMcCatalogVersion("parchment")}@zip")
|
||||
})
|
||||
modImplementation(mcCommonLibs.fabric.loader)
|
||||
|
||||
compileOnly(libs.jspecify.annotations)
|
||||
|
||||
"testmodImplementation"(sourceSets.main.map { it.output })
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
lombok {
|
||||
version = libs.versions.lombok.get()
|
||||
}
|
||||
|
||||
tasks.jar {
|
||||
dependsOn(tasks.processMinecraftModResources)
|
||||
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
}
|
||||
|
||||
tasks.sourcesJar {
|
||||
dependsOn(tasks.processMinecraftModResources)
|
||||
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processTestmodResources") {
|
||||
inputs.property("id", project.name)
|
||||
inputs.property("version", project.version)
|
||||
inputs.property("name", properties["module.name"])
|
||||
inputs.property("description", properties["module.description"])
|
||||
inputs.property("repoUrl", properties["git.url"])
|
||||
|
||||
from(project.layout.settingsDirectory.dir("../tweed5-minecraft/mod-template/resources")) {
|
||||
expand(mapOf(
|
||||
"id" to project.name.replace('-', '_') + "_testmod",
|
||||
"version" to project.version,
|
||||
"name" to properties["module.name"].toString() + " (test mod)",
|
||||
"description" to properties["module.description"],
|
||||
"repoUrl" to properties["git.url"],
|
||||
))
|
||||
}
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
fun getMcCatalogVersion(name: String): String {
|
||||
|
||||
Reference in New Issue
Block a user