[build] Setup project for cross-version Minecraft development
This commit is contained in:
@@ -1,7 +1,13 @@
|
|||||||
|
import dev.panuszewski.gradle.pluginMarker
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`kotlin-dsl`
|
`kotlin-dsl`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
group = "de.siphalor.tweed5"
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":helpers"))
|
implementation(project(":helpers"))
|
||||||
|
implementation(pluginMarker(libs.plugins.lombok))
|
||||||
|
implementation(pluginMarker(libs.plugins.shadow))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ plugins {
|
|||||||
id("dev.panuszewski.typesafe-conventions") version "0.9.0"
|
id("dev.panuszewski.typesafe-conventions") version "0.9.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typesafeConventions {
|
||||||
|
autoPluginDependencies = false
|
||||||
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ plugins {
|
|||||||
java
|
java
|
||||||
`java-library`
|
`java-library`
|
||||||
jacoco
|
jacoco
|
||||||
alias(libs.plugins.lombok)
|
id("io.freefair.lombok")
|
||||||
id("de.siphalor.tweed5.publishing")
|
id("de.siphalor.tweed5.publishing")
|
||||||
id("de.siphalor.tweed5.local-runtime-only")
|
id("de.siphalor.tweed5.local-runtime-only")
|
||||||
id("de.siphalor.tweed5.expanded-sources-jar")
|
id("de.siphalor.tweed5.expanded-sources-jar")
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import io.freefair.gradle.plugins.lombok.tasks.Delombok
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
`java-library`
|
`java-library`
|
||||||
alias(libs.plugins.lombok)
|
id("io.freefair.lombok")
|
||||||
}
|
}
|
||||||
|
|
||||||
val expandedSourcesElements = configurations.consumable("expandedSourcesElements") {
|
val expandedSourcesElements = configurations.consumable("expandedSourcesElements") {
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
plugins {
|
plugins {
|
||||||
`maven-publish`
|
id("com.gradleup.shadow")
|
||||||
alias(libs.plugins.shadow)
|
|
||||||
java
|
java
|
||||||
`java-library`
|
`java-library`
|
||||||
|
id("de.siphalor.tweed5.publishing")
|
||||||
id("de.siphalor.tweed5.minecraft.mod.component")
|
id("de.siphalor.tweed5.minecraft.mod.component")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,16 +32,3 @@ val minecraftModSourcesJar = tasks.register<Jar>("minecraftModSourcesJar") {
|
|||||||
|
|
||||||
artifacts.add("minecraftModElements", minecraftModJar)
|
artifacts.add("minecraftModElements", minecraftModJar)
|
||||||
artifacts.add("minecraftModSourcesElements", minecraftModSourcesJar)
|
artifacts.add("minecraftModSourcesElements", minecraftModSourcesJar)
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications {
|
|
||||||
create<MavenPublication>("minecraftMod") {
|
|
||||||
groupId = "${project.group}.minecraft"
|
|
||||||
artifactId = project.name
|
|
||||||
version = project.version.toString()
|
|
||||||
|
|
||||||
from(components["minecraftMod"])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
|
`maven-publish`
|
||||||
|
id("de.siphalor.tweed5.publishing")
|
||||||
id("de.siphalor.tweed5.minecraft.mod.base")
|
id("de.siphalor.tweed5.minecraft.mod.base")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,3 +29,16 @@ tasks.named<Jar>("minecraftModSourcesJar") {
|
|||||||
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
from(project.layout.buildDirectory.dir("minecraftModResources"))
|
||||||
dependsOn(processMinecraftModResources)
|
dependsOn(processMinecraftModResources)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
publications {
|
||||||
|
create<MavenPublication>("minecraftMod") {
|
||||||
|
groupId = "${project.group}.minecraft"
|
||||||
|
artifactId = project.name
|
||||||
|
version = project.version.toString()
|
||||||
|
|
||||||
|
from(components["minecraftMod"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.shadow)
|
id("com.gradleup.shadow")
|
||||||
}
|
}
|
||||||
|
|
||||||
val shadowOnlyConfiguration = configurations.dependencyScope("shadowOnly")
|
val shadowOnlyConfiguration = configurations.dependencyScope("shadowOnly")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
plugins {
|
plugins {
|
||||||
java
|
java
|
||||||
alias(libs.plugins.lombok)
|
id("io.freefair.lombok")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id("de.siphalor.tweed5.publishing")
|
|
||||||
id("de.siphalor.tweed5.minecraft.mod.dummy")
|
id("de.siphalor.tweed5.minecraft.mod.dummy")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
tweed5-minecraft/coat-bridge/build.gradle.kts
Normal file
8
tweed5-minecraft/coat-bridge/build.gradle.kts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
plugins {
|
||||||
|
id("de.siphalor.tweed5.expanded-sources-jar")
|
||||||
|
id("de.siphalor.tweed5.minecraft.mod.cross-version")
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
modImplementation(mcLibs.coat)
|
||||||
|
}
|
||||||
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
|
||||||
|
}
|
||||||
1
tweed5-minecraft/gradle.properties
Normal file
1
tweed5-minecraft/gradle.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
minecraft.version.descriptor = 1.21.10
|
||||||
8
tweed5-minecraft/gradle/mc-1.21.10/mcLibs.versions.toml
Normal file
8
tweed5-minecraft/gradle/mc-1.21.10/mcLibs.versions.toml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[versions]
|
||||||
|
coat = "1.0.0-beta.23"
|
||||||
|
minecraft = "1.21.10"
|
||||||
|
parchment = "2025.10.12"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
coat = { group = "de.siphalor.coat", name = "coat-mc1.21.10", version.ref = "coat" }
|
||||||
|
minecraft = { group = "com.mojang", name = "minecraft", version.ref = "minecraft" }
|
||||||
11
tweed5-minecraft/gradle/mcCommonLibs.versions.toml
Normal file
11
tweed5-minecraft/gradle/mcCommonLibs.versions.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[versions]
|
||||||
|
fabric-loader = "0.17.2"
|
||||||
|
fabric-loom = "1.11-SNAPSHOT"
|
||||||
|
jcyo = "0.4.2"
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
jcyo = { id = "de.siphalor.jcyo", version.ref = "jcyo" }
|
||||||
|
fabric-loom = { id = "fabric-loom", version.ref = "fabric-loom" }
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
fabric-loader = { group = "net.fabricmc", name = "fabric-loader", version.ref = "fabric-loader" }
|
||||||
@@ -2,25 +2,54 @@ rootProject.name = "tweed5-minecraft"
|
|||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
includeBuild("../conventions")
|
includeBuild("../conventions")
|
||||||
|
includeBuild("conventions")
|
||||||
|
|
||||||
|
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")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
versionCatalogs {
|
versionCatalogs {
|
||||||
create("libs") {
|
create("libs") {
|
||||||
from(files("../gradle/libs.versions.toml"))
|
from(files("../gradle/libs.versions.toml"))
|
||||||
}
|
}
|
||||||
|
create("mcCommonLibs") {
|
||||||
|
from(files("gradle/mcCommonLibs.versions.toml"))
|
||||||
|
}
|
||||||
|
create("mcLibs") {
|
||||||
|
val mcVersionDescriptor = providers.gradleProperty("minecraft.version.descriptor").get()
|
||||||
|
from(files("gradle/mc-$mcVersionDescriptor/mcLibs.versions.toml"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
includeBuild("../tweed5")
|
includeBuild("../tweed5")
|
||||||
|
|
||||||
includeNormalModule("bundle")
|
includeNormalModule("bundle")
|
||||||
|
includeNormalModule("coat-bridge")
|
||||||
|
|
||||||
fun includeNormalModule(name: String) {
|
fun includeNormalModule(name: String) {
|
||||||
includeAs("tweed5-$name", "$name")
|
includeAs("tweed5-$name", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun includeAs(name: String, path: String) {
|
fun includeAs(name: String, path: String) {
|
||||||
|
|||||||
Reference in New Issue
Block a user