-
Notifications
You must be signed in to change notification settings - Fork 61
/
build.gradle.kts
117 lines (102 loc) · 3.51 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
import com.adarshr.gradle.testlogger.TestLoggerExtension
import com.adarshr.gradle.testlogger.theme.ThemeType.MOCHA_PARALLEL
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import io.codearte.gradle.nexus.NexusStagingExtension
import org.gradle.api.JavaVersion.VERSION_17
import org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_2_0
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jmailen.gradle.kotlinter.KotlinterExtension
import kotlin.text.RegexOption.IGNORE_CASE
plugins {
kotlin("jvm") apply false
id("io.codearte.nexus-staging") version "0.30.0"
id("org.jmailen.kotlinter") version "4.4.1" apply false
id("com.adarshr.test-logger") version "4.0.0" apply false
id("com.github.ben-manes.versions") version "0.51.0"
id("org.jetbrains.dokka")
id("org.jetbrains.kotlinx.kover") version "0.8.3"
}
repositories {
mavenCentral()
// needed for dokka plugin, feels like this belongs in published.gradle.kts but it doesn't work there
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}
}
allprojects {
group = "io.strikt"
configurations.all {
resolutionStrategy.eachDependency {
if (requested.group == "org.jetbrains.kotlin") {
useVersion("${property("versions.kotlin")}")
}
}
}
}
subprojects {
repositories {
mavenCentral()
// needed for dokka plugin, feels like this belongs in published.gradle.kts but it doesn't work there
maven {
url = uri("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}
}
afterEvaluate {
plugins.withId("kotlin") {
configure<JavaPluginExtension> {
sourceCompatibility = VERSION_17
}
tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JVM_17)
languageVersion.set(KOTLIN_2_0)
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", "failgood")
}
}
// Lint Kotlin code
apply(plugin = "org.jmailen.kotlinter")
configure<KotlinterExtension> {
ignoreFailures = true
// indentSize = 2
reporters = arrayOf("html", "plain")
}
}
}
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()
}
}