-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle.kts
132 lines (114 loc) · 4.23 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
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
// import org.jetbrains.kotlin.gradle.dsl.JvmTarget
plugins {
application
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.ktlint)
alias(libs.plugins.versions)
alias(libs.plugins.ktor)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.graalvm.buildtools.native)
}
group = "org.alexn.hook"
version = "0.0.1"
application {
mainClass.set("org.alexn.hook.MainKt")
if (project.ext.has("development")) {
applicationDefaultJvmArgs = listOf("-Dio.ktor.development=true")
}
// https://www.graalvm.org/22.0/reference-manual/native-image/Agent/
if (project.ext.has("nativeAgent")) {
applicationDefaultJvmArgs = listOf("-agentlib:native-image-agent=config-output-dir=./src/main/resources/META-INF/native-image")
}
}
// https://ktor.io/docs/graalvm.html#execute-the-native-image-tool
// https://github.com/ktorio/ktor-samples/blob/main/graalvm/build.gradle.kts
graalvmNative {
// https://github.com/oracle/graalvm-reachability-metadata
// https://graalvm.github.io/native-build-tools/latest/gradle-plugin.html#metadata-support
metadataRepository {
enabled = true
// https://github.com/oracle/graalvm-reachability-metadata/releases/
version = "0.3.7"
}
binaries {
named("main") {
fallback.set(false)
verbose.set(true)
buildArgs.add("--initialize-at-build-time=io.ktor,kotlinx,kotlin,org.xml.sax.helpers,org.slf4j.helpers")
buildArgs.add("--initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback,org.slf4j.impl.StaticLoggerBinder")
buildArgs.add("--initialize-at-build-time=com.github.ajalt.mordant.internal.nativeimage.NativeImagePosixMppImpls")
buildArgs.add("--initialize-at-build-time=ch.qos.logback.classic.Logger")
buildArgs.add("--no-fallback")
buildArgs.add("-H:+UnlockExperimentalVMOptions")
buildArgs.add("-H:+InstallExitHandlers")
buildArgs.add("-H:+ReportExceptionStackTraces")
buildArgs.add("-H:+ReportUnsupportedElementsAtRuntime")
buildArgs.add("-R:MaxHeapSize=30m")
buildArgs.add("-R:MaxNewSize=2m")
buildArgs.add("-R:MinHeapSize=2m")
imageName.set("github-webhook-listener")
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation(libs.arrow.core)
implementation(libs.arrow.fx.coroutines)
implementation(libs.arrow.fx.stm)
implementation(libs.arrow.suspendapp)
implementation(libs.clikt)
implementation(libs.commons.codec)
implementation(libs.commons.text)
implementation(libs.kaml)
implementation(libs.kotlin.logging)
implementation(libs.kotlin.stdlib.jdk8)
implementation(libs.kotlin.test.junit)
implementation(libs.kotlinx.serialization.json)
implementation(libs.ktor.serialization.kotlinx.json)
implementation(libs.ktor.server.cio)
implementation(libs.ktor.server.core)
implementation(libs.ktor.server.html.builder)
implementation(libs.ktor.server.tests.jvm)
implementation(libs.logback.classic)
}
// kotlin {
// jvmToolchain(22)
// }
// java {
// toolchain {
// languageVersion.set(JavaLanguageVersion.of(22))
// }
// }
tasks {
// withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
// compilerOptions {
// jvmTarget.set(JvmTarget.JVM_22)
// javaParameters = true
// }
// }
named<DependencyUpdatesTask>("dependencyUpdates").configure {
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()
}
rejectVersionIf {
isNonStable(candidate.version) && !isNonStable(currentVersion)
}
checkForGradleUpdate = true
outputFormatter = "html"
outputDir = "build/dependencyUpdates"
reportfileName = "report"
}
test {
}
}
ktor {
fatJar {
archiveFileName.set("github-webhook-listener-fat.jar")
}
}