-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
62 lines (52 loc) · 1.7 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
plugins {
kotlin("jvm") version "1.9.22"
id("io.ktor.plugin") version "3.0.2"
kotlin("plugin.serialization") version "2.1.0"
}
group = "cafe.osrs"
version = v("api")
repositories {
mavenCentral()
}
dependencies {
multiImplementation(group = "io.ktor", version = v("ktor")) {
//ktor server
add("ktor-server-core")
add("ktor-server-netty")
add("ktor-server-content-negotiation")
add("ktor-server-cors")
add("ktor-server-rate-limit")
add("ktor-server-status-pages")
add("ktor-server-websockets")
//ktor client
add("ktor-client-core")
add("ktor-client-cio")
add("ktor-client-content-negotiation")
//ktor common
add("ktor-serialization-kotlinx-json")
}
implementation(group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version = v("serialization"))
implementation(group = "ch.qos.logback", name = "logback-classic", version = v("logback"))
}
application {
mainClass.set("cafe.osrs.api.MainKt")
}
//We only want a fat jar
tasks.named("jar") {
enabled = false
}
kotlin {
jvmToolchain(17)
}
//Utils for pretty and easy dependency adding
class MultiImplementationScope(
private val scope: DependencyHandlerScope,
private val group: String,
private val version: String
) {
fun add(name: String) = scope.implementation(group = group, name = name, version = version)
}
fun DependencyHandlerScope.multiImplementation(group: String, version: String, scope: MultiImplementationScope.() -> Unit) {
scope.invoke(MultiImplementationScope(scope = this, group = group, version = version))
}
fun v(name: String) = project.property("version.$name") as String