1
0
mirror of https://github.com/GeyserMC/Rainbow.git synced 2025-12-19 14:59:16 +00:00

Migrate build scripts to kotlin, update to Gradle 9.0.0

This commit is contained in:
Eclipse
2025-09-06 06:17:04 +00:00
parent 2a3428229e
commit 31acd52acb
4 changed files with 82 additions and 79 deletions

View File

@@ -1,76 +0,0 @@
plugins {
id 'fabric-loom' version '1.11-SNAPSHOT'
id 'maven-publish'
}
repositories {
maven {
url = "https://maven.parchmentmc.org"
}
}
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${project.parchment_version}@zip")
})
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
}
processResources {
inputs.property "version", project.mod_version
inputs.property "supported_versions", project.supported_versions
inputs.property "loader_version", project.loader_version
filteringCharset "UTF-8"
filesMatching("fabric.mod.json") {
expand "version": project.mod_version,
"supported_versions": project.supported_versions,
"loader_version": project.loader_version
}
}
def targetJavaVersion = 21
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
it.options.release.set(targetJavaVersion)
}
}
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
withSourcesJar()
}
jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}" }
}
}
publishing {
publications {
create("mavenJava", MavenPublication) {
artifactId = project.archives_base_name
from components.java
}
}
repositories {}
}
loom {
runs {
named("server") {
runDir = "run-server"
}
}
}

79
build.gradle.kts Normal file
View File

@@ -0,0 +1,79 @@
plugins {
id("fabric-loom") version "1.11-SNAPSHOT"
}
val minecraftVersion = properties["minecraft_version"]!! as String
val parchmentVersion = properties["parchment_version"]!! as String
val loaderVersion = properties["loader_version"]!! as String
val modVersion = properties["mod_version"]!! as String
val supportedVersions = properties["supported_versions"]!! as String
val archivesBaseName = properties["archives_base_name"]!! as String
val fabricVersion = properties["fabric_version"]!! as String
val targetJavaVersion = 21
repositories {
maven {
name = "ParchmentMC"
url = uri("https://maven.parchmentmc.org")
}
}
dependencies {
minecraft("com.mojang:minecraft:${minecraftVersion}")
mappings(loom.layered {
officialMojangMappings()
parchment("org.parchmentmc.data:parchment-${parchmentVersion}@zip")
})
modImplementation("net.fabricmc:fabric-loader:${loaderVersion}")
modImplementation("net.fabricmc.fabric-api:fabric-api:${fabricVersion}")
}
tasks {
processResources {
inputs.property("version", modVersion)
inputs.property("supported_versions", supportedVersions)
inputs.property("loader_version", loaderVersion)
filteringCharset = "UTF-8"
filesMatching("fabric.mod.json") {
expand(
mapOf(
"version" to modVersion,
"supported_versions" to supportedVersions,
"loader_version" to loaderVersion
)
)
}
}
jar {
from("LICENSE") {
rename { "${it}_${archivesBaseName}" }
}
}
withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.release = targetJavaVersion
}
}
java {
val javaVersion = JavaVersion.toVersion(targetJavaVersion)
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
withSourcesJar()
}
loom {
runs {
named("server") {
runDir = "run-server"
}
}
}

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -1,8 +1,8 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
gradlePluginPortal()
}