-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
71 lines (62 loc) · 2.18 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
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import io.gitlab.arturbosch.detekt.Detekt
plugins {
kotlin("jvm")
id("com.lovelysystems.gradle")
id("com.github.johnrengelman.shadow")
id("io.gitlab.arturbosch.detekt") apply false
}
lovely {
gitProject()
dockerProject("lovelysystems/lovely-kafka-backup") {
from("docker")
from(project("confluent-connect").tasks["shadowJar"]) {
into("confluent-connect-libs")
}
from(project("cli").tasks["shadowJar"]) {
into("backup-cli-libs")
rename {
"cli.jar"
}
}
}
}
if (JavaVersion.current() != JavaVersion.VERSION_11) {
// we require Java 11 here, to ensure we are always using the same version as the docker images are using
error("Java 11 is required for this Project, found ${JavaVersion.current()}")
}
subprojects {
version = rootProject.version
// ensure that java 11 is used in all kotlin projects
extensions.findByType<KotlinJvmProjectExtension>()?.apply {
jvmToolchain {
(this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(11))
}
}
}
kotlin {
jvmToolchain(11)
}
tasks.withType<Test> {
useJUnitPlatform()
}
fun getFormattedProjectName(project: Project): String = ":${project.name}"
/**
* Groups together all the known Detekt tasks & adds the non-default ones to the given subproject's "check" task
*/
task("detektAll", type = Detekt::class) {
subprojects.forEach { project ->
project.getAllTasks(true).values.flatten().forEach { task ->
if (task.name == "detekt") {
val projectName = getFormattedProjectName(task.project)
dependsOn("$projectName:${task.name}")
/**
* Normal :detekt tasks don't find all code-style issues but :detektMain and :detektTest do.
* Adding dependency on those task so :detekt finds the correct issues and can be run for just one subproject.
*/
task.dependsOn += "$projectName:detektMain"
task.dependsOn += "$projectName:detektTest"
}
}
}
}