This repository has been archived by the owner on Aug 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
82 lines (72 loc) · 2.26 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@Suppress("DSL_SCOPE_VIOLATION")
plugins {
application
alias(libs.plugins.kotlinJvm)
alias(libs.plugins.ktlint)
alias(libs.plugins.kotlinSerialization)
alias(libs.plugins.ktorPlugin)
alias(libs.plugins.versionUpdate)
alias(libs.plugins.catalogUpdate)
}
group = "com.nw"
version = "0.2.0"
application {
mainClass.set("com.nw.ApplicationKt")
val isDevelopment: Boolean = project.ext.has("development")
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=$isDevelopment")
}
repositories {
mavenCentral()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/ktor/eap") }
}
dependencies {
implementation(libs.bundles.ktorServer)
implementation(libs.bundles.ktorClient)
implementation(libs.bundles.ktorSerialization)
implementation(libs.bundles.exposed)
implementation(libs.bundles.dbConnector)
implementation(libs.bundles.logging)
implementation(libs.bundles.swaggerAndOpenAPI)
implementation(libs.bundles.security)
implementation(libs.bundles.cookies)
implementation(libs.bundles.testing)
}
ktor {
docker {
jreVersion.set(JavaVersion.VERSION_19)
portMappings.set(
listOf(
io.ktor.plugin.features.DockerPortMapping(
8090,
8090,
io.ktor.plugin.features.DockerPortMappingProtocol.TCP,
),
),
)
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = libs.versions.jvmTargetVersion.get()
freeCompilerArgs += "-Xjsr305=strict"
}
}
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(libs.versions.jvmTargetVersion.get()))
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.withType<DependencyUpdatesTask> {
gradleReleaseChannel = "current"
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
}