[build] Setup project for cross-version Minecraft development
This commit is contained in:
11
tweed5-minecraft/conventions/build.gradle.kts
Normal file
11
tweed5-minecraft/conventions/build.gradle.kts
Normal file
@@ -0,0 +1,11 @@
|
||||
import dev.panuszewski.gradle.pluginMarker
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("de.siphalor.tweed5:tweed5-conventions")
|
||||
implementation(pluginMarker(mcCommonLibs.plugins.fabric.loom))
|
||||
implementation(pluginMarker(mcCommonLibs.plugins.jcyo))
|
||||
}
|
||||
37
tweed5-minecraft/conventions/settings.gradle.kts
Normal file
37
tweed5-minecraft/conventions/settings.gradle.kts
Normal file
@@ -0,0 +1,37 @@
|
||||
plugins {
|
||||
id("dev.panuszewski.typesafe-conventions") version "0.9.0"
|
||||
}
|
||||
|
||||
typesafeConventions {
|
||||
autoPluginDependencies = false
|
||||
}
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = "Siphalor"
|
||||
url = uri("https://maven.siphalor.de")
|
||||
mavenContent {
|
||||
includeGroupAndSubgroups("de.siphalor")
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "FabricMC"
|
||||
url = uri("https://maven.fabricmc.net")
|
||||
mavenContent {
|
||||
includeGroupAndSubgroups("net.fabricmc")
|
||||
includeGroup("fabric-loom")
|
||||
}
|
||||
}
|
||||
}
|
||||
versionCatalogs {
|
||||
create("libs") {
|
||||
from(files("../../gradle/libs.versions.toml"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
includeBuild("../../conventions")
|
||||
|
||||
rootProject.name = "tweed5-minecraft-conventions"
|
||||
@@ -0,0 +1,63 @@
|
||||
import java.util.Properties
|
||||
|
||||
plugins {
|
||||
id("fabric-loom")
|
||||
id("de.siphalor.jcyo")
|
||||
id("de.siphalor.tweed5.minecraft.mod.base")
|
||||
}
|
||||
|
||||
val minecraftVersionDescriptor = project.property("minecraft.version.descriptor") as String
|
||||
val mcProps = Properties().apply {
|
||||
val propFile = project.layout.settingsDirectory.file("gradle/mc-$minecraftVersionDescriptor/gradle.properties").asFile
|
||||
propFile.inputStream().use { load(it) }
|
||||
}
|
||||
|
||||
val mcCatalog = versionCatalogs.named("mcLibs")
|
||||
|
||||
group = "de.siphalor.tweed5.minecraft.${project.name}"
|
||||
val archivesBaseName = "${project.name}-mc$minecraftVersionDescriptor"
|
||||
base {
|
||||
archivesName.set(archivesBaseName)
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
// For some reason dependencyResolutionManagement from the settings.gradle doesn't seem to be passed through correctly,
|
||||
// so we're defining the repositories right here
|
||||
repositories {
|
||||
maven {
|
||||
name = "Parchment"
|
||||
url = uri("https://maven.parchmentmc.org")
|
||||
mavenContent {
|
||||
includeGroupAndSubgroups("org.parchmentmc")
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "Siphalor"
|
||||
url = uri("https://maven.siphalor.de")
|
||||
mavenContent {
|
||||
includeGroupAndSubgroups("de.siphalor")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft(mcCatalog.findLibrary("minecraft").get())
|
||||
mappings(loom.layered {
|
||||
officialMojangMappings()
|
||||
parchment("org.parchmentmc.data:parchment-$minecraftVersion:${getMcCatalogVersion("parchment")}@zip")
|
||||
})
|
||||
modImplementation(mcCommonLibs.fabric.loader)
|
||||
}
|
||||
|
||||
fun getMcCatalogVersion(name: String): String {
|
||||
return mcCatalog.findVersion(name).get().requiredVersion
|
||||
}
|
||||
Reference in New Issue
Block a user