From 23ca02bd3dd9792e2ca5d0ee2f78e8d1f7d32005 Mon Sep 17 00:00:00 2001 From: Salomon BRYS Date: Tue, 20 Dec 2022 13:02:34 +0100 Subject: [PATCH] Moving JS only runtime to JS sourceset, using unsafeCast instead of dynamicCastTo. --- build.gradle.kts | 2 +- .../kustomexport/compiler/ExportCompiler.kt | 6 +--- .../kustomexport/compiler/js/Extensions.kt | 2 +- .../pattern/{class => }/ClassTransformer.kt | 24 ++++----------- .../js/pattern/{enum => }/EnumTransformer.kt | 3 +- .../{function => }/FunctionTransformer.kt | 6 +--- .../{interface => }/InterfaceTransformer.kt | 6 +--- .../{class => }/SealedClassTransformer.kt | 2 +- .../{value => }/ValueClassTransformer.kt | 2 +- .../kotlin/deezer/kustomexport/Dynamics.kt | 29 ------------------- .../deezer/kustomexport/dynamicCastTo.kt | 9 ------ .../deezer/kustomexport/dynamicCastTo.kt | 22 -------------- .../kotlin/deezer/kustomexport/dynamicNull.kt | 27 ----------------- .../kotlin/kustomexport/dynamicCastTo.kt | 22 -------------- .../kotlin/kustomexport/dynamicNull.kt | 27 ----------------- .../kotlin/deezer/kustomexport/Dynamics.kt | 6 ++-- .../deezer/kustomexport/dynamicCastTo.kt | 23 --------------- .../deezer/kustomexport/dynamicCastTo.kt | 22 -------------- .../kotlin/deezer/kustomexport/dynamicNull.kt | 27 ----------------- .../tvosMain/kotlin/kustom/dynamicCastTo.kt | 22 -------------- lib/src/tvosMain/kotlin/kustom/dynamicNull.kt | 27 ----------------- .../kotlin/kustom/dynamicCastTo.kt | 22 -------------- .../watchosMain/kotlin/kustom/dynamicNull.kt | 27 ----------------- 23 files changed, 16 insertions(+), 349 deletions(-) rename compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/{class => }/ClassTransformer.kt (88%) rename compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/{enum => }/EnumTransformer.kt (97%) rename compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/{function => }/FunctionTransformer.kt (86%) rename compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/{interface => }/InterfaceTransformer.kt (96%) rename compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/{class => }/SealedClassTransformer.kt (99%) rename compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/{value => }/ValueClassTransformer.kt (97%) delete mode 100644 lib/src/commonMain/kotlin/deezer/kustomexport/Dynamics.kt delete mode 100644 lib/src/commonMain/kotlin/deezer/kustomexport/dynamicCastTo.kt delete mode 100644 lib/src/iosMain/kotlin/deezer/kustomexport/dynamicCastTo.kt delete mode 100644 lib/src/iosMain/kotlin/deezer/kustomexport/dynamicNull.kt delete mode 100644 lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicCastTo.kt delete mode 100644 lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicNull.kt delete mode 100644 lib/src/jsMain/kotlin/deezer/kustomexport/dynamicCastTo.kt delete mode 100644 lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicCastTo.kt delete mode 100644 lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicNull.kt delete mode 100644 lib/src/tvosMain/kotlin/kustom/dynamicCastTo.kt delete mode 100644 lib/src/tvosMain/kotlin/kustom/dynamicNull.kt delete mode 100644 lib/src/watchosMain/kotlin/kustom/dynamicCastTo.kt delete mode 100644 lib/src/watchosMain/kotlin/kustom/dynamicNull.kt diff --git a/build.gradle.kts b/build.gradle.kts index ba7478e..f338005 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,7 +24,7 @@ plugins { allprojects { group = "deezer.kustomexport" - version = "0.7.0" + version = "0.8.0" repositories { mavenLocal() diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/ExportCompiler.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/ExportCompiler.kt index 1bebe7f..369e19f 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/ExportCompiler.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/ExportCompiler.kt @@ -43,13 +43,9 @@ import deezer.kustomexport.compiler.js.InterfaceDescriptor import deezer.kustomexport.compiler.js.SealedClassDescriptor import deezer.kustomexport.compiler.js.TopLevelFunctionDescriptor import deezer.kustomexport.compiler.js.ValueClassDescriptor -import deezer.kustomexport.compiler.js.pattern.`class`.transform -import deezer.kustomexport.compiler.js.pattern.`interface`.transform -import deezer.kustomexport.compiler.js.pattern.enum.transform -import deezer.kustomexport.compiler.js.pattern.function.transform +import deezer.kustomexport.compiler.js.pattern.transform import deezer.kustomexport.compiler.js.pattern.parseClass import deezer.kustomexport.compiler.js.pattern.parseFunction -import deezer.kustomexport.compiler.js.pattern.value.transform // Trick to share the Logger everywhere without injecting the dependency everywhere internal lateinit var sharedLogger: KSPLogger diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/Extensions.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/Extensions.kt index ea17a35..6d63be5 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/Extensions.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/Extensions.kt @@ -25,8 +25,8 @@ import com.squareup.kotlinpoet.TypeName import deezer.kustomexport.compiler.CompilerArgs val jsExport = ClassName("kotlin.js", "JsExport") +val unsafeCast = MemberName("kotlin.js", "unsafeCast") -val dynamicCastTo = MemberName("deezer.kustomexport", "dynamicCastTo") val dynamicNull = MemberName("deezer.kustomexport", "dynamicNull") val dynamicString = MemberName("deezer.kustomexport", "dynamicString") val dynamicNotString = MemberName("deezer.kustomexport", "dynamicNotString") diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/class/ClassTransformer.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/ClassTransformer.kt similarity index 88% rename from compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/class/ClassTransformer.kt rename to compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/ClassTransformer.kt index f29120e..186ded5 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/class/ClassTransformer.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/ClassTransformer.kt @@ -15,7 +15,7 @@ * under the License. */ -package deezer.kustomexport.compiler.js.pattern.`class` +package deezer.kustomexport.compiler.js.pattern import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.CodeBlock @@ -28,22 +28,8 @@ import com.squareup.kotlinpoet.PropertySpec import com.squareup.kotlinpoet.STRING import com.squareup.kotlinpoet.TypeName import com.squareup.kotlinpoet.TypeSpec -import deezer.kustomexport.compiler.js.ALL_KOTLIN_EXCEPTIONS -import deezer.kustomexport.compiler.js.ClassDescriptor -import deezer.kustomexport.compiler.js.FormatString -import deezer.kustomexport.compiler.js.MethodNameDisambiguation -import deezer.kustomexport.compiler.js.ParameterDescriptor -import deezer.kustomexport.compiler.js.dynamicCastTo -import deezer.kustomexport.compiler.js.dynamicNotString -import deezer.kustomexport.compiler.js.dynamicNull -import deezer.kustomexport.compiler.js.dynamicString -import deezer.kustomexport.compiler.js.jsExport -import deezer.kustomexport.compiler.js.jsPackage +import deezer.kustomexport.compiler.js.* import deezer.kustomexport.compiler.js.mapping.INDENTATION -import deezer.kustomexport.compiler.js.pattern.asClassName -import deezer.kustomexport.compiler.js.pattern.buildWrappingFunction -import deezer.kustomexport.compiler.js.pattern.overrideGetterSetter -import deezer.kustomexport.compiler.js.pattern.suppress fun ClassDescriptor.transform() = transformClass(this) @@ -140,9 +126,9 @@ private fun buildExportedClass( // Without that, it fails at runtime because there is no dynamicCastTo method on null. // > TypeError: Cannot read properties of null (reading 'dynamicCastTo') origin.constructorParams - .joinToString { "${it.name}·=·%M${if (ctorDyn == dynamicNull) "?" else ""}.%M<%T>()" }, + .joinToString { "${it.name}·=·%M.%M<%T>()" }, *origin.constructorParams - .flatMap { listOf(ctorDyn, dynamicCastTo, it.type.exportedTypeName) }.toTypedArray() + .flatMap { listOf(ctorDyn, unsafeCast, it.type.exportedTypeName) }.toTypedArray() ) ) .addParameter(ParameterSpec("common", originalClass)) @@ -188,7 +174,7 @@ private fun buildExportedClass( b.addSuperclassConstructorParameter( CodeBlock.of( "common = %M.%M<%T>()", - dynamicNull, dynamicCastTo, supr.origin.concreteTypeName.asClassName() + dynamicNull, unsafeCast, supr.origin.concreteTypeName.asClassName() ) ) } diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/enum/EnumTransformer.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/EnumTransformer.kt similarity index 97% rename from compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/enum/EnumTransformer.kt rename to compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/EnumTransformer.kt index 4a6740c..460aee7 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/enum/EnumTransformer.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/EnumTransformer.kt @@ -15,7 +15,7 @@ * under the License. */ -package deezer.kustomexport.compiler.js.pattern.enum +package deezer.kustomexport.compiler.js.pattern import com.squareup.kotlinpoet.ARRAY import com.squareup.kotlinpoet.ClassName @@ -30,7 +30,6 @@ import deezer.kustomexport.compiler.js.EnumDescriptor import deezer.kustomexport.compiler.js.jsExport import deezer.kustomexport.compiler.js.jsPackage import deezer.kustomexport.compiler.js.mapping.INDENTATION -import deezer.kustomexport.compiler.js.pattern.overrideGetterSetter fun EnumDescriptor.transform() = transformEnum(this) diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/function/FunctionTransformer.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/FunctionTransformer.kt similarity index 86% rename from compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/function/FunctionTransformer.kt rename to compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/FunctionTransformer.kt index 826307d..92c8365 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/function/FunctionTransformer.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/FunctionTransformer.kt @@ -15,18 +15,14 @@ * under the License. */ -package deezer.kustomexport.compiler.js.pattern.function +package deezer.kustomexport.compiler.js.pattern import com.squareup.kotlinpoet.FileSpec import com.squareup.kotlinpoet.FunSpec -import com.squareup.kotlinpoet.KModifier import com.squareup.kotlinpoet.MemberName import deezer.kustomexport.compiler.js.TopLevelFunctionDescriptor import deezer.kustomexport.compiler.js.jsExport import deezer.kustomexport.compiler.js.jsPackage -import deezer.kustomexport.compiler.js.pattern.addParameters -import deezer.kustomexport.compiler.js.pattern.buildWrappingFunctionBody -import deezer.kustomexport.compiler.js.pattern.returnType fun TopLevelFunctionDescriptor.transform() = transformFunction(this) diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/interface/InterfaceTransformer.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/InterfaceTransformer.kt similarity index 96% rename from compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/interface/InterfaceTransformer.kt rename to compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/InterfaceTransformer.kt index f68bfc5..ef5c9ff 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/interface/InterfaceTransformer.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/InterfaceTransformer.kt @@ -15,7 +15,7 @@ * under the License. */ -package deezer.kustomexport.compiler.js.pattern.`interface` +package deezer.kustomexport.compiler.js.pattern import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.FileSpec @@ -33,10 +33,6 @@ import deezer.kustomexport.compiler.js.PropertyDescriptor import deezer.kustomexport.compiler.js.jsExport import deezer.kustomexport.compiler.js.jsPackage import deezer.kustomexport.compiler.js.mapping.INDENTATION -import deezer.kustomexport.compiler.js.pattern.OverrideMode -import deezer.kustomexport.compiler.js.pattern.buildWrappingFunction -import deezer.kustomexport.compiler.js.pattern.overrideGetterSetter -import deezer.kustomexport.compiler.js.pattern.packageName import java.util.Locale fun InterfaceDescriptor.transform() = transformInterface(this) diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/class/SealedClassTransformer.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/SealedClassTransformer.kt similarity index 99% rename from compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/class/SealedClassTransformer.kt rename to compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/SealedClassTransformer.kt index 55f447d..749072d 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/class/SealedClassTransformer.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/SealedClassTransformer.kt @@ -15,7 +15,7 @@ * under the License. */ -package deezer.kustomexport.compiler.js.pattern.`class` +package deezer.kustomexport.compiler.js.pattern import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.CodeBlock diff --git a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/value/ValueClassTransformer.kt b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/ValueClassTransformer.kt similarity index 97% rename from compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/value/ValueClassTransformer.kt rename to compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/ValueClassTransformer.kt index 39b7563..01c4cef 100644 --- a/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/value/ValueClassTransformer.kt +++ b/compiler/src/main/kotlin/deezer/kustomexport/compiler/js/pattern/ValueClassTransformer.kt @@ -15,7 +15,7 @@ * under the License. */ -package deezer.kustomexport.compiler.js.pattern.value +package deezer.kustomexport.compiler.js.pattern import com.squareup.kotlinpoet.ClassName import com.squareup.kotlinpoet.FileSpec diff --git a/lib/src/commonMain/kotlin/deezer/kustomexport/Dynamics.kt b/lib/src/commonMain/kotlin/deezer/kustomexport/Dynamics.kt deleted file mode 100644 index ba311b9..0000000 --- a/lib/src/commonMain/kotlin/deezer/kustomexport/Dynamics.kt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -// KSP issue is limiting JS generation at the moment -// https://github.com/google/ksp/issues/728 -// As a hack, we generate JS facade for KotlinMetadata instead, so we define this expect/actual pattern -// Eventually we should only have dynamics in jsMain. - - -expect val dynamicNull: Any -expect val dynamicString: Any -expect val dynamicNotString: Any - diff --git a/lib/src/commonMain/kotlin/deezer/kustomexport/dynamicCastTo.kt b/lib/src/commonMain/kotlin/deezer/kustomexport/dynamicCastTo.kt deleted file mode 100644 index 5969e26..0000000 --- a/lib/src/commonMain/kotlin/deezer/kustomexport/dynamicCastTo.kt +++ /dev/null @@ -1,9 +0,0 @@ -package deezer.kustomexport - -/** - * This is implemented ONLY for JS. - * It will throw an error on other platforms. - * NB : do not use "Any?" as receiver here: - * it's used on dynamic types and can lead to Typescript runtime errors. - */ -expect fun Any.dynamicCastTo(): T diff --git a/lib/src/iosMain/kotlin/deezer/kustomexport/dynamicCastTo.kt b/lib/src/iosMain/kotlin/deezer/kustomexport/dynamicCastTo.kt deleted file mode 100644 index 1180e8b..0000000 --- a/lib/src/iosMain/kotlin/deezer/kustomexport/dynamicCastTo.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual fun Any.dynamicCastTo(): T { - error("Not available on this platform") -} \ No newline at end of file diff --git a/lib/src/iosMain/kotlin/deezer/kustomexport/dynamicNull.kt b/lib/src/iosMain/kotlin/deezer/kustomexport/dynamicNull.kt deleted file mode 100644 index 3275144..0000000 --- a/lib/src/iosMain/kotlin/deezer/kustomexport/dynamicNull.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual val dynamicNull: Any - get() = TODO("Not yet implemented") - -actual val dynamicString: Any - get() = TODO("Not yet implemented") - -actual val dynamicNotString: Any - get() = TODO("Not yet implemented") diff --git a/lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicCastTo.kt b/lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicCastTo.kt deleted file mode 100644 index 1180e8b..0000000 --- a/lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicCastTo.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual fun Any.dynamicCastTo(): T { - error("Not available on this platform") -} \ No newline at end of file diff --git a/lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicNull.kt b/lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicNull.kt deleted file mode 100644 index 3275144..0000000 --- a/lib/src/iosSimulatorArm64Main/kotlin/kustomexport/dynamicNull.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual val dynamicNull: Any - get() = TODO("Not yet implemented") - -actual val dynamicString: Any - get() = TODO("Not yet implemented") - -actual val dynamicNotString: Any - get() = TODO("Not yet implemented") diff --git a/lib/src/jsMain/kotlin/deezer/kustomexport/Dynamics.kt b/lib/src/jsMain/kotlin/deezer/kustomexport/Dynamics.kt index a39ff80..39e5597 100644 --- a/lib/src/jsMain/kotlin/deezer/kustomexport/Dynamics.kt +++ b/lib/src/jsMain/kotlin/deezer/kustomexport/Dynamics.kt @@ -17,6 +17,6 @@ package deezer.kustomexport -actual val dynamicNull: dynamic = null -actual val dynamicString: dynamic = "marker" -actual val dynamicNotString: dynamic = 123456 +val dynamicNull: dynamic = null +val dynamicString: dynamic = "marker" +val dynamicNotString: dynamic = 123456 diff --git a/lib/src/jsMain/kotlin/deezer/kustomexport/dynamicCastTo.kt b/lib/src/jsMain/kotlin/deezer/kustomexport/dynamicCastTo.kt deleted file mode 100644 index f2b4152..0000000 --- a/lib/src/jsMain/kotlin/deezer/kustomexport/dynamicCastTo.kt +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual fun Any.dynamicCastTo(): T { - val dyn: dynamic = this - return dyn as T -} diff --git a/lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicCastTo.kt b/lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicCastTo.kt deleted file mode 100644 index 1180e8b..0000000 --- a/lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicCastTo.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual fun Any.dynamicCastTo(): T { - error("Not available on this platform") -} \ No newline at end of file diff --git a/lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicNull.kt b/lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicNull.kt deleted file mode 100644 index 3275144..0000000 --- a/lib/src/jvmMain/kotlin/deezer/kustomexport/dynamicNull.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual val dynamicNull: Any - get() = TODO("Not yet implemented") - -actual val dynamicString: Any - get() = TODO("Not yet implemented") - -actual val dynamicNotString: Any - get() = TODO("Not yet implemented") diff --git a/lib/src/tvosMain/kotlin/kustom/dynamicCastTo.kt b/lib/src/tvosMain/kotlin/kustom/dynamicCastTo.kt deleted file mode 100644 index 1180e8b..0000000 --- a/lib/src/tvosMain/kotlin/kustom/dynamicCastTo.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual fun Any.dynamicCastTo(): T { - error("Not available on this platform") -} \ No newline at end of file diff --git a/lib/src/tvosMain/kotlin/kustom/dynamicNull.kt b/lib/src/tvosMain/kotlin/kustom/dynamicNull.kt deleted file mode 100644 index 3275144..0000000 --- a/lib/src/tvosMain/kotlin/kustom/dynamicNull.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual val dynamicNull: Any - get() = TODO("Not yet implemented") - -actual val dynamicString: Any - get() = TODO("Not yet implemented") - -actual val dynamicNotString: Any - get() = TODO("Not yet implemented") diff --git a/lib/src/watchosMain/kotlin/kustom/dynamicCastTo.kt b/lib/src/watchosMain/kotlin/kustom/dynamicCastTo.kt deleted file mode 100644 index 1180e8b..0000000 --- a/lib/src/watchosMain/kotlin/kustom/dynamicCastTo.kt +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual fun Any.dynamicCastTo(): T { - error("Not available on this platform") -} \ No newline at end of file diff --git a/lib/src/watchosMain/kotlin/kustom/dynamicNull.kt b/lib/src/watchosMain/kotlin/kustom/dynamicNull.kt deleted file mode 100644 index 3275144..0000000 --- a/lib/src/watchosMain/kotlin/kustom/dynamicNull.kt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2021 Deezer. - * - * 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 deezer.kustomexport - -actual val dynamicNull: Any - get() = TODO("Not yet implemented") - -actual val dynamicString: Any - get() = TODO("Not yet implemented") - -actual val dynamicNotString: Any - get() = TODO("Not yet implemented")