-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
221 lines (183 loc) · 7.54 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
221 lines (183 loc) · 7.54 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
group = "moe.kabii"
plugins {
val kotlinVer = "2.2.0"
kotlin("jvm") version kotlinVer
kotlin("kapt") version kotlinVer
id("com.bmuschko.docker-java-application") version "9.4.0"
application
idea
}
repositories {
mavenCentral()
// discord4j snapshots
maven("https://oss.sonatype.org/content/repositories/snapshots")
// personal libs: rusty
maven("https://jitpack.io")
// lavaplayer-natives
maven("https://m2.dv8tion.net/releases")
// lavaplayer
maven("https://maven.lavalink.dev/snapshots")
maven("https://maven.lavalink.dev/releases")
}
dependencies {
// kotlin
api(kotlin("stdlib"))
api(kotlin("reflect"))
// kotlin libs
val coroutinesVer = "1.8.1!!" // hold - 1.9.0 breaks old ktor version
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVer")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$coroutinesVer")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$coroutinesVer")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor:$coroutinesVer")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions:1.2.3")
//implementation("io.projectreactor:reactor-core")
implementation("moe.kabii:rusty-kotlin:3421f51") // custom functional style error handling
implementation("com.discord4j:discord4j-core:3.3.0-RC2") // discord websocket and api
// music bot
implementation("dev.arbjerg:lavaplayer:2.2.4")
implementation("dev.lavalink.youtube:v2:1.13.3")
implementation("dev.arbjerg:lavaplayer-ext-youtube-rotator:2.1.1")
implementation("com.github.JustRed23:lavadsp:0.7.7-1") // some lavaplayer audio filters
implementation("org.apache.commons:commons-compress:1.28.0")
// websocket apis
implementation("org.java-websocket:Java-WebSocket:1.6.0")
// other api - http calls
//implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.10")
implementation("com.squareup.okhttp3:okhttp:5.1.0")
// other api - json response parsing
val moshiVer = "1.15.2"
implementation("com.squareup.moshi:moshi:$moshiVer")
implementation("com.squareup.moshi:moshi-kotlin:$moshiVer")
implementation("com.squareup.moshi:moshi-kotlin-codegen:$moshiVer")
implementation("com.squareup.moshi:moshi-adapters:$moshiVer")
// emote parsing
implementation("com.vdurmont:emoji-java:5.1.1")
// thumbnail file server
val ktor = "2.2.4" // hold - breaking changes with runtime errors
implementation("io.ktor:ktor-server-core:$ktor")
implementation("io.ktor:ktor-server-netty:$ktor")
implementation("io.ktor:ktor-client-core:$ktor")
implementation("io.ktor:ktor-client-apache:$ktor")
implementation("io.ktor:ktor-server-html-builder:$ktor")
// welcome banner image processing
val imageIO = "3.12.0"
implementation("com.twelvemonkeys.imageio:imageio-jpeg:$imageIO")
implementation("com.twelvemonkeys.imageio:imageio-psd:$imageIO")
implementation("com.twelvemonkeys.imageio:imageio-bmp:$imageIO")
// database i/o
// mongodb per-guild configurations
implementation("org.litote.kmongo:kmongo-coroutine:5.2.1")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.19.2")
// postgresql user data, message history, tracked streams
val exposedVer = "0.41.1" // hold - many breaking changes
implementation("org.jetbrains.exposed:exposed-core:$exposedVer")
implementation("org.jetbrains.exposed:exposed-dao:$exposedVer")
implementation("org.jetbrains.exposed:exposed-jodatime:$exposedVer")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVer")
implementation("com.impossibl.pgjdbc-ng:pgjdbc-ng:0.8.9")
implementation("com.zaxxer:HikariCP:5.0.1")
// language detection
implementation("com.github.pemistahl:lingua:1.2.2")
// .toml token configuration
implementation("com.uchuhimo:konf:1.1.2")
// logging
implementation("ch.qos.logback:logback-classic:1.5.18")
// other
implementation("commons-validator:commons-validator:1.10.0")
implementation("org.apache.commons:commons-lang3:3.18.0")
implementation("org.apache.commons:commons-text:1.14.0")
implementation("org.reflections:reflections:0.10.2") // command detection and registration
// youtube xml parsing
// https://github.com/gradle/gradle/issues/13656#issuecomment-658873625
implementation("org.dom4j:dom4j:2.2.0")
components {
withModule("org.dom4j:dom4j") {
allVariants { withDependencies { clear() } }
}
}
}
var buildFlag = ""
val updateVersion = tasks.register("updateVersion") {
// custom script to create version file name and increment build number
val versionsFile = file("build.version")
val versions = versionsFile.readLines()
val (major, minor, build, flag) = versions.map { line -> line.substring(line.indexOf(':') + 1, line.length).trim() }
buildFlag = flag
val buildCount = build.toInt() + 1
// Set version for use in build output
version = flag.ifBlank { "$major.$minor" }
versionsFile.bufferedWriter().use { output ->
output.write("major: $major\n")
output.write("minor: $minor\n")
output.write("build: $buildCount\n")
output.write("flag: $flag")
}
}
tasks {
kotlin {
jvmToolchain(22)
}
compileKotlin {
compilerOptions.jvmTarget.set(JvmTarget.JVM_22)
compilerOptions.freeCompilerArgs.set(listOf("-Xannotation-default-target=param-property"))
}
java.targetCompatibility = JavaVersion.VERSION_22
java.sourceCompatibility = JavaVersion.VERSION_22
build {
dependsOn(updateVersion)
}
jar {
// include build version in jar for bot self-info command
from(".") {
include("build.version")
}
}
// credit to https://github.com/gradle/gradle/issues/1989#issuecomment-550192866
named<CreateStartScripts>("startScripts") {
doLast {
windowsScript.writeText(windowsScript.readText().replace(Regex("set CLASSPATH=.*"), "set CLASSPATH=%APP_HOME%\\\\lib\\\\*"))
}
}
}
application {
mainClass.set("moe.kabii.FBKKt")
applicationDefaultJvmArgs = listOf("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}
docker {
javaApplication {
baseImage.set("eclipse-temurin:23")
maintainer.set("kabiiQ")
ports.set(listOf(
8001, // YouTube PubSub subscription callback
8002, // TwitCasting Webhook endpoint
8003, // Twitch Webhook endpoint (Internal, must reverse proxy from SSL :443)
8004, // Kick Webhook endpoint
8010, // YouTube video API server
8020, // External command execution API server
8080, // File server
8101, // Discord OAuth redirect
))
images.set(
listOfNotNull(
"fbk:$version",
// push "latest" if this is an unflagged build
if(buildFlag.isBlank()) "fbk:latest" else null
)
)
}
}
tasks.named<Dockerfile>("dockerCreateDockerfile") {
// Setup pytchat environment within the fbk Docker image
environmentVariable("PIP_ROOT_USER_ACTION", "ignore")
instruction("COPY --from=python:3.12.7 / /")
runCommand("pip install httpx==0.18.2 pytchat==0.5.5")
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}