-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
90 lines (74 loc) · 3.3 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
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
val group: String by project
val version: String by project
java.sourceCompatibility = JavaVersion.VERSION_21
val dockerRegistry = "goafabric"
val baseImage = "ibm-semeru-runtimes:open-21.0.4.1_7-jre-focal@sha256:8b94f8b14fd1d4660f9dc777b1ad3630f847b8e3dc371203bcb857a5e74d6c39"
plugins {
java
jacoco
id("org.springframework.boot") version "3.4.3"
id("io.spring.dependency-management") version "1.1.7"
id("org.graalvm.buildtools.native") version "0.10.5"
id("com.google.cloud.tools.jib") version "3.4.4"
id("net.researchgate.release") version "3.1.0"
id("org.sonarqube") version "6.0.1.5171"
}
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/milestone") }
maven { url = uri("https://repo.spring.io/snapshot") }
}
dependencies {
constraints {
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.8.5")
implementation("org.mapstruct:mapstruct:1.6.3")
annotationProcessor("org.mapstruct:mapstruct-processor:1.6.3")
implementation("io.github.resilience4j:resilience4j-spring-boot3:2.3.0")
}
}
dependencies {
//web
implementation("org.springframework.boot:spring-boot-starter-web")
//monitoring
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("io.micrometer:micrometer-registry-prometheus")
implementation("io.micrometer:micrometer-tracing-bridge-otel")
implementation("io.opentelemetry:opentelemetry-exporter-otlp")
//messageing
implementation("org.springframework.boot:spring-boot-starter-websocket")
implementation("org.springframework.kafka:spring-kafka")
//crosscuting
implementation("org.springframework.boot:spring-boot-starter-aop")
//test
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.kafka:spring-kafka-test")
}
tasks.withType<Test> {
useJUnitPlatform()
exclude("**/*NRIT*")
finalizedBy("jacocoTestReport")
}
tasks.jacocoTestReport { reports {csv.required.set(true) } }
jib {
val amd64 = com.google.cloud.tools.jib.gradle.PlatformParameters(); amd64.os = "linux"; amd64.architecture = "amd64"; val arm64 = com.google.cloud.tools.jib.gradle.PlatformParameters(); arm64.os = "linux"; arm64.architecture = "arm64"
from.image = baseImage
to.image = "${dockerRegistry}/${project.name}:${project.version}"
container.jvmFlags = listOf("-Xms256m", "-Xmx256m")
from.platforms.set(listOf(amd64, arm64))
}
tasks.register("dockerImageNative") { group = "build"; dependsOn("bootBuildImage") }
tasks.named<BootBuildImage>("bootBuildImage") {
val nativeImageName = "${dockerRegistry}/${project.name}-native" + (if (System.getProperty("os.arch").equals("aarch64")) "-arm64v8" else "") + ":${project.version}"
imageName.set(nativeImageName)
environment.set(mapOf("BP_NATIVE_IMAGE" to "true", "BP_JVM_VERSION" to "21", "BP_NATIVE_IMAGE_BUILD_ARGUMENTS" to "-J-Xmx5000m -march=compatibility"))
doLast {
exec { commandLine("/bin/sh", "-c", "docker run --rm $nativeImageName -check-integrity") }
exec { commandLine("/bin/sh", "-c", "docker push $nativeImageName") }
}
}
graalvmNative { binaries.named("main") { quickBuild.set(true) } }
configure<net.researchgate.release.ReleaseExtension> {
buildTasks.set(listOf("build", "test", "jib", "dockerImageNative"))
tagTemplate.set("v${version}".replace("-SNAPSHOT", ""))
}