-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
63 lines (51 loc) · 1.58 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
import org.gradle.api.JavaVersion.VERSION_11
import org.gradle.api.JavaVersion.VERSION_17
val JUNIT_VERSION = "5.9.3"
val SPRING_BOOT_VERSION = "2.7.6"
val ENABLE_PREVIEW = "--enable-preview"
plugins {
java
idea
}
fun Project.usesJdk17() = hasProperty("jdk17")
java {
val javaVersion = if (project.usesJdk17()) VERSION_17 else VERSION_11
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
println("Setting Java compatibility mode to $javaVersion")
}
repositories {
mavenCentral()
}
dependencies {
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("org.springframework.boot:spring-boot-starter-webflux:$SPRING_BOOT_VERSION")
testImplementation("org.junit.jupiter:junit-jupiter-api:$JUNIT_VERSION")
testImplementation("org.junit.jupiter:junit-jupiter-params:$JUNIT_VERSION")
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.mockito:mockito-core:5.3.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$JUNIT_VERSION")
}
fun MutableList<String>.enablePreviewIfSupported() {
if (project.usesJdk17()) {
add(ENABLE_PREVIEW)
}
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<Test>().all {
setJvmArgs(mutableListOf<String>().apply { enablePreviewIfSupported() })
}
tasks.withType<JavaCompile>().all {
options.compilerArgs.enablePreviewIfSupported()
}
tasks.withType<JavaExec> {
setJvmArgs(mutableListOf<String>().apply { enablePreviewIfSupported() })
}
idea {
module {
isDownloadJavadoc = true
isDownloadSources = true
}
}