From f297fcc698690524197532616fc71254f12ea499 Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Mon, 27 Nov 2023 02:43:38 +0200 Subject: [PATCH 1/5] Replace deprecated kotlin.native.internal.GC with kotlin.native.runtime.GC --- runtime/build.gradle | 1 + .../nativeMain/src/kotlinx/benchmark/native/NativeExecutor.kt | 4 +--- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/runtime/build.gradle b/runtime/build.gradle index 2f5892c5..a949ca88 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -55,6 +55,7 @@ kotlin { languageSettings { progressiveMode = true optIn('kotlin.experimental.ExperimentalNativeApi') + optIn("kotlin.native.runtime.NativeRuntimeApi") optIn("kotlinx.cinterop.ExperimentalForeignApi") } } diff --git a/runtime/nativeMain/src/kotlinx/benchmark/native/NativeExecutor.kt b/runtime/nativeMain/src/kotlinx/benchmark/native/NativeExecutor.kt index 55ba6f8d..dff5de0b 100644 --- a/runtime/nativeMain/src/kotlinx/benchmark/native/NativeExecutor.kt +++ b/runtime/nativeMain/src/kotlinx/benchmark/native/NativeExecutor.kt @@ -1,7 +1,7 @@ package kotlinx.benchmark.native import kotlinx.benchmark.* -import kotlin.native.internal.GC +import kotlin.native.runtime.GC import kotlin.time.* class NativeExecutor( @@ -218,7 +218,6 @@ class NativeExecutor( return getStackTrace().joinToString("\n") + "\nCause: ${nested.message}\n" + nested.stacktrace() } - @OptIn(ExperimentalTime::class) private inline fun measure( cycles: Int, nativeGCAfterIteration: Boolean, @@ -239,7 +238,6 @@ class NativeExecutor( return duration.toDouble(DurationUnit.NANOSECONDS) / cycles } - @OptIn(ExperimentalTime::class) private inline fun measureWarmup( name: String, config: BenchmarkConfiguration, From b1a85a85d30c688dd535b85109fa60888f924bf4 Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Mon, 27 Nov 2023 19:22:21 +0200 Subject: [PATCH 2/5] Fix compiler warning: Opt-in requirement marker is unresolved kotlin.native.runtime.NativeRuntimeApi and kotlinx.cinterop.ExperimentalForeignApi opt-in requirement markers are native-only and thus not found in other modules. --- runtime/build.gradle | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/runtime/build.gradle b/runtime/build.gradle index a949ca88..a6e45262 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -54,9 +54,6 @@ kotlin { resources.srcDirs = ["$it.name/resources"] languageSettings { progressiveMode = true - optIn('kotlin.experimental.ExperimentalNativeApi') - optIn("kotlin.native.runtime.NativeRuntimeApi") - optIn("kotlinx.cinterop.ExperimentalForeignApi") } } @@ -109,3 +106,11 @@ if (project.findProperty("publication_repository") == "space") { tasks.withType(KotlinNativeCompile).matching { it.name.toLowerCase().contains("test") }.configureEach { it.dependsOn(tasks.withType(Sign)) } + +tasks.withType(KotlinNativeCompile).configureEach { + compilerOptions.freeCompilerArgs.addAll( + "-opt-in=kotlin.experimental.ExperimentalNativeApi", + "-opt-in=kotlin.native.runtime.NativeRuntimeApi", + "-opt-in=kotlinx.cinterop.ExperimentalForeignApi", + ) +} From 8095e774edc56e6d19d959139189c214803a27d1 Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Mon, 27 Nov 2023 19:23:40 +0200 Subject: [PATCH 3/5] Enable allWarningsAsErrors in runtime project --- runtime/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/build.gradle b/runtime/build.gradle index a6e45262..d95d5fc2 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -45,6 +45,7 @@ kotlin { targets.configureEach { compilations.configureEach { + kotlinOptions.allWarningsAsErrors = true kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes" } } From a1b039f076e3c4d1f9999985be41dbaadee48f0d Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Mon, 27 Nov 2023 20:01:49 +0200 Subject: [PATCH 4/5] Enable allWarningsAsErrors in :example:kotlin-multiplatform project --- examples/kotlin-multiplatform/build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/examples/kotlin-multiplatform/build.gradle b/examples/kotlin-multiplatform/build.gradle index af6e7597..958bf2ba 100644 --- a/examples/kotlin-multiplatform/build.gradle +++ b/examples/kotlin-multiplatform/build.gradle @@ -30,6 +30,12 @@ kotlin { applyDefaultHierarchyTemplate() + targets.configureEach { + compilations.configureEach { + kotlinOptions.allWarningsAsErrors = true + } + } + sourceSets.configureEach { languageSettings { progressiveMode = true From 70d5d37e467b59736fc18b2f7228dd5157d7d268 Mon Sep 17 00:00:00 2001 From: Abduqodiri Qurbonzoda Date: Wed, 29 Nov 2023 15:35:53 +0200 Subject: [PATCH 5/5] Use compilerOptions instead of kotlinOptions --- runtime/build.gradle | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/runtime/build.gradle b/runtime/build.gradle index d95d5fc2..32dd1f5d 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -45,8 +45,10 @@ kotlin { targets.configureEach { compilations.configureEach { - kotlinOptions.allWarningsAsErrors = true - kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes" + compilerOptions.options.with { + allWarningsAsErrors.set(true) + freeCompilerArgs.add("-Xexpect-actual-classes") + } } }