forked from robfletcher/strikt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
118 lines (103 loc) · 3.54 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
import com.adarshr.gradle.testlogger.TestLoggerExtension
import com.adarshr.gradle.testlogger.theme.ThemeType.MOCHA_PARALLEL
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import info.solidsoft.gradle.pitest.PitestPluginExtension
import io.codearte.gradle.nexus.NexusStagingExtension
import org.gradle.api.JavaVersion.VERSION_1_8
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jmailen.gradle.kotlinter.KotlinterExtension
import kotlin.text.RegexOption.IGNORE_CASE
plugins {
kotlin("jvm") version "1.5.21" apply false
id("io.codearte.nexus-staging") version "0.30.0"
id("org.jmailen.kotlinter") version "3.4.5" apply false
id("info.solidsoft.pitest") version "1.6.0" apply false
id("com.adarshr.test-logger") version "3.0.0" apply false
id("com.github.ben-manes.versions") version "0.39.0"
}
allprojects {
group = "io.strikt"
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion("${property("versions.kotlin")}")
}
}
}
}
subprojects {
repositories {
mavenCentral()
}
afterEvaluate {
plugins.withId("kotlin") {
configure<JavaPluginConvention> {
sourceCompatibility = VERSION_1_8
}
tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = VERSION_1_8.toString()
languageVersion = "1.5"
javaParameters = true
freeCompilerArgs = listOf("-Xjvm-default=all")
allWarningsAsErrors = true
}
}
dependencies {
"implementation"(platform("org.jetbrains.kotlin:kotlin-bom:${property("versions.kotlin")}"))
"implementation"(platform("org.jetbrains.kotlinx:kotlinx-coroutines-bom:${property("versions.kotlinx-coroutines")}"))
"testImplementation"(platform("org.junit:junit-bom:${property("versions.junit")}"))
"testImplementation"("org.junit.jupiter:junit-jupiter-api")
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine")
}
// Test with JUnit 5
tasks.withType<Test> {
systemProperty("junit.jupiter.execution.parallel.enabled", "false")
useJUnitPlatform {
includeEngines("junit-jupiter")
}
}
// Lint Kotlin code
apply(plugin = "org.jmailen.kotlinter")
configure<KotlinterExtension> {
ignoreFailures = true
indentSize = 2
reporters = arrayOf("html", "plain")
}
}
plugins.withId("info.solidsoft.pitest") {
configure<PitestPluginExtension> {
junit5PluginVersion.set("0.12")
avoidCallsTo.set(setOf("kotlin.jvm.internal"))
targetClasses.set(setOf("strikt.*")) // by default "${project.group}.*"
targetTests.set(setOf("strikt.**.*"))
pitestVersion.set("1.6.2")
threads.set(
System.getenv("PITEST_THREADS")?.toInt()
?: Runtime.getRuntime().availableProcessors()
)
outputFormats.set(setOf("XML", "HTML"))
}
}
}
apply(plugin = "com.adarshr.test-logger")
configure<TestLoggerExtension> {
theme = MOCHA_PARALLEL
showSimpleNames = true
}
}
configure<NexusStagingExtension> {
stagingProfileId = "3fc70880a122f"
}
// Dependency updates configuration
fun ModuleComponentIdentifier.isNonStable() =
version.contains(Regex("""-(m|eap|rc|alpha|beta|b)(-?[\d-]+)?$""", IGNORE_CASE))
tasks.withType<DependencyUpdatesTask> {
revision = "release"
checkConstraints = true
gradleReleaseChannel = "current"
checkForGradleUpdate = true
rejectVersionIf {
candidate.isNonStable()
}
}