Skip to content

Commit 72e43ab

Browse files
authored
tidy up dependencies and build config (#37)
- remove test dependencies from convention plugins to make things more declarative - add slf4j simple to test dependencies to stifle warning - add slf4j dependencies to version-platform - tidy up some build config after the Gradle 8 Kotlin 1.8 bump
1 parent c8449db commit 72e43ab

File tree

7 files changed

+51
-74
lines changed

7 files changed

+51
-74
lines changed

buildSrc/build.gradle.kts

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
plugins {
42
`kotlin-dsl`
53
}
@@ -16,28 +14,6 @@ dependencies {
1614
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
1715
}
1816

19-
val gradleJvmTarget = "11"
20-
val gradleJvmVersion = "11"
21-
22-
tasks.withType<KotlinCompile>().configureEach {
23-
24-
kotlinOptions {
25-
jvmTarget = gradleJvmTarget
26-
}
27-
28-
kotlinOptions.freeCompilerArgs += listOf(
29-
"-opt-in=kotlin.RequiresOptIn",
30-
"-opt-in=kotlin.ExperimentalStdlibApi",
31-
"-opt-in=kotlin.time.ExperimentalTime",
32-
)
33-
}
34-
3517
kotlin {
36-
jvmToolchain {
37-
languageVersion.set(JavaLanguageVersion.of(gradleJvmVersion))
38-
}
39-
40-
kotlinDslPluginOptions {
41-
jvmTarget.set(gradleJvmTarget)
42-
}
18+
jvmToolchain(11)
4319
}
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,46 @@
11
package buildsrc.convention
22

3+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_5
4+
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion.KOTLIN_1_8
35
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
46

57

68
plugins {
79
id("buildsrc.convention.base")
810
kotlin("jvm")
911
`java-library`
10-
// id("org.jetbrains.dokka")
1112
}
1213

13-
14-
dependencies {
15-
testImplementation("org.junit.jupiter:junit-jupiter")
16-
testRuntimeOnly("org.junit.platform:junit-platform-launcher") {
17-
because("Only needed to run tests in a version of IntelliJ IDEA that bundles older versions")
18-
}
19-
20-
testImplementation("io.kotest:kotest-runner-junit5")
21-
testImplementation("io.kotest:kotest-assertions-core")
22-
testImplementation("io.kotest:kotest-property")
23-
testImplementation("io.kotest:kotest-assertions-json")
24-
25-
testImplementation("io.mockk:mockk")
26-
}
27-
28-
2914
kotlin {
30-
jvmToolchain {
31-
languageVersion.set(JavaLanguageVersion.of(11))
32-
}
15+
jvmToolchain(11)
3316
}
3417

35-
3618
tasks.withType<KotlinCompile>().configureEach {
3719

38-
kotlinOptions {
39-
apiVersion = "1.5"
40-
languageVersion = "1.8"
41-
}
20+
compilerOptions {
21+
apiVersion.set(KOTLIN_1_5)
22+
languageVersion.set(KOTLIN_1_8)
4223

43-
kotlinOptions.freeCompilerArgs += listOf(
44-
"-opt-in=kotlin.RequiresOptIn",
45-
"-opt-in=kotlin.ExperimentalStdlibApi",
46-
"-opt-in=kotlin.time.ExperimentalTime",
47-
)
24+
freeCompilerArgs.addAll(
25+
"-opt-in=kotlin.ExperimentalStdlibApi",
26+
"-opt-in=kotlin.time.ExperimentalTime",
27+
)
28+
}
4829
}
4930

50-
5131
tasks.compileTestKotlin {
52-
kotlinOptions.freeCompilerArgs += "-opt-in=io.kotest.common.ExperimentalKotest"
32+
compilerOptions {
33+
freeCompilerArgs.addAll(
34+
"-opt-in=io.kotest.common.ExperimentalKotest"
35+
)
36+
}
5337
}
5438

55-
5639
tasks.withType<Test>().configureEach {
5740
useJUnitPlatform()
5841
}
5942

60-
6143
java {
6244
withJavadocJar()
6345
withSourcesJar()
6446
}
65-
66-
67-
tasks.withType<Jar>().named("javadocJar") {
68-
// from(tasks.dokkaHtml)
69-
}

gradle/libs.versions.toml

+8-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ kotlinxSerialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-serial
4141
kotlinxSerialization-cbor = { module = "org.jetbrains.kotlinx:kotlinx-serialization-cbor" }
4242
kotlinxSerialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties" }
4343

44-
slf4jApi = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
44+
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
45+
slf4j-simple = { module = "org.slf4j:slf4j-simple", version.ref = "slf4j" }
4546

4647
## Dokka
4748
kotlin-dokkaPlugin-allModulesPage = { module = "org.jetbrains.dokka:all-modules-page-plugin", version.ref = "kotlin-dokka" }
@@ -94,10 +95,10 @@ gradlePlugin-kotlinxSerialization = { module = "org.jetbrains.kotlin:kotlin-seri
9495
#########
9596

9697
kotest = [
97-
"kotest-assertionsCore",
98-
"kotest-assertionsJson",
99-
"kotest-property",
100-
"kotest-frameworkEngine",
101-
"kotest-frameworkDatatest",
102-
"kotest-runnerJUnit5",
98+
"kotest-assertionsCore",
99+
"kotest-assertionsJson",
100+
"kotest-property",
101+
"kotest-frameworkEngine",
102+
"kotest-frameworkDatatest",
103+
"kotest-runnerJUnit5",
103104
]

modules/kotka-streams-extensions/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ dependencies {
1111
implementation(platform(projects.modules.versionsPlatform))
1212

1313
implementation(libs.kafka.streams)
14+
15+
testImplementation(libs.kotest.runnerJUnit5)
16+
testImplementation(libs.kotest.assertionsCore)
17+
testImplementation(libs.kotest.property)
18+
testImplementation(libs.kotest.assertionsJson)
19+
20+
testImplementation(libs.mockk)
1421
}
1522

1623

modules/kotka-streams-framework/build.gradle.kts

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ dependencies {
1313
api(projects.modules.kotkaStreamsExtensions)
1414

1515
implementation(libs.kafka.streams)
16+
17+
testImplementation(libs.kotest.runnerJUnit5)
18+
testImplementation(libs.kotest.assertionsCore)
19+
testImplementation(libs.kotest.property)
20+
testImplementation(libs.kotest.assertionsJson)
21+
22+
testImplementation(libs.mockk)
1623
}
1724

1825

modules/kotka-streams-kotlinx-serialization/build.gradle.kts

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,21 @@ dependencies {
1616

1717
implementation(libs.kafka.streams)
1818

19-
implementation(libs.slf4jApi)
19+
implementation(libs.slf4j.api)
2020

2121
implementation(libs.kotlinxSerialization.core)
2222

23+
testImplementation(libs.kotest.runnerJUnit5)
24+
testImplementation(libs.kotest.assertionsCore)
25+
testImplementation(libs.kotest.property)
26+
testImplementation(libs.kotest.assertionsJson)
27+
28+
testImplementation(libs.mockk)
29+
2330
testImplementation(libs.kotlinxSerialization.cbor)
2431
testImplementation(libs.kotlinxSerialization.json)
32+
33+
testImplementation(libs.slf4j.simple)
2534
}
2635

2736

modules/versions-platform/build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@ plugins {
77

88
description = "Aligns versions of project dependencies"
99

10-
1110
javaPlatform {
1211
allowDependencies()
1312
}
1413

15-
1614
dependencies {
1715
api(platform(libs.kotlin.bom))
1816
api(platform(libs.kotlinxSerialization.bom))
@@ -24,6 +22,8 @@ dependencies {
2422
api(libs.kafka.streams)
2523
api(libs.kotlinx.knitTest)
2624
api(libs.mockk)
25+
api(libs.slf4j.api)
26+
api(libs.slf4j.simple)
2727
}
2828
}
2929

0 commit comments

Comments
 (0)