Improved build.gradle

This commit is contained in:
2026-02-23 03:45:26 +01:00
parent f9c0d3fe58
commit c5c38247cc
+144 -42
View File
@@ -1,46 +1,126 @@
/*
* ================================================================
* Saturn Client - Fabric Mod Build Configuration
* ================================================================
*
* This build file configures:
* - Fabric Loom (Minecraft mod development)
* - Dependency management
* - Resource processing
* - Java toolchain (Java 21)
* - Publishing setup
*
* All version values are defined in gradle.properties.
* ================================================================
*/
plugins { plugins {
// Fabric mod development plugin
id 'fabric-loom' version '1.9-SNAPSHOT' id 'fabric-loom' version '1.9-SNAPSHOT'
// Maven publishing support
id 'maven-publish' id 'maven-publish'
} }
/*
* ================================================================
* Project Metadata
* ================================================================
*/
version = project.mod_version version = project.mod_version
group = project.maven_group group = project.maven_group
repositories {}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
// Switch back to Yarn
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi "dev.felnull:special-model-loader:1.4.0+pre.1"
include "dev.felnull:special-model-loader:1.4.0+pre.1"
implementation 'com.github.selimaj-dev:session-java:0.1.4'
// implementation("com.kitfox.svg:svg-salamander:1.1.3")
implementation 'com.formdev:svgSalamander:1.1.4'
include modImplementation("dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}")
//You might want bendy-lib. playerAnimator will wrap it.
// include modRuntimeOnly("io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}")
}
/*
* ================================================================
* Repositories
* ================================================================
* All dependency sources.
*/
repositories { repositories {
// Fabric
maven { url 'https://maven.fabricmc.net/' } maven { url 'https://maven.fabricmc.net/' }
maven { url 'https://jitpack.io' }
maven { url "https://maven.parchmentmc.org" }
maven { name = "FelNull Maven"; url = "https://maven.felnull.dev" }
maven { name = "KosmX maven"; url = 'https://maven.kosmx.dev/' }
// JitPack (GitHub releases)
maven { url 'https://jitpack.io' }
// Parchment mappings (if needed later)
maven { url 'https://maven.parchmentmc.org' }
// Special Model Loader
maven { name = "FelNull Maven"; url = "https://maven.felnull.dev" }
// Player Animation Library
maven { name = "KosmX Maven"; url = 'https://maven.kosmx.dev/' }
// Central repository
mavenCentral() mavenCentral()
} }
/*
* ================================================================
* Dependencies
* ================================================================
*/
dependencies {
// ─────────────────────────────────────────────
// Minecraft Core
// ─────────────────────────────────────────────
minecraft "com.mojang:minecraft:${project.minecraft_version}"
// Yarn mappings (named mappings for dev environment)
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
// Fabric Loader
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// Fabric API
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
// ─────────────────────────────────────────────
// Rendering / Model Libraries
// ─────────────────────────────────────────────
// Special Model Loader (included inside your mod jar)
modApi "dev.felnull:special-model-loader:1.4.0+pre.1"
include "dev.felnull:special-model-loader:1.4.0+pre.1"
// SVG Rendering Library
implementation "com.formdev:svgSalamander:1.1.4"
// ─────────────────────────────────────────────
// Animation
// ─────────────────────────────────────────────
// Player Animation Library (bundled into your mod)
include modImplementation(
"dev.kosmx.player-anim:player-animation-lib-fabric:${project.player_anim}"
)
// Optional: BendyLib (only if you directly use it)
// include modRuntimeOnly(
// "io.github.kosmx.bendy-lib:bendy-lib-fabric:${project.bendylib_version}"
// )
// ─────────────────────────────────────────────
// External Libraries
// ─────────────────────────────────────────────
// Session Java (auth/session handling)
implementation "com.github.selimaj-dev:session-java:0.1.4"
}
/*
* ================================================================
* Resource Processing
* ================================================================
* Injects version values into fabric.mod.json.
*/
processResources { processResources {
inputs.property "version", project.version inputs.property "version", project.version
inputs.property "minecraft_version", project.minecraft_version inputs.property "minecraft_version", project.minecraft_version
@@ -48,38 +128,58 @@ processResources {
filteringCharset "UTF-8" filteringCharset "UTF-8"
filesMatching("fabric.mod.json") { filesMatching("fabric.mod.json") {
expand "version": project.version, expand(
"version": project.version,
"minecraft_version": project.minecraft_version, "minecraft_version": project.minecraft_version,
"loader_version": project.loader_version "loader_version": project.loader_version
)
} }
} }
/*
* ================================================================
* Java Configuration
* ================================================================
* Targeting Java 21.
*/
def targetJavaVersion = 21 def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8" options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { options.release.set(targetJavaVersion)
it.options.release.set(targetJavaVersion)
}
} }
java { java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion) toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
withSourcesJar() withSourcesJar()
} }
/*
* ================================================================
* Jar Packaging
* ================================================================
* Includes LICENSE and NOTICE inside the final jar.
*/
jar { jar {
from("LICENSE") { from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"} rename { "${it}_${project.archivesBaseName}" }
} }
from("NOTICE") { from("NOTICE") {
rename { "${it}_${project.archivesBaseName}"} rename { "${it}_${project.archivesBaseName}" }
} }
} }
/*
* ================================================================
* Publishing
* ================================================================
* Configured but no remote repository defined yet.
*/
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
@@ -87,5 +187,7 @@ publishing {
} }
} }
repositories {} repositories {
// Add publishing repository here when needed
}
} }