-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle.kts
193 lines (160 loc) · 6.6 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.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.jetbrains.kotlin.cli.common.toBooleanLenient
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.Duration
plugins {
id("idea")
id("application")
kotlin("jvm")
id("com.avast.gradle.docker-compose") version "0.14.3"
id("com.github.ben-manes.versions") version "0.39.0"
}
description = "RADAR Push API Gateway to handle secured data flow to backend."
allprojects {
group = "org.radarbase"
version = "0.3.2"
repositories {
mavenCentral()
maven(url = "https://packages.confluent.io/maven/")
}
}
val integrationTestSourceSet = sourceSets.create("integrationTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
val integrationTestImplementation: Configuration by configurations.getting {
extendsFrom(configurations.testImplementation.get())
}
configurations["integrationTestRuntimeOnly"].extendsFrom(configurations.testRuntimeOnly.get())
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(kotlin("reflect"))
val radarCommonsVersion: String by project
implementation("org.radarbase:radar-commons:$radarCommonsVersion")
val radarJerseyVersion: String by project
implementation("org.radarbase:radar-jersey:$radarJerseyVersion")
implementation(project(path = ":deprecated-javax", configuration = "shadow"))
implementation("org.radarbase:oauth-client-util:${project.property("radarOauthClientVersion")}")
implementation("org.slf4j:slf4j-api:${project.property("slf4jVersion")}")
val jacksonVersion: String by project
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jacksonVersion")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion")
val grizzlyVersion: String by project
runtimeOnly("org.glassfish.grizzly:grizzly-framework-monitoring:$grizzlyVersion")
runtimeOnly("org.glassfish.grizzly:grizzly-http-monitoring:$grizzlyVersion")
runtimeOnly("org.glassfish.grizzly:grizzly-http-server-monitoring:$grizzlyVersion")
val log4j2Version: String by project
runtimeOnly("org.apache.logging.log4j:log4j-slf4j2-impl:$log4j2Version")
runtimeOnly("org.apache.logging.log4j:log4j-core:$log4j2Version")
runtimeOnly("org.apache.logging.log4j:log4j-jul:$log4j2Version")
val jedisVersion: String by project
implementation("redis.clients:jedis:$jedisVersion")
val junitVersion: String by project
val okhttp3Version: String by project
val radarSchemasVersion: String by project
implementation("org.radarbase:radar-schemas-commons:$radarSchemasVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:[2.2,3.0)")
testImplementation("com.squareup.okhttp3:mockwebserver:$okhttp3Version")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.radarbase:radar-schemas-commons:$radarSchemasVersion")
integrationTestImplementation("com.squareup.okhttp3:okhttp:$okhttp3Version")
integrationTestImplementation("org.radarbase:radar-schemas-commons:$radarSchemasVersion")
integrationTestImplementation("org.radarbase:radar-commons-testing:$radarCommonsVersion")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "17"
apiVersion = "1.8"
languageVersion = "1.8"
}
}
val integrationTest by tasks.registering(Test::class) {
description = "Runs integration tests."
group = "verification"
testClassesDirs = integrationTestSourceSet.output.classesDirs
classpath = integrationTestSourceSet.runtimeClasspath
shouldRunAfter("test")
}
tasks.withType<Test> {
testLogging {
showStandardStreams = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
useJUnitPlatform()
}
tasks.withType<Tar> {
compression = Compression.GZIP
archiveExtension.set("tar.gz")
}
application {
mainClass.set("org.radarbase.gateway.MainKt")
applicationDefaultJvmArgs = listOf(
"-Dcom.sun.management.jmxremote",
"-Dcom.sun.management.jmxremote.local.only=false",
"-Dcom.sun.management.jmxremote.port=9010",
"-Dcom.sun.management.jmxremote.authenticate=false",
"-Dcom.sun.management.jmxremote.ssl=false",
"-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager",
)
}
dockerCompose {
useComposeFiles = listOf("src/integrationTest/docker/docker-compose.yml")
val dockerComposeBuild: String? by project
val doBuild = dockerComposeBuild?.toBooleanLenient() ?: true
buildBeforeUp = doBuild
buildBeforePull = doBuild
buildAdditionalArgs = emptyList<String>()
val dockerComposeStopContainers: String? by project
stopContainers = dockerComposeStopContainers?.toBooleanLenient() ?: true
waitForTcpPortsTimeout = Duration.ofMinutes(3)
environment["SERVICES_HOST"] = "localhost"
captureContainersOutputToFiles = project.file("build/container-logs")
isRequiredBy(integrationTest)
}
idea {
module {
isDownloadSources = true
}
}
allprojects {
tasks.register("downloadDockerDependencies") {
doFirst {
configurations["compileClasspath"].files
configurations["runtimeClasspath"].files
println("Downloaded all dependencies")
}
outputs.upToDateWhen { false }
}
tasks.register("downloadDependencies") {
doFirst {
configurations.asMap
.filterValues { it.isCanBeResolved }
.forEach { (name, config) ->
try {
config.files
} catch (ex: Exception) {
project.logger.warn("Cannot find dependency for configuration {}", name, ex)
}
}
println("Downloaded all dependencies")
}
outputs.upToDateWhen { false }
}
}
fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}
tasks.withType<DependencyUpdatesTask> {
rejectVersionIf {
isNonStable(candidate.version)
}
}
tasks.wrapper {
gradleVersion = "8.3"
}