-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild.gradle.kts
162 lines (127 loc) · 5.45 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
159
160
161
162
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
id("org.jetbrains.kotlin.jvm") version "1.9.23"
id("org.jetbrains.kotlin.plugin.allopen") version "1.9.23"
id("com.google.devtools.ksp") version "1.9.23-1.0.19"
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.micronaut.application") version "4.4.0"
id("io.micronaut.test-resources") version "4.4.0"
id("io.micronaut.aot") version "4.4.0"
id("org.graalvm.buildtools.native") version "0.10.3"
kotlin("plugin.serialization") version "1.9.23"
}
version = "1.0.1"
group = "org.fenrirs"
val kotlinVersion = project.properties["kotlinVersion"]
repositories {
mavenCentral()
}
val exposedVersion: String by project
dependencies {
implementation("io.github.reactivecircus.cache4k:cache4k:0.13.0")
implementation("org.jetbrains.exposed:exposed-crypt:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-jodatime:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-kotlin-datetime:$exposedVersion")
implementation("org.jetbrains.exposed:exposed-json:$exposedVersion")
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-core
implementation("org.jetbrains.exposed:exposed-core:$exposedVersion")
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-dao
implementation("org.jetbrains.exposed:exposed-dao:$exposedVersion")
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-jdbc
implementation("org.jetbrains.exposed:exposed-jdbc:$exposedVersion")
// https://mvnrepository.com/artifact/org.jetbrains.exposed/exposed-java-time
implementation("org.jetbrains.exposed:exposed-java-time:$exposedVersion")
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
implementation("com.squareup.okhttp3:okhttp:4.10.0")
// https://github.com/Kotlin/kotlinx.serialization
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
// https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")
// https://mvnrepository.com/artifact/org.mockito/mockito-core
testImplementation("org.mockito:mockito-core:5.11.0")
// https://mvnrepository.com/artifact/io.micronaut/micronaut-websocket
implementation("io.micronaut:micronaut-websocket:4.7.1")
ksp("io.micronaut:micronaut-http-validation")
ksp("io.micronaut.serde:micronaut-serde-processor")
implementation("io.micronaut.kotlin:micronaut-kotlin-runtime")
implementation("io.micronaut.serde:micronaut-serde-jackson")
implementation("io.micronaut.sql:micronaut-jdbc-hikari")
implementation("io.micronaut.toml:micronaut-toml")
implementation("org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlinVersion}")
compileOnly("io.micronaut:micronaut-http-client")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
runtimeOnly("ch.qos.logback:logback-classic:1.5.12")
runtimeOnly("org.postgresql:postgresql")
testImplementation("io.micronaut:micronaut-http-client")
}
application {
mainClass = "org.fenrirs.ApplicationKt"
applicationDefaultJvmArgs = listOf("-Dapplication.version=$version")
}
java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}
tasks {
compileTestKotlin {
kotlinOptions {
jvmTarget = "21"
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "21"
}
}
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_21.toString()
}
}
// * https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
graalvmNative {
binaries {
all {
// * https://www.graalvm.org/latest/reference-manual/native-image/overview/BuildOutput/?fbclid=IwAR007Rh7fYg-CJZywqhFM8PF5XDWPvgOfaV9txFDqpy6PWjtZp2bXpgncL0_aem_Af0UTqW_wKY5RFkebOwqrANSJn-d6fpSoJLMyra23KLgMNQuur3l75gjN29_Ymw1JYkeX7upxGBzGPFkJ4iRuojh
// * https://github.com/oracle/graal/issues/1446
buildArgs.add("-H:+AddAllCharsets")
buildArgs.add("-R:MaxHeapSize=4G")
buildArgs.add("--no-fallback")
//buildArgs.add("--target=linux-amd64")
//buildArgs.add("--target=linux-aarch64")
buildArgs.add("-march=native")
imageName.set("${project.name}-v$version")
javaLauncher.set(javaToolchains.launcherFor {
languageVersion.set(JavaLanguageVersion.of(21))
vendor.set(JvmVendorSpec.GRAAL_VM)
})
verbose.set(true)
}
}
}
micronaut {
runtime("netty")
testRuntime("junit5")
processing {
incremental(true)
annotations("org.fenrirs.*")
}
testResources {
additionalModules.add("jdbc-postgresql")
}
aot {
// Please review carefully the optimizations enabled below
// Check https://micronaut-projects.github.io/micronaut-aot/latest/guide/ for more details
optimizeServiceLoading = false
convertYamlToJava = false
precomputeOperations = true
cacheEnvironment = true
optimizeClassLoading = true
deduceEnvironment = true
optimizeNetty = true
replaceLogbackXml = false
}
}