-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.gradle.kts
68 lines (68 loc) · 3.5 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import net.darkhax.curseforgegradle.TaskPublishCurseForge
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("fabric-loom")
kotlin("jvm")
id("com.modrinth.minotaur")
id("net.darkhax.curseforgegradle")
id("co.uzzu.dotenv.gradle")
}
base.archivesName = project.extra["archives_base_name"] as String
version = project.extra["mod_version"] as String
group = project.extra["maven_group"] as String
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>().configureEach {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
options.release = javaVersion.toString().toInt()
}
withType<JavaExec>().configureEach { defaultCharacterEncoding = "UTF-8" }
withType<Javadoc>().configureEach { options.encoding = "UTF-8" }
withType<Test>().configureEach { defaultCharacterEncoding = "UTF-8" }
withType<KotlinCompile>().configureEach {
compilerOptions {
extraWarnings = true
jvmTarget = JvmTarget.valueOf("JVM_$javaVersion")
}
}
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 = JavaLanguageVersion.of(javaVersion.toString())
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
withSourcesJar()
}
register<TaskPublishCurseForge>("publishCurseForge") {
disableVersionDetection()
apiToken = env.fetch("CURSEFORGE_TOKEN", "")
val file = upload("Replace this with the CurseForge project ID as an Integer", remapJar)
file.displayName = "[${project.extra["minecraft_version"] as String}] Mod Name"
file.addEnvironment("Client", "Server")
file.changelog = ""
file.releaseType = "release"
file.addModLoader("Fabric")
file.addGameVersion(project.extra["minecraft_version"] as String)
}
}
modrinth {
token.set(env.fetch("MODRINTH_TOKEN", ""))
projectId.set("Replace this with the slug to the Modrinth mod page")
uploadFile.set(tasks.remapJar)
gameVersions.addAll(project.extra["minecraft_version"] as String)
versionName.set("[${project.extra["minecraft_version"] as String}] Mod Name")
dependencies { required.project("fabric-api", "fabric-language-kotlin") }
}