-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
115 lines (97 loc) · 4.56 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
@file:Suppress("PropertyName", "LocalVariableName")
val logback_version: String by project
val exposed_version: String by project
val hikaricp_version: String by project
val koin_version: String by project
val jline_version: String by project
val swagger_ui_version: String by project
val schema_kenerator_version: String by project
plugins {
kotlin("jvm") version "2.0.20"
kotlin("plugin.serialization") version "2.0.20"
id("io.ktor.plugin") version "3.0.1"
}
group = "subit"
version = "0.0.1"
application {
mainClass.set("subit.YouthWriteKt")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
}
dependencies {
// ktor server
implementation(kotlin("reflect")) // kotlin 反射库
implementation("io.ktor:ktor-server-core-jvm") // core
implementation("io.ktor:ktor-server-netty-jvm") // netty
implementation("io.ktor:ktor-server-auth-jvm") // 登陆验证
implementation("io.ktor:ktor-server-content-negotiation") // request/response时反序列化
implementation("io.ktor:ktor-server-status-pages") // 错误页面(异常处理)
implementation("io.ktor:ktor-server-swagger")
implementation("io.ktor:ktor-server-cors-jvm") // 跨域
implementation("io.ktor:ktor-server-rate-limit-jvm") // 限流
implementation("io.ktor:ktor-server-websockets") // websocket
implementation("io.ktor:ktor-server-auto-head-response-jvm") // 自动响应HEAD请求
implementation("io.ktor:ktor-server-double-receive-jvm") // 重复接收
implementation("io.ktor:ktor-server-call-logging-jvm") // 日志
// ktor client
implementation("io.ktor:ktor-client-core-jvm") // core
implementation("io.ktor:ktor-client-java")
implementation("io.ktor:ktor-client-content-negotiation") // request/response时反序列化
// ktor common
implementation("io.ktor:ktor-serialization-kotlinx-json-jvm") // json on request/response
// utils
implementation("io.github.smiley4:schema-kenerator-core:$schema_kenerator_version")
implementation("io.github.smiley4:schema-kenerator-swagger:$schema_kenerator_version")
implementation("io.github.smiley4:schema-kenerator-reflection:$schema_kenerator_version")
implementation("io.github.smiley4:schema-kenerator-serialization:$schema_kenerator_version")
implementation("io.github.smiley4:ktor-swagger-ui:$swagger_ui_version") // 创建api页面
implementation("io.swagger.parser.v3:swagger-parser:2.1.22")
implementation("ch.qos.logback:logback-classic:$logback_version") // 日志
implementation("net.mamoe.yamlkt:yamlkt:0.13.0") // yaml for kotlin on read/write file
implementation("io.ktor:ktor-server-config-yaml-jvm") // yaml on read application.yaml
implementation("org.fusesource.jansi:jansi:2.4.1") // 终端颜色码
implementation("org.jline:jline:$jline_version") // 终端打印、命令等
//postgresql
val postgresql_version: String by project
implementation("org.postgresql:postgresql:$postgresql_version")
//数据库
implementation("org.jetbrains.exposed:exposed-core:$exposed_version") // 数据库
implementation("org.jetbrains.exposed:exposed-dao:$exposed_version") // 数据库
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version") // 数据库
implementation("org.jetbrains.exposed:exposed-json:$exposed_version") // 数据库
implementation("org.jetbrains.exposed:exposed-kotlin-datetime:$exposed_version") // 数据库
implementation("com.zaxxer:HikariCP:$hikaricp_version") // 连接池
// koin
implementation(platform("io.insert-koin:koin-bom:$koin_version"))
implementation("io.insert-koin:koin-core")
implementation("io.insert-koin:koin-ktor")
implementation("io.insert-koin:koin-logger-slf4j")
implementation("me.nullaqua:BluestarAPI-kotlin:4.3.3")
implementation("me.nullaqua:BluestarAPI-kotlin-reflect:4.3.3")
// testImplementation("io.ktor:ktor-server-tests-jvm")
testImplementation("io.ktor:ktor-server-test-host")
testImplementation("io.ktor:ktor-server-test-host-jvm")
testImplementation(kotlin("test"))
testImplementation(kotlin("test-junit"))
}
tasks.withType<ProcessResources> {
filesMatching("**/application.yaml") {
expand(mapOf("version" to version)) {
// 设置不转义反斜杠
escapeBackslash = true
}
}
}
kotlin {
jvmToolchain(17)
}
ktor {
fatJar {
allowZip64 = true
archiveFileName = "YouthWriteBackend.jar"
}
}