-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
119 lines (100 loc) · 3.37 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
118
119
plugins {
kotlin("jvm") version "1.5.31"
kotlin("plugin.serialization") version "1.5.31"
id("com.google.cloud.tools.jib") version "3.1.4"
id("net.researchgate.release") version "2.8.1"
}
group = "xyz.swagbot"
val isRelease = !version.toString().endsWith("-SNAPSHOT")
repositories {
mavenCentral()
maven("https://maven.masterzach32.net/artifactory/libraries")
maven("https://m2.dv8tion.net/releases")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://repo.spring.io/milestone")
}
configurations.all {
resolutionStrategy.eachDependency {
if (requested.name == "kotlin-reflect")
useVersion(kotlin.coreLibrariesVersion)
}
}
dependencies {
implementation("ch.qos.logback:logback-classic:1.2.3")
val facet_version = "0.4.0-SNAPSHOT"
implementation("io.facet:core:$facet_version")
implementation("io.facet:exposed:$facet_version")
implementation("com.sedmelluq:lavaplayer:1.3.78")
runtimeOnly("com.sedmelluq:lavaplayer-natives-arm64:1.3.14")
val ktor_version = "1.6.3"
implementation("io.ktor:ktor-client-core:$ktor_version")
implementation("io.ktor:ktor-client-cio:$ktor_version")
implementation("io.ktor:ktor-client-json-jvm:$ktor_version")
implementation("io.ktor:ktor-client-serialization-jvm:$ktor_version")
val exposed_version = "0.34.2"
implementation("org.jetbrains.exposed:exposed-core:$exposed_version")
implementation("org.jetbrains.exposed:exposed-jdbc:$exposed_version")
implementation("org.jetbrains.exposed:exposed-java-time:$exposed_version")
implementation("org.postgresql:postgresql:42.2.23")
}
tasks {
compileKotlin {
kotlinOptions {
jvmTarget = "16"
freeCompilerArgs = listOf("-Xopt-in=kotlin.RequiresOptIn")
}
}
}
jib {
from {
image = "openjdk:16-bullseye" // oraclelinux8 and buster dont have glibc 2.29
platforms {
platform {
architecture = "amd64"
os = "linux"
}
platform {
architecture = "arm64"
os = "linux"
}
}
}
to {
image = "zachkozar/swagbot:$version"
val imageTags = version.toString()
.substringBefore("-")
.split(".")
.fold(mutableSetOf<String>()) { tags, subVersion ->
tags.apply {
if (tags.isEmpty())
tags.add(subVersion)
else
tags.add("${tags.last()}.$subVersion")
}
}
.map { if (!isRelease) "$it-SNAPSHOT" else it }
.toMutableSet()
if (isRelease)
imageTags.add("prod")
imageTags.add("latest")
tags = imageTags
val dockerUsername: String? by project
val dockerPassword: String? by project
if (dockerUsername != null && dockerPassword != null) {
auth {
username = dockerUsername
password = dockerPassword
}
}
}
container {
creationTime = "USE_CURRENT_TIMESTAMP"
environment = mapOf(
"TZ" to "America/New_York",
"CODE_VERSION" to "$version",
"CODE_ENV" to "test",
"BOT_NAME" to "SwagBot",
"DEFAULT_COMMAND_PREFIX" to "~"
)
}
}