Skip to content

Commit 33e96c4

Browse files
authored
Move KotlinCompile configuration to convention (#325)
1 parent 7f02811 commit 33e96c4

File tree

2 files changed

+13
-22
lines changed

2 files changed

+13
-22
lines changed

build-logic/src/main/kotlin/kotlinx/io/conventions/kotlinx-io-multiplatform.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ plugins {
2020
}
2121

2222
kotlin {
23+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
24+
compilerOptions {
25+
allWarningsAsErrors.set(true)
26+
freeCompilerArgs.add("-Xexpect-actual-classes")
27+
}
2328

2429
val versionCatalog: VersionCatalog = extensions.getByType<VersionCatalogsExtension>().named("libs")
2530
jvmToolchain {
@@ -33,6 +38,14 @@ kotlin {
3338
testRuns["test"].executionTask.configure {
3439
useJUnitPlatform()
3540
}
41+
// can be replaced with just `compilerOptions { }` in Kotlin 2.0
42+
compilations.configureEach {
43+
compileTaskProvider.configure {
44+
compilerOptions {
45+
freeCompilerArgs.add("-Xjvm-default=all")
46+
}
47+
}
48+
}
3649
}
3750

3851
js {

build.gradle.kts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,28 +24,6 @@ allprojects {
2424
}
2525
}
2626

27-
subprojects {
28-
tasks.withType<KotlinCompile>().configureEach {
29-
kotlinOptions {
30-
allWarningsAsErrors = true
31-
freeCompilerArgs += "-Xjvm-default=all"
32-
freeCompilerArgs += "-Xexpect-actual-classes"
33-
}
34-
}
35-
tasks.withType<KotlinNativeCompile>().configureEach {
36-
kotlinOptions {
37-
allWarningsAsErrors = true
38-
freeCompilerArgs += "-Xexpect-actual-classes"
39-
}
40-
}
41-
tasks.withType<KotlinJsCompile>().configureEach {
42-
kotlinOptions {
43-
allWarningsAsErrors = true
44-
freeCompilerArgs += "-Xexpect-actual-classes"
45-
}
46-
}
47-
}
48-
4927
@OptIn(ExperimentalBCVApi::class)
5028
apiValidation {
5129
ignoredProjects.add("kotlinx-io-benchmarks")

0 commit comments

Comments
 (0)