-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
36 lines (36 loc) · 2.09 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
plugins {
id("fabric-loom")
kotlin("jvm").version(System.getProperty("kotlin_version"))
}
base { archivesName.set(project.extra["archives_base_name"] as String) }
version = project.extra["mod_version"] as String
group = project.extra["maven_group"] as String
repositories {}
dependencies {
minecraft("com.mojang", "minecraft", project.extra["minecraft_version"] as String)
mappings("net.fabricmc", "yarn", project.extra["yarn_mappings"] as String, null, "v2")
modImplementation("net.fabricmc", "fabric-loader", project.extra["loader_version"] as String)
modImplementation("net.fabricmc.fabric-api", "fabric-api", project.extra["fabric_version"] as String)
modImplementation("net.fabricmc", "fabric-language-kotlin", project.extra["fabric_language_kotlin_version"] as String)
}
tasks {
val javaVersion = JavaVersion.toVersion((project.extra["java_version"] as String).toInt())
withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
options.release.set(javaVersion.toString().toInt())
}
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { kotlinOptions { jvmTarget = javaVersion.toString() } }
jar { from("LICENSE") { rename { "${it}_${base.archivesName.get()}" } } }
processResources {
filesMatching("fabric.mod.json") { expand(mutableMapOf("version" to project.extra["mod_version"] as String, "fabricloader" to project.extra["loader_version"] as String, "fabric_api" to project.extra["fabric_version"] as String, "fabric_language_kotlin" to project.extra["fabric_language_kotlin_version"] as String, "minecraft" to project.extra["minecraft_version"] as String, "java" to project.extra["java_version"] as String)) }
filesMatching("*.mixins.json") { expand(mutableMapOf("java" to project.extra["java_version"] as String)) }
}
java {
toolchain { languageVersion.set(JavaLanguageVersion.of(javaVersion.toString())) }
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
withSourcesJar()
}
}