mirror of
https://github.com/TheWhiteDog9487/RandomTeleporter.git
synced 2026-05-20 14:49:44 +08:00
使用Kotlin重写
This commit is contained in:
@@ -1,14 +1,13 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
|
||||
plugins {
|
||||
id("net.fabricmc.fabric-loom") version "1.16-SNAPSHOT"
|
||||
id("maven-publish")
|
||||
id("net.fabricmc.fabric-loom")
|
||||
`maven-publish`
|
||||
id("org.jetbrains.kotlin.jvm") version "2.3.21"
|
||||
}
|
||||
|
||||
version = project.extra["mod_version"] as String
|
||||
group = project.extra["maven_group"] as String
|
||||
|
||||
base {
|
||||
archivesName.set(project.extra["archives_base_name"] as String)
|
||||
}
|
||||
version = providers.gradleProperty("mod_version").get()
|
||||
group = providers.gradleProperty("maven_group").get()
|
||||
|
||||
repositories {
|
||||
// Add repositories to retrieve artifacts from in here.
|
||||
@@ -25,19 +24,22 @@ loom {
|
||||
splitEnvironmentSourceSets()
|
||||
|
||||
mods {
|
||||
val mod = create("randomteleporter")
|
||||
mod.sourceSet("main")
|
||||
mod.sourceSet("client")
|
||||
register("randomteleporter") {
|
||||
sourceSet(sourceSets.main.get())
|
||||
sourceSet(sourceSets.getByName("client"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// To change the versions see the gradle.properties file
|
||||
minecraft("com.mojang:minecraft:${project.extra["minecraft_version"]}")
|
||||
implementation("net.fabricmc:fabric-loader:${project.extra["loader_version"]}")
|
||||
minecraft("com.mojang:minecraft:${providers.gradleProperty("minecraft_version").get()}")
|
||||
|
||||
implementation("net.fabricmc:fabric-loader:${providers.gradleProperty("loader_version").get()}")
|
||||
|
||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||
implementation("net.fabricmc.fabric-api:fabric-api:${project.extra["fabric_api_version"]}")
|
||||
implementation("net.fabricmc.fabric-api:fabric-api:${providers.gradleProperty("fabric_api_version").get()}")
|
||||
implementation("net.fabricmc:fabric-language-kotlin:${providers.gradleProperty("fabric_kotlin_version").get()}")
|
||||
|
||||
// Uncomment the following line to enable the deprecated Fabric API modules.
|
||||
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
||||
@@ -47,17 +49,22 @@ dependencies {
|
||||
// runtimeOnly("com.terraformersmc:modmenu:${project.extra["modmenu_version"]}")
|
||||
}
|
||||
|
||||
|
||||
tasks.processResources {
|
||||
inputs.property("version", project.version)
|
||||
val version = version
|
||||
inputs.property("version", version)
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand("version" to project.version)
|
||||
expand("version" to version)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile> {
|
||||
options.release.set(25)
|
||||
}
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
options.release = 25 }
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = JvmTarget.JVM_25 } }
|
||||
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
@@ -66,23 +73,25 @@ java {
|
||||
withSourcesJar()
|
||||
|
||||
sourceCompatibility = JavaVersion.VERSION_25
|
||||
targetCompatibility = JavaVersion.VERSION_25
|
||||
}
|
||||
targetCompatibility = JavaVersion.VERSION_25 }
|
||||
|
||||
tasks.jar {
|
||||
val projectName = project.name
|
||||
inputs.property("projectName", projectName)
|
||||
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${project.base.archivesName.get()}" } }
|
||||
rename { "${it}_$projectName" } }
|
||||
|
||||
// https://docs.gradle.org/current/dsl/org.gradle.api.tasks.bundling.Jar.html#org.gradle.api.tasks.bundling.Jar:archiveFileName
|
||||
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}.jar"}
|
||||
archiveFileName = "RandomTeleporter-${project.version} mc${project.extra["minecraft_version"]}.jar"}
|
||||
|
||||
tasks.named<Jar>("sourcesJar") {
|
||||
archiveFileName = "${project.base.archivesName.get()}-${project.version} mc${project.extra["minecraft_version"]}-sources.jar"}
|
||||
archiveFileName = "RandomTeleporter-${project.version} mc${project.extra["minecraft_version"]}-sources.jar"}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("mavenJava") {
|
||||
register<MavenPublication>("mavenJava") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user