-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
117 lines (96 loc) · 2.95 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
117
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val mcVersion: String by project
val yarnVersion: String by project
val loaderVersion: String by project
val languageAdapterVersion: String by project
val modVersion: String by project
val mavenGroup: String by project
val archivesBaseName: String by project
val kotlinxSerializationVersion: String by project
project.version = modVersion
project.group = mavenGroup
plugins {
id("fabric-loom")
id("io.gitlab.arturbosch.detekt")
id("org.jetbrains.dokka")
kotlin("jvm")
kotlin("plugin.serialization")
}
repositories {
maven {
name = "Kotlinx-html (Dokka)"
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}
}
dependencies {
// Fabric
minecraft("com.mojang:minecraft:$mcVersion")
mappings("net.fabricmc:yarn:$yarnVersion:v2")
modImplementation("net.fabricmc:fabric-loader:$loaderVersion")
// Kotlin
modImplementation("net.fabricmc:fabric-language-kotlin:$languageAdapterVersion")
implementation("org.jetbrains.kotlin:kotlin-stdlib")
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.15.0") // Static analysis
// Serialization
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxSerializationVersion")
// Tests
testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}
minecraft {
accessWidener("src/main/resources/config.accesswidener")
}
loom {
runs {
create("test") {
server()
ideConfigGenerated(project.rootProject == project)
source(sourceSets.test.get())
}
}
}
tasks {
// Replaces "version" value in fabric.mod.json with version defined in gradle.properties
processResources {
inputs.property("version", project.version)
from(sourceSets.main.get().resources.srcDirs) {
include("fabric.mod.json")
expand("version" to project.version)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
processTestResources {
inputs.property("version", project.version)
from(sourceSets.test.get().resources.srcDirs) {
include("fabric.mod.json")
expand("version" to project.version)
duplicatesStrategy = DuplicatesStrategy.INCLUDE
}
}
// Ensures encoding is set to UTF-8, regardless of system default
withType<JavaCompile> {
options.encoding = "UTF-8"
}
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "16"
}
java {
withSourcesJar()
}
jar {
from("LICENSE.md")
}
dokkaHtml {
suppressInheritedMembers.set(true)
suppressObviousFunctions.set(true)
dokkaSourceSets {
configureEach {
includeNonPublic.set(true)
skipEmptyPackages.set(true)
}
}
}
}
detekt {
buildUponDefaultConfig = true
config = rootProject.files("detekt.yml")
}