-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
158 lines (129 loc) · 4.47 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
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
@file:Suppress("UnstableApiUsage")
import org.gradle.kotlin.dsl.invoke
apply(from = "version.gradle.kts")
plugins {
application
alias(libs.plugins.kotlin.serialization)
id("snoty.buildinfo-conventions")
id("snoty.doctor-conventions")
id("snoty.kotlin-conventions")
id("snoty.idea-conventions")
id("snoty.testintegration-conventions")
id("snoty.publish-repo-conventions")
id("snoty.koin-conventions")
}
// plugins applied after version.gradle.kts
apply(plugin = "snoty.catalog-conventions")
apply(plugin = "snoty.jib-conventions")
val isDevelopment: Boolean = project.findProperty("me.snoty.development")?.toString().toBoolean()
subprojects {
apply(plugin = "snoty.kotlin-conventions")
apply(from = "$rootDir/version.gradle.kts")
}
allprojects {
apply(plugin = "snoty.koin-conventions")
}
val devSourceSet = sourceSets.create("dev") {
val main = sourceSets.main.get()
compileClasspath += main.output
runtimeClasspath += main.output
}
testing.suites.withType<JvmTestSuite>().configureEach {
dependencies { with(libs) {
implementation(tests.ktor.server.testHost)
implementation(tests.json)
implementation(tests.testcontainers.keycloak) {
// explicit dependency, the bundled version is buggy
exclude(group = "org.keycloak")
}
implementation(dev.keycloak.adminClient)
implementation(monitoring.opentelemetry.testing)
implementation(devSourceSet.output)
runtimeOnly(tests.junit.engine)
runtimeOnly(tests.junit.launcher)
}}
}
val devImplementation: Configuration by configurations.getting {
extendsFrom(configurations.implementation.get())
}
dependencies { with(libs) {
fun moduleImplementation(dependency: Any) {
implementation(dependency)
testImplementation(dependency)
}
moduleImplementation(projects.api)
implementation(projects.adapter.mongodb)
implementation(projects.adapter.sql)
implementation(koin.slf4j)
implementation(libraries.coroutines.core)
// configuration
implementation(configuration.hoplite.yaml)
// ktor
implementation(ktor.serialization.kotlinx.json)
implementation(ktor.server.core)
implementation(ktor.server.netty)
// ktor plugins
implementation(ktor.server.cors)
implementation(ktor.server.call.logging)
implementation(ktor.server.call.id)
implementation(ktor.server.forwardedHeader)
implementation(ktor.server.forwardedHeader)
implementation(ktor.server.defaultHeaders)
implementation(ktor.server.hostCommon)
implementation(ktor.server.statusPages)
implementation(ktor.server.doubleReceive)
implementation(ktor.server.auth)
implementation(ktor.server.auth.jwt)
implementation(ktor.server.contentNegotiation)
// ktor client (used for OAuth2)
implementation(ktor.client.core)
implementation(ktor.client.apache)
implementation(ktor.client.contentNegotiation)
// monitoring
implementation(monitoring.ktor.opentelemetry)
implementation(monitoring.ktor.server.metricsMicrometer)
implementation(monitoring.micrometer.prometheus)
implementation(monitoring.opentelemetry.sdk.autoconfigure)
implementation(monitoring.opentelemetry.exporter.otlp)
implementation(monitoring.opentelemetry.kotlin)
implementation(monitoring.opentelemetry.logback)
// logging
implementation(log.logback)
implementation(log.kotlinLogging)
implementation(log.coroutines)
// serialization
implementation(libraries.jackson.core)
implementation(libraries.jackson.databind)
implementation(libraries.jackson.kotlin)
// task scheduling
implementation(libraries.jobrunr)
// feature flags
implementation(libraries.openfeature)
implementation(libraries.openfeature.flagd)
// dev
devImplementation(dev.keycloak.adminClient)
devImplementation(monitoring.opentelemetry.sdk)
file("dist/integrations").listFiles()?.let {
implementation(files(it))
}
// depend on all integrations by default
subprojects
.filter { it.path.startsWith(":integrations:") }
.forEach {
moduleImplementation(it)
}
}}
if (isDevelopment) {
tasks.run.configure {
classpath += devSourceSet.output
}
}
application {
mainClass.set("me.snoty.backend.MainKt")
if (isDevelopment) {
applicationDefaultJvmArgs += "-Dio.ktor.development=$isDevelopment"
}
}
tasks.test {
jvmArgs("-Dio.ktor.development=true")
}