-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
78 lines (63 loc) · 1.99 KB
/
build.gradle.kts
File metadata and controls
78 lines (63 loc) · 1.99 KB
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
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentArchitecture
plugins {
`java-conventions`
`kotlin-conventions`
alias(kotlinLibs.plugins.ksp)
application
id("com.google.cloud.tools.jib") version "3.2.1"
}
dependencies {
ksp(project(":sdk-api-kotlin-gen"))
implementation(project(":sdk-api-kotlin"))
implementation(project(":sdk-http-vertx"))
implementation(project(":sdk-serde-jackson"))
implementation(project(":sdk-request-identity"))
implementation(kotlinLibs.kotlinx.serialization.core)
implementation(kotlinLibs.kotlinx.serialization.json)
implementation(coreLibs.log4j.core)
implementation(kotlinLibs.kotlinx.coroutines)
}
// Configuration of jib container images parameters
fun testHostArchitecture(): String {
val currentArchitecture = getCurrentArchitecture()
return if (currentArchitecture.isAmd64) {
"amd64"
} else {
when (currentArchitecture.name) {
"arm-v8",
"aarch64",
"arm64",
"aarch_64" -> "arm64"
else ->
throw IllegalArgumentException("Not supported host architecture: $currentArchitecture")
}
}
}
fun testBaseImage(): String {
return when (testHostArchitecture()) {
"arm64" ->
"eclipse-temurin:17-jre@sha256:61c5fee7a5c40a1ca93231a11b8caf47775f33e3438c56bf3a1ea58b7df1ee1b"
"amd64" ->
"eclipse-temurin:17-jre@sha256:ff7a89fe868ba504b09f93e3080ad30a75bd3d4e4e7b3e037e91705f8c6994b3"
else ->
throw IllegalArgumentException("No image for host architecture: ${testHostArchitecture()}")
}
}
jib {
to.image = "restatedev/java-test-services"
from.image = testBaseImage()
from {
platforms {
platform {
architecture = testHostArchitecture()
os = "linux"
}
}
}
}
tasks.jar { manifest { attributes["Main-Class"] = "dev.restate.sdk.testservices.MainKt" } }
tasks.withType<JavaExec> {
classpath("$projectDir/generated/ksp/main/resources")
}
application {
mainClass.set("dev.restate.sdk.testservices.MainKt") }