-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle.kts
56 lines (45 loc) · 1.71 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
import org.graalvm.buildtools.gradle.dsl.GraalVMExtension
import java.lang.System.getProperty
plugins {
kotlin("jvm") version("1.9.23")
id("org.graalvm.buildtools.native") version("0.10.1")
}
val options = "-Xmx48m"
val hexagonVersion = "3.5.3"
val gradleScripts = "https://raw.githubusercontent.com/hexagontk/hexagon/$hexagonVersion/gradle"
apply(from = "$gradleScripts/kotlin.gradle")
apply(from = "$gradleScripts/application.gradle")
apply(from = "$gradleScripts/native.gradle")
defaultTasks("build")
version="1.0.0"
group="org.example"
description="Service's description"
ext.set("options", options)
ext.set("modules", "java.logging")
extensions.configure<JavaApplication> {
mainClass.set("org.example.ApplicationKt")
applicationDefaultJvmArgs = options.split(" ")
}
dependencies {
"implementation"("com.hexagonkt:http_server_jetty:$hexagonVersion")
"implementation"("com.hexagonkt:serialization_jackson_json:$hexagonVersion")
"implementation"("org.slf4j:slf4j-nop:2.0.7")
"testImplementation"("com.hexagonkt:http_client_jetty:$hexagonVersion")
}
extensions.configure<GraalVMExtension> {
fun option(name: String, value: (String) -> String): String? =
getProperty(name)?.let(value)
binaries {
named("main") {
listOfNotNull(
"--enable-url-protocols=classpath",
"--initialize-at-run-time=com.hexagonkt.core.NetworkKt",
"--initialize-at-build-time=com.hexagonkt.core.ClasspathHandler",
"--static", // Won't work on Windows or macOS
"-R:MaxHeapSize=16",
option("enableMonitoring") { "--enable-monitoring" },
)
.forEach(buildArgs::add)
}
}
}