-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle.kts
116 lines (101 loc) · 4.24 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
@Suppress("DSL_SCOPE_VIOLATION") // TODO remove when https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
plugins {
alias(libs.plugins.gradle.native)
alias(libs.plugins.gradle.jib)
application
}
dependencies {
implementation(projects.libs.proto)
implementation(projects.libs.grpc)
implementation("org.bouncycastle:bctsp-jdk16:1.46")
// Grpc `io.grpc:grpc-all` has grpc-auth, grpc-alts, grpc-protobuf, grpc-xds ...
runtimeOnly(libs.grpc.netty)
implementation(libs.grpc.protobuf)
implementation(libs.grpc.kotlin.stub)
implementation(libs.grpc.services) // Optional. includes grpc-protobuf
implementation(libs.grpc.xds) // Optional. includes grpc-services, grpc-auth, grpc-alts
implementation(libs.bundles.kotlinx.coroutines)
// Protobuf - If you want to use features like protobuf JsonFormat, `protobuf-java-util` instead of `protobuf-java`
implementation(libs.protobuf.java)
implementation(libs.protobuf.kotlin)
// Google
implementation(libs.guava)
// Kotlin Config
implementation(libs.bundles.konf)
// Resilience frameworks
implementation(libs.sentinel.grpc.adapter)
// implementation(libs.concurrency.limits.grpc)
// Arrow, TODO: planing to use n the future
// implementation(libs.arrow.core)
// implementation(libs.arrow.syntax)
// implementation(libs.arrow.fx)
// Test
// testImplementation("io.kotest.extensions:kotest-extensions-koin:{version}")
testImplementation(testFixtures(projects.libs.test))
testImplementation(testFixtures(projects.libs.model))
testImplementation(testFixtures(projects.libs.proto))
// grpc testing TODO: https://github.com/grpc/grpc-java/issues/5331
testImplementation(libs.grpc.test)
// testImplementation("io.grpc:grpc-testing:$grpcVersion")
}
affectedTestConfiguration { jvmTestTask = "check" }
application {
mainClass.set("micro.apps.service.AccountApplicationKt")
// applicationDefaultJvmArgs = listOf("-noverify", "-XX:TieredStopAtLevel=1")
applicationDefaultJvmArgs = listOf("-Dorg.slf4j.simpleLogger.log.micro.apps=debug")
}
tasks {
register<JavaExec>("runAccountClient") {
mainClass.set("micro.apps.service.domain.account.AccountClientKt")
classpath = sourceSets["main"].runtimeClasspath
workingDir = rootDir
jvmArgs = listOf("-Dorg.slf4j.simpleLogger.log.micro.apps=debug")
}
register<JavaExec>("runEchoClient") {
mainClass.set("micro.apps.service.domain.echo.EchoClientKt")
classpath = sourceSets["main"].runtimeClasspath
workingDir = rootDir
jvmArgs = listOf("-Dorg.slf4j.simpleLogger.log.micro.apps=debug")
}
run.configure {
// HINT: config/certs are at project root
workingDir = rootDir
}
test {
workingDir = rootDir
}
graalvmNative {
binaries {
named("main") {
// Main options
imageName.set("account-service")
mainClass.set("micro.apps.service.AccountApplicationKt")
debug.set(true)
verbose.set(true)
fallback.set(true)
configurationFileDirectories.from(file("src/graal"))
// Advanced options
buildArgs(
"-H:+ReportExceptionStackTraces",
// "-H:+TraceClassInitialization",
// "-H:+PrintClassInitialization",
"--initialize-at-run-time=io.netty.handler.codec.compression.BrotliDecoder,io.netty.util.internal.logging.Log4JLogger",
"--initialize-at-build-time=org.conscrypt.Conscrypt,org.slf4j.jul.JDK14LoggerAdapter,org.slf4j.simple.SimpleLogger,org.slf4j.LoggerFactory"
// typeNames = ["org.slf4j.jul.JDK14LoggerAdapter", "org.slf4j.simple.SimpleLogger"],
// packageNames = ["org.slf4j.jul", "org.slf4j.simple"],
)
}
}
}
}
jib {
containerizingMode = "packaged"
container {
// since we have many main classes, it cannot be Inferred. lets help
mainClass = application.mainClass.get()
}
// extraDirectories {
// setPaths("src/main/custom-extra-dir,/home/user/jib-extras")
// permissions = mapOf("/work" to "775", "/distr" to "775")
// }
}