From 5a95d919c78a4e2752915b2365bacab0048f06e1 Mon Sep 17 00:00:00 2001 From: Pavel Punegov Date: Tue, 9 May 2023 09:39:40 +0000 Subject: [PATCH] [K/N] Add kotlinx.cinterop.ExperimentalForeignApi opt-ins Add more opt-ins in Samples, tests and Benchmarks. This is a follow-up to KT-MR-9788 Merge-request: KT-MR-9997 Merged-by: Pavel Punegov --- .../backend.native/tests/link/purge1/lib.kt | 1 + .../backend.native/tests/samples/build.gradle.kts | 5 ++++- .../performance/cinterop/build.gradle.kts | 14 ++++++++++---- .../kotlin/org/jetbrains/ring/WeakRefBenchmark.kt | 1 + .../org/jetbrains/benchmarksLauncher/Utils.kt | 3 ++- .../org/jetbrains/benchmarksLauncher/Utils.kt | 3 ++- .../org/jetbrains/benchmarksLauncher/Utils.kt | 3 ++- .../kotlin-native/org/jetbrains/analyzer/Utils.kt | 3 ++- 8 files changed, 24 insertions(+), 9 deletions(-) diff --git a/kotlin-native/backend.native/tests/link/purge1/lib.kt b/kotlin-native/backend.native/tests/link/purge1/lib.kt index 52618cd1422..11326bb8bfe 100644 --- a/kotlin-native/backend.native/tests/link/purge1/lib.kt +++ b/kotlin-native/backend.native/tests/link/purge1/lib.kt @@ -2,6 +2,7 @@ * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) import kotlinx.cinterop.convert import platform.posix.* diff --git a/kotlin-native/backend.native/tests/samples/build.gradle.kts b/kotlin-native/backend.native/tests/samples/build.gradle.kts index 451c73e80ca..7263274956b 100644 --- a/kotlin-native/backend.native/tests/samples/build.gradle.kts +++ b/kotlin-native/backend.native/tests/samples/build.gradle.kts @@ -21,7 +21,10 @@ allprojects { } tasks.withType().configureEach { - compilerOptions.freeCompilerArgs.add("-XXLanguage:+ImplicitSignedToUnsignedIntegerConversion") + compilerOptions.freeCompilerArgs.addAll( + "-XXLanguage:+ImplicitSignedToUnsignedIntegerConversion", + "-opt-in=kotlinx.cinterop.ExperimentalForeignApi" + ) } } diff --git a/kotlin-native/performance/cinterop/build.gradle.kts b/kotlin-native/performance/cinterop/build.gradle.kts index e687663f294..bfd3811da94 100644 --- a/kotlin-native/performance/cinterop/build.gradle.kts +++ b/kotlin-native/performance/cinterop/build.gradle.kts @@ -20,8 +20,14 @@ benchmark { } val native = kotlin.targets.getByName("native") as KotlinNativeTarget -native.compilations["main"].cinterops { - create("macros") - create("struct") - create("types") +native.compilations["main"].apply { + cinterops { + create("macros") + create("struct") + create("types") + } + compilerOptions + .options + .freeCompilerArgs + .add("-opt-in=kotlinx.cinterop.ExperimentalForeignApi") } diff --git a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt index 485e530258f..b22bee98fd9 100644 --- a/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt +++ b/kotlin-native/performance/ring/src/main/kotlin/org/jetbrains/ring/WeakRefBenchmark.kt @@ -2,6 +2,7 @@ * Copyright 2010-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) package org.jetbrains.ring diff --git a/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt b/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt index c55ade9165c..69b6f79ecbe 100644 --- a/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt +++ b/kotlin-native/performance/shared/src/main/kotlin-native/common/org/jetbrains/benchmarksLauncher/Utils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. + * Copyright 2010-2023 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) package org.jetbrains.benchmarksLauncher diff --git a/kotlin-native/performance/shared/src/main/kotlin-native/mingw/org/jetbrains/benchmarksLauncher/Utils.kt b/kotlin-native/performance/shared/src/main/kotlin-native/mingw/org/jetbrains/benchmarksLauncher/Utils.kt index 73ee1a49f31..16eb959c704 100644 --- a/kotlin-native/performance/shared/src/main/kotlin-native/mingw/org/jetbrains/benchmarksLauncher/Utils.kt +++ b/kotlin-native/performance/shared/src/main/kotlin-native/mingw/org/jetbrains/benchmarksLauncher/Utils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. + * Copyright 2010-2023 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) package org.jetbrains.benchmarksLauncher diff --git a/kotlin-native/performance/shared/src/main/kotlin-native/posix/org/jetbrains/benchmarksLauncher/Utils.kt b/kotlin-native/performance/shared/src/main/kotlin-native/posix/org/jetbrains/benchmarksLauncher/Utils.kt index 3960886916d..fdb2c0eddba 100644 --- a/kotlin-native/performance/shared/src/main/kotlin-native/posix/org/jetbrains/benchmarksLauncher/Utils.kt +++ b/kotlin-native/performance/shared/src/main/kotlin-native/posix/org/jetbrains/benchmarksLauncher/Utils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2017 JetBrains s.r.o. + * Copyright 2010-2023 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) package org.jetbrains.benchmarksLauncher diff --git a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin-native/org/jetbrains/analyzer/Utils.kt b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin-native/org/jetbrains/analyzer/Utils.kt index 882dedcfc3f..d4c800d2664 100644 --- a/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin-native/org/jetbrains/analyzer/Utils.kt +++ b/kotlin-native/tools/benchmarksAnalyzer/src/main/kotlin-native/org/jetbrains/analyzer/Utils.kt @@ -1,7 +1,8 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * Copyright 2010-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the LICENSE file. */ +@file:OptIn(kotlinx.cinterop.ExperimentalForeignApi::class) package org.jetbrains.analyzer