This repository has been archived by the owner on Sep 4, 2023. It is now read-only.
generated from Archived-Repositorie/kotlin-mod-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
118 lines (90 loc) · 3.19 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import juuxel.vineflowerforloom.api.DecompilerBrand
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("fabric-loom") version "1.3.8"
id("maven-publish")
id("org.jetbrains.kotlin.jvm")
id("com.ncorti.ktfmt.gradle") version "0.12.0"
id("io.github.juuxel.loom-vineflower") version "1.11.0"
id("org.jetbrains.dokka") version "1.8.20"
}
loom { serverOnlyMinecraftJar() }
vineflower { brand = DecompilerBrand.VINEFLOWER }
val sourceCompatibility = JavaVersion.VERSION_17
val targetCompatibility = JavaVersion.VERSION_17
val archivesBaseName = project.properties["archivesBaseName"].toString()
version = project.properties["mod_version"].toString()
group = project.properties["maven_group"].toString()
repositories {
maven { url = uri("https://jitpack.io") }
maven { url = uri("https://api.modrinth.com/maven") }
maven { url = uri("https://maven.parchmentmc.org") }
}
dependencies {
minecraft("com.mojang:minecraft:${project.properties["minecraft_version"]}")
@Suppress("UnstableApiUsage")
mappings(
loom.layered {
officialMojangMappings()
parchment(
"org.parchmentmc.data:parchment-${project.properties["minecraft_version"]}:${project.properties["parchment_mappings"]}@zip"
)
}
)
modImplementation("net.fabricmc:fabric-loader:${project.properties["loader_version"]}")
modImplementation(
"net.fabricmc:fabric-language-kotlin:${project.properties["fabric_kotlin_version"]}+kotlin.${project.properties["kotlin_version"]}"
)
modImplementation("maven.modrinth:mosaiccore:${project.properties["mosaiccore_version"]}")
testImplementation("net.fabricmc:fabric-loader-junit:${project.properties["loader_version"]}")
val mixinExtras = "com.github.LlamaLad7:MixinExtras:${project.properties["mixin_extras"]}"
implementation(annotationProcessor(mixinExtras)!!)!!
}
tasks {
processResources {
expand(project.properties)
}
getByName("build") {
dependsOn("dokkaHtmlJar")
dependsOn("dokkaJavadocJar")
}
getByName("javadoc") {
dependsOn("dokkaJavadocJar")
}
jar {
from("LICENSE") {
rename { "${it}_${project.properties["archivesBaseName"]}"}
}
}
test {
useJUnitPlatform()
systemProperty("fabric.side", "server")
}
withType<JavaCompile>().configureEach {
options.release = 17
}
withType<KotlinCompile>().configureEach {
kotlinOptions.jvmTarget = "17"
kotlinOptions.freeCompilerArgs += listOf(
"-Xlambdas=indy",
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions",
)
}
register<Jar>("dokkaHtmlJar") {
dependsOn(dokkaHtml)
from(dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier = "html-docs"
}
register<Jar>("dokkaJavadocJar") {
dependsOn(dokkaJavadoc)
from(dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier = "javadoc"
}
publishToMavenLocal {
group = project.properties["maven_group"].toString()
}
}
java { withSourcesJar() }
ktfmt { kotlinLangStyle() }