-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.gradle.kts
193 lines (167 loc) · 7.17 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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
import com.google.cloud.tools.jib.gradle.PlatformParameters
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
buildscript {
dependencies {
classpath("com.google.cloud.tools:jib-spring-boot-extension-gradle:0.1.0")
}
}
extra["springCloudVersion"] = "2023.0.3"
plugins {
// https://docs.spring.io/spring-boot/docs/current/gradle-plugin/reference/htmlsingle/#reacting-to-other-plugins.java
java
`kotlin-dsl`
// only apply the plugin in the subprojects requiring it because it expects a Spring Boot app
// and the shared lib is obviously not one
id("org.springframework.boot") version "3.3.5" apply false
id("io.spring.dependency-management") version "1.1.6" apply false
id("org.graalvm.buildtools.native") version "0.10.3"
kotlin("jvm") version "2.0.21" apply false
kotlin("plugin.spring") version "2.0.21" apply false
id("com.google.cloud.tools.jib") version "3.4.4" apply false
id("io.gitlab.arturbosch.detekt") version "1.23.7" apply false
id("org.sonarqube") version "5.1.0.4882"
jacoco
}
subprojects {
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
apply(plugin = "io.spring.dependency-management")
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "org.jetbrains.kotlin.plugin.spring")
apply(plugin = "io.gitlab.arturbosch.detekt")
apply(plugin = "jacoco")
java.sourceCompatibility = JavaVersion.VERSION_21
the<DependencyManagementExtension>().apply {
imports {
mavenBom("org.springframework.cloud:spring-cloud-dependencies:${property("springCloudVersion")}")
}
}
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")
implementation("io.projectreactor.kotlin:reactor-kotlin-extensions")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server")
implementation("org.springframework.boot:spring-boot-starter-security")
// it provides support for JWT decoding and verification
implementation("org.springframework.security:spring-security-oauth2-jose")
implementation("org.springframework.kafka:spring-kafka")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.apicatalog:titanium-json-ld:1.4.1")
implementation("org.glassfish:jakarta.json:2.0.1")
implementation("io.arrow-kt:arrow-fx-coroutines:1.2.4")
implementation("org.locationtech.jts.io:jts-io-common:1.20.0")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")
runtimeOnly("de.siegmar:logback-gelf:6.1.0")
runtimeOnly("io.micrometer:micrometer-registry-prometheus")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
// to ensure we are using mocks and spies from springmockk (and not from Mockito)
exclude(module = "mockito-core")
}
testImplementation("com.ninja-squad:springmockk:4.0.2")
testImplementation("io.projectreactor:reactor-test")
testImplementation("org.springframework.security:spring-security-test")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test")
}
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xjsr305=strict")
apiVersion.set(KotlinVersion.KOTLIN_2_0)
jvmTarget.set(JvmTarget.JVM_21)
}
jvmToolchain(21)
}
tasks.withType<Test> {
environment("SPRING_PROFILES_ACTIVE", "test")
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
// see https://github.com/detekt/detekt/issues/6198
configurations.matching { it.name == "detekt" }.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion("2.0.10")
}
}
}
tasks.withType<Detekt>().configureEach {
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
buildUponDefaultConfig = true
baseline.set(file("$projectDir/config/detekt/baseline.xml"))
source("src/main/kotlin", "src/test/kotlin", "src/testFixtures/kotlin")
reports {
xml.required.set(true)
txt.required.set(false)
html.required.set(true)
}
}
tasks.withType<DetektCreateBaselineTask>().configureEach {
config.setFrom(files("$rootDir/config/detekt/detekt.yml"))
buildUponDefaultConfig.set(true)
baseline.set(file("$projectDir/config/detekt/baseline.xml"))
}
// see https://docs.gradle.org/current/userguide/jacoco_plugin.html for configuration instructions
jacoco {
toolVersion = "0.8.9"
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.withType<JacocoReport> {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
xml.required.set(true)
html.required.set(true)
}
}
project.ext.set("jibFromImage", "eclipse-temurin:21-jre")
project.ext.set(
"jibFromPlatforms",
listOf(
PlatformParameters().apply { os = "linux"; architecture = "arm64" },
PlatformParameters().apply { os = "linux"; architecture = "amd64" }
)
)
project.ext.set("jibContainerCreationTime", "USE_CURRENT_TIMESTAMP")
project.ext.set(
"jibContainerLabels",
mapOf(
"maintainer" to "EGM",
"org.opencontainers.image.authors" to "EGM",
"org.opencontainers.image.documentation" to "https://stellio.readthedocs.io/",
"org.opencontainers.image.vendor" to "EGM",
"org.opencontainers.image.licenses" to "Apache-2.0",
"org.opencontainers.image.title" to "Stellio context broker",
"org.opencontainers.image.description" to
"""
Stellio is an NGSI-LD compliant context broker developed by EGM.
NGSI-LD is an Open API and data model specification for context management published by ETSI.
""".trimIndent(),
"org.opencontainers.image.source" to "https://github.com/stellio-hub/stellio-context-broker",
"com.java.version" to "${JavaVersion.VERSION_21}"
)
)
}
allprojects {
group = "com.egm.stellio"
version = "latest-dev"
repositories {
mavenCentral()
maven { url = uri("https://repo.spring.io/milestone") }
}
sonarqube {
properties {
property("sonar.projectKey", "stellio-hub_stellio-context-broker")
property("sonar.organization", "stellio-hub")
property("sonar.host.url", "https://sonarcloud.io")
}
}
}