From 043b62331492f03f9d08dfbbca1a782e99928d38 Mon Sep 17 00:00:00 2001 From: Jigar Brahmbhatt Date: Tue, 10 Oct 2023 11:40:23 -0400 Subject: [PATCH 1/3] Do OptIn instead of Suppression --- extensions/kermit-bugsnag/build.gradle.kts | 3 ++- extensions/kermit-crashlytics/build.gradle.kts | 3 ++- extensions/kermit-koin/build.gradle.kts | 3 ++- kermit-core/build.gradle.kts | 7 ++++--- kermit-simple/build.gradle.kts | 6 ++++-- kermit-test/build.gradle.kts | 6 ++++-- kermit/build.gradle.kts | 6 ++++-- samples/sample-production/shared/build.gradle.kts | 2 ++ samples/sample/shared/build.gradle.kts | 4 ++++ 9 files changed, 28 insertions(+), 12 deletions(-) diff --git a/extensions/kermit-bugsnag/build.gradle.kts b/extensions/kermit-bugsnag/build.gradle.kts index 32fce597..1b288186 100644 --- a/extensions/kermit-bugsnag/build.gradle.kts +++ b/extensions/kermit-bugsnag/build.gradle.kts @@ -11,6 +11,7 @@ * the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -21,7 +22,7 @@ plugins { apply(from = "../../gradle/configure-crash-logger.gradle") kotlin { - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget { publishAllLibraryVariants() diff --git a/extensions/kermit-crashlytics/build.gradle.kts b/extensions/kermit-crashlytics/build.gradle.kts index 665d3b9a..adc2adc5 100644 --- a/extensions/kermit-crashlytics/build.gradle.kts +++ b/extensions/kermit-crashlytics/build.gradle.kts @@ -11,6 +11,7 @@ * the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -22,7 +23,7 @@ plugins { apply(from = "../../gradle/configure-crash-logger.gradle") kotlin { - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget { publishAllLibraryVariants() diff --git a/extensions/kermit-koin/build.gradle.kts b/extensions/kermit-koin/build.gradle.kts index 09f96ba9..120cc67d 100644 --- a/extensions/kermit-koin/build.gradle.kts +++ b/extensions/kermit-koin/build.gradle.kts @@ -11,6 +11,7 @@ * the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -20,7 +21,7 @@ plugins { } kotlin { - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget { publishAllLibraryVariants() diff --git a/kermit-core/build.gradle.kts b/kermit-core/build.gradle.kts index 30ff087e..53d70883 100644 --- a/kermit-core/build.gradle.kts +++ b/kermit-core/build.gradle.kts @@ -11,8 +11,9 @@ * the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension -import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -22,7 +23,7 @@ plugins { } kotlin { - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget { publishAllLibraryVariants() @@ -32,7 +33,7 @@ kotlin { browser() nodejs() } - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalWasmDsl::class) wasm { browser() nodejs() diff --git a/kermit-simple/build.gradle.kts b/kermit-simple/build.gradle.kts index 39ff2cf8..a44ffc26 100644 --- a/kermit-simple/build.gradle.kts +++ b/kermit-simple/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension /* @@ -19,13 +21,13 @@ plugins { } kotlin { - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() js { browser() nodejs() } - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalWasmDsl::class) wasm { browser() nodejs() diff --git a/kermit-test/build.gradle.kts b/kermit-test/build.gradle.kts index 6898eaad..ae30f3d7 100644 --- a/kermit-test/build.gradle.kts +++ b/kermit-test/build.gradle.kts @@ -11,6 +11,8 @@ * the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.tasks.KotlinCompile @@ -21,7 +23,7 @@ plugins { } kotlin { - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget { publishAllLibraryVariants() @@ -31,7 +33,7 @@ kotlin { browser() nodejs() } - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalWasmDsl::class) wasm { browser() nodejs() diff --git a/kermit/build.gradle.kts b/kermit/build.gradle.kts index ca4fccaa..9466120c 100644 --- a/kermit/build.gradle.kts +++ b/kermit/build.gradle.kts @@ -11,6 +11,8 @@ * the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig @@ -24,7 +26,7 @@ plugins { } kotlin { - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget { publishAllLibraryVariants() @@ -34,7 +36,7 @@ kotlin { browser() nodejs() } - @Suppress("OPT_IN_USAGE") + @OptIn(ExperimentalWasmDsl::class) wasm { browser() nodejs() diff --git a/samples/sample-production/shared/build.gradle.kts b/samples/sample-production/shared/build.gradle.kts index bffb3ecd..ed8bc267 100644 --- a/samples/sample-production/shared/build.gradle.kts +++ b/samples/sample-production/shared/build.gradle.kts @@ -8,6 +8,7 @@ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -37,6 +38,7 @@ val KERMIT_VERSION: String by project version = "0.0.1" kotlin { + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget() ios() diff --git a/samples/sample/shared/build.gradle.kts b/samples/sample/shared/build.gradle.kts index 25162cef..29fb0733 100644 --- a/samples/sample/shared/build.gradle.kts +++ b/samples/sample/shared/build.gradle.kts @@ -8,6 +8,8 @@ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi +import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { @@ -37,6 +39,7 @@ val KERMIT_VERSION: String by project version = "0.0.1" kotlin { + @OptIn(ExperimentalKotlinGradlePluginApi::class) targetHierarchy.default() androidTarget() ios() @@ -44,6 +47,7 @@ kotlin { js { browser() } + @OptIn(ExperimentalWasmDsl::class) wasm { browser() } From 65db26b406e95ee7c2de0ee6cfd1c520cce5ae28 Mon Sep 17 00:00:00 2001 From: Jigar Brahmbhatt Date: Tue, 10 Oct 2023 11:48:14 -0400 Subject: [PATCH 2/3] Rename jsWasmMain to jsAndWasmMain --- kermit-core/build.gradle.kts | 4 ++-- .../co/touchlab/kermit/ConsoleWriter.kt | 0 .../touchlab/kermit/JsMutableLoggerConfig.kt | 0 .../kotlin/co/touchlab/kermit/KermitConfig.kt | 0 .../co/touchlab/kermit/platformLogWriter.kt | 0 .../co/touchlab/kermit/ConsoleWriterTest.kt | 0 kermit/build.gradle.kts | 24 +++++-------------- .../kotlin/co/touchlab/kermit/Defaults.kt | 0 8 files changed, 8 insertions(+), 20 deletions(-) rename kermit-core/src/{jsWasmMain => jsAndWasmMain}/kotlin/co/touchlab/kermit/ConsoleWriter.kt (100%) rename kermit-core/src/{jsWasmMain => jsAndWasmMain}/kotlin/co/touchlab/kermit/JsMutableLoggerConfig.kt (100%) rename kermit-core/src/{jsWasmMain => jsAndWasmMain}/kotlin/co/touchlab/kermit/KermitConfig.kt (100%) rename kermit-core/src/{jsWasmMain => jsAndWasmMain}/kotlin/co/touchlab/kermit/platformLogWriter.kt (100%) rename kermit-core/src/{jsWasmTest => jsAndWasmTest}/kotlin/co/touchlab/kermit/ConsoleWriterTest.kt (100%) rename kermit/src/{jsWasmMain => jsAndWasmMain}/kotlin/co/touchlab/kermit/Defaults.kt (100%) diff --git a/kermit-core/build.gradle.kts b/kermit-core/build.gradle.kts index 53d70883..909a23c5 100644 --- a/kermit-core/build.gradle.kts +++ b/kermit-core/build.gradle.kts @@ -117,12 +117,12 @@ kotlin { dependsOn(nativeTest) } - val jsWasmMain by creating { + val jsAndWasmMain by creating { dependsOn(commonMain) getByName("jsMain").dependsOn(this) getByName("wasmMain").dependsOn(this) } - val jsWasmTest by creating { + val jsAndWasmTest by creating { dependsOn(commonTest) getByName("jsTest").dependsOn(this) getByName("wasmTest").dependsOn(this) diff --git a/kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/ConsoleWriter.kt b/kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/ConsoleWriter.kt similarity index 100% rename from kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/ConsoleWriter.kt rename to kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/ConsoleWriter.kt diff --git a/kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/JsMutableLoggerConfig.kt b/kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/JsMutableLoggerConfig.kt similarity index 100% rename from kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/JsMutableLoggerConfig.kt rename to kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/JsMutableLoggerConfig.kt diff --git a/kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/KermitConfig.kt b/kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/KermitConfig.kt similarity index 100% rename from kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/KermitConfig.kt rename to kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/KermitConfig.kt diff --git a/kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/platformLogWriter.kt b/kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/platformLogWriter.kt similarity index 100% rename from kermit-core/src/jsWasmMain/kotlin/co/touchlab/kermit/platformLogWriter.kt rename to kermit-core/src/jsAndWasmMain/kotlin/co/touchlab/kermit/platformLogWriter.kt diff --git a/kermit-core/src/jsWasmTest/kotlin/co/touchlab/kermit/ConsoleWriterTest.kt b/kermit-core/src/jsAndWasmTest/kotlin/co/touchlab/kermit/ConsoleWriterTest.kt similarity index 100% rename from kermit-core/src/jsWasmTest/kotlin/co/touchlab/kermit/ConsoleWriterTest.kt rename to kermit-core/src/jsAndWasmTest/kotlin/co/touchlab/kermit/ConsoleWriterTest.kt diff --git a/kermit/build.gradle.kts b/kermit/build.gradle.kts index 9466120c..95519a6c 100644 --- a/kermit/build.gradle.kts +++ b/kermit/build.gradle.kts @@ -93,27 +93,15 @@ kotlin { dependsOn(nonKotlinMain) } - val jsWasmMain by creating { + val jsAndWasmMain by creating { dependsOn(nonKotlinMain) + getByName("jsMain").dependsOn(this) + getByName("wasmMain").dependsOn(this) } - val jsWasmTest by creating { + val jsAndWasmTest by creating { dependsOn(nonKotlinTest) - } - - val jsMain by getting { - dependsOn(jsWasmMain) - } - - val jsTest by getting { - dependsOn(jsWasmTest) - } - - val wasmMain by getting { - dependsOn(jsWasmMain) - } - - val wasmTest by getting { - dependsOn(jsWasmTest) + getByName("jsTest").dependsOn(this) + getByName("wasmTest").dependsOn(this) } val commonJvmMain by creating { diff --git a/kermit/src/jsWasmMain/kotlin/co/touchlab/kermit/Defaults.kt b/kermit/src/jsAndWasmMain/kotlin/co/touchlab/kermit/Defaults.kt similarity index 100% rename from kermit/src/jsWasmMain/kotlin/co/touchlab/kermit/Defaults.kt rename to kermit/src/jsAndWasmMain/kotlin/co/touchlab/kermit/Defaults.kt From 061761e60ddcd6930765c8c4618c29a86decb28f Mon Sep 17 00:00:00 2001 From: Jigar Brahmbhatt Date: Tue, 10 Oct 2023 12:00:23 -0400 Subject: [PATCH 3/3] Updates based on PR feedback --- .../co/touchlab/kermit/Js.ConsoleActual.kt | 29 ------------------- ...ConsoleActual.kt => Wasm.ConsoleActual.kt} | 0 kermit/build.gradle.kts | 3 -- 3 files changed, 32 deletions(-) delete mode 100644 kermit-core/src/darwinTest/wasmMain/kotlin/co/touchlab/kermit/Js.ConsoleActual.kt rename kermit-core/src/wasmMain/kotlin/co/touchlab/kermit/{Js.ConsoleActual.kt => Wasm.ConsoleActual.kt} (100%) diff --git a/kermit-core/src/darwinTest/wasmMain/kotlin/co/touchlab/kermit/Js.ConsoleActual.kt b/kermit-core/src/darwinTest/wasmMain/kotlin/co/touchlab/kermit/Js.ConsoleActual.kt deleted file mode 100644 index 7237b402..00000000 --- a/kermit-core/src/darwinTest/wasmMain/kotlin/co/touchlab/kermit/Js.ConsoleActual.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2023 Touchlab - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - */ - -package co.touchlab.kermit - -private object ConsoleActual : ConsoleIntf { - override fun error(vararg o: Any?) { - console.error(*o) - } - - override fun warn(vararg o: Any?) { - console.warn(*o) - } - - override fun info(vararg o: Any?) { - console.info(*o) - } - - override fun log(vararg o: Any?) { - console.log(*o) - } -} \ No newline at end of file diff --git a/kermit-core/src/wasmMain/kotlin/co/touchlab/kermit/Js.ConsoleActual.kt b/kermit-core/src/wasmMain/kotlin/co/touchlab/kermit/Wasm.ConsoleActual.kt similarity index 100% rename from kermit-core/src/wasmMain/kotlin/co/touchlab/kermit/Js.ConsoleActual.kt rename to kermit-core/src/wasmMain/kotlin/co/touchlab/kermit/Wasm.ConsoleActual.kt diff --git a/kermit/build.gradle.kts b/kermit/build.gradle.kts index 95519a6c..dcb3b746 100644 --- a/kermit/build.gradle.kts +++ b/kermit/build.gradle.kts @@ -14,10 +14,7 @@ import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension -import org.jetbrains.kotlin.gradle.targets.js.testing.KotlinJsTest -import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import java.time.Duration plugins { id("com.android.library")