Skip to content

Commit 592f05f

Browse files
authored
Migrate to a new DSL from a deprecated one (#206)
1 parent f29c098 commit 592f05f

File tree

3 files changed

+23
-18
lines changed

3 files changed

+23
-18
lines changed

benchmarks/build.gradle.kts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import kotlinx.benchmark.gradle.JvmBenchmarkTarget
22
import org.gradle.jvm.tasks.Jar
3+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
34
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
5+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
46

57
plugins {
68
id("kotlin-multiplatform")
@@ -10,6 +12,7 @@ plugins {
1012

1113
evaluationDependsOn(":kotlinx-collections-immutable")
1214

15+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
1316
kotlin {
1417
infra {
1518
target("macosX64")
@@ -19,10 +22,8 @@ kotlin {
1922
}
2023

2124
jvm {
22-
compilations.all {
23-
kotlinOptions {
24-
jvmTarget = "1.8"
25-
}
25+
compilerOptions {
26+
jvmTarget.set(JvmTarget.JVM_1_8)
2627
}
2728
}
2829

build.gradle.kts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
2+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
23

34
buildscript {
45
dependencies {
@@ -44,11 +45,15 @@ allprojects {
4445
}
4546
}
4647

47-
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
48-
kotlinOptions.allWarningsAsErrors = true
49-
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
48+
tasks.withType(KotlinCompilationTask::class).configureEach {
49+
compilerOptions {
50+
allWarningsAsErrors = true
51+
freeCompilerArgs.add("-Xexpect-actual-classes")
52+
}
5053
if (this is KotlinJsCompile) {
51-
kotlinOptions.freeCompilerArgs += "-Xwasm-enable-array-range-checks"
54+
compilerOptions {
55+
freeCompilerArgs.add("-Xwasm-enable-array-range-checks")
56+
}
5257
}
5358
}
5459
}

core/build.gradle.kts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import kotlinx.team.infra.mavenPublicationsPom
2+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
23
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
4+
import org.jetbrains.kotlin.gradle.dsl.JsModuleKind
5+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
36

47
plugins {
58
id("kotlin-multiplatform")
@@ -14,6 +17,7 @@ mavenPublicationsPom {
1417
description = "Kotlin Immutable Collections multiplatform library"
1518
}
1619

20+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
1721
kotlin {
1822
applyDefaultHierarchyTemplate()
1923
explicitApi()
@@ -46,10 +50,8 @@ kotlin {
4650
watchosDeviceArm64()
4751

4852
jvm {
49-
compilations.all {
50-
kotlinOptions {
51-
jvmTarget = "1.8"
52-
}
53+
compilerOptions {
54+
jvmTarget.set(JvmTarget.JVM_1_8)
5355
}
5456
}
5557

@@ -61,12 +63,9 @@ kotlin {
6163
}
6264
}
6365
}
64-
compilations.all {
65-
kotlinOptions {
66-
sourceMap = true
67-
moduleKind = "umd"
68-
metaInfo = true
69-
}
66+
compilerOptions {
67+
sourceMap = true
68+
moduleKind.set(JsModuleKind.MODULE_UMD)
7069
}
7170
}
7271

0 commit comments

Comments
 (0)