Files
Jakob Schulz f373e3d6d9
Deploy / Build (push) Skipped
Pull Request Build / Build (pull_request) Failing after 17s
Add ViaAxiom
2026-11-01 15:30:21 +01:00

96 lines
2.7 KiB
Kotlin

import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
id("net.fabricmc.fabric-loom")
}
base {
archivesName.set(project.property("archives_base_name") as String)
}
val targetJavaVersion = 25
java {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
// Minecraft 26.2 uses official names; Loom packages the JAR without remapping.
withSourcesJar()
}
loom {
splitEnvironmentSourceSets()
mods {
register("viaaxiom") {
sourceSet("main")
sourceSet("client")
}
}
}
val bundledCore: Configuration by configurations.creating {
isCanBeConsumed = false
isTransitive = false
}
dependencies {
minecraft("com.mojang:minecraft:${project.property("minecraft_version")}")
implementation("net.fabricmc:fabric-loader:${project.property("loader_version")}")
implementation("net.fabricmc:fabric-language-kotlin:${project.property("kotlin_loader_version")}")
implementation("net.fabricmc.fabric-api:fabric-api:${project.property("fabric_version")}")
implementation(project(":core"))
bundledCore(project(":core"))
testImplementation(kotlin("test"))
include("com.github.luben:zstd-jni:1.5.5-4")
}
tasks.processResources {
val minecraftVersion = project.property("minecraft_version") as String
val loaderVersion = project.property("loader_version") as String
val kotlinLoaderVersion = project.property("kotlin_loader_version") as String
inputs.property("version", project.version)
inputs.property("minecraft_version", minecraftVersion)
inputs.property("loader_version", loaderVersion)
filteringCharset = "UTF-8"
filesMatching("fabric.mod.json") {
expand(
"version" to project.version,
"minecraft_version" to minecraftVersion,
"loader_version" to loaderVersion,
"kotlin_loader_version" to kotlinLoaderVersion
)
}
}
tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.release.set(targetJavaVersion)
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions.jvmTarget.set(JvmTarget.fromTarget(targetJavaVersion.toString()))
}
tasks.test {
useJUnitPlatform()
}
sourceSets.test {
compileClasspath += sourceSets["client"].output + sourceSets["client"].compileClasspath
runtimeClasspath += sourceSets["client"].output + sourceSets["client"].runtimeClasspath
}
tasks.jar {
from(bundledCore.elements.map { jars -> jars.map { zipTree(it) } }) {
exclude("META-INF/**")
}
from(files(rootProject.file("LICENSE.txt"), rootProject.file("NOTICE.txt"))) {
rename { "${it}_${project.base.archivesName.get()}" }
}
}