forked from Project-Cepi/KStom
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
106 lines (82 loc) · 3.02 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
plugins {
// Apply the Kotlin JVM plugin to add support for Kotlin.
kotlin("jvm") version "1.6.21"
// Kotlinx serialization for any data format
kotlin("plugin.serialization") version "1.6.21"
// Shade the plugin
id("com.github.johnrengelman.shadow") version "7.1.0"
// Allow publishing
`maven-publish`
// Apply the application plugin to add support for building a jar
java
// Dokka documentation w/ kotlin
id("org.jetbrains.dokka") version "1.6.21"
}
repositories {
// Use mavenCentral
mavenCentral()
maven(url = "https://jitpack.io")
maven(url = "https://repo.spongepowered.org/maven")
maven(url = "https://repo.velocitypowered.com/snapshots/")
}
dependencies {
// Use the Kotlin JDK 8 standard library.
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.6.21")
// Use the Kotlin reflect library.
compileOnly("org.jetbrains.kotlin:kotlin-reflect:1.6.21")
// Use the kotlin test library
testImplementation("io.kotest:kotest-assertions-core:5.3.0")
testImplementation("io.kotest:kotest-runner-junit5:5.3.0")
// Add support for kotlinx courotines
compileOnly("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.2")
// Compile Minestom into project
compileOnly("com.github.Minestom", "Minestom", "7867313290")
compileOnly("io.github.jglrxavpok.hephaistos", "common", "2.4.4")
// import kotlinx serialization
compileOnly("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
// Add MiniMessage
implementation("net.kyori:adventure-text-minimessage:4.10.1")
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "17"
}
configurations {
testImplementation {
extendsFrom(configurations.compileOnly.get())
}
}
tasks {
named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
archiveBaseName.set("kstom")
mergeServiceFiles()
minimize()
}
withType<Test> { useJUnitPlatform() }
build { dependsOn(shadowJar) }
}
java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
val compileKotlin: org.jetbrains.kotlin.gradle.tasks.KotlinCompile by tasks
compileKotlin.kotlinOptions.jvmTarget = JavaVersion.VERSION_17.toString()
compileKotlin.kotlinOptions {
freeCompilerArgs = listOf("-Xinline-classes", "-Xopt-in=kotlin.RequiresOptIn")
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = project.properties["group"] as? String?
artifactId = project.name
version = project.properties["version"] as? String?
from(components["java"])
}
}
}
sourceSets.create("demo") {
java.srcDir("src/demo/java")
java.srcDir("build/generated/source/apt/demo")
resources.srcDir("src/demo/resources")
compileClasspath += sourceSets.main.get().output + sourceSets.main.get().compileClasspath
runtimeClasspath += sourceSets.main.get().output + sourceSets.main.get().runtimeClasspath
}