From 2c322aa3de19dd3abac911a7eb504627ae466ac5 Mon Sep 17 00:00:00 2001 From: Arkadii Ivanov Date: Fri, 12 Feb 2021 16:15:07 +0000 Subject: [PATCH 1/2] Enable JS IR backend --- gradle.properties | 2 ++ .../badoo/reaktive/configuration/JsPlugin.kt | 19 ------------------- 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/gradle.properties b/gradle.properties index 967fec25f..004fca198 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,3 +8,5 @@ org.gradle.caching=true android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true + +kotlin.js.compiler=both diff --git a/includedBuild/gradleConfiguration/src/main/kotlin/com/badoo/reaktive/configuration/JsPlugin.kt b/includedBuild/gradleConfiguration/src/main/kotlin/com/badoo/reaktive/configuration/JsPlugin.kt index 0b31c93ea..75398e644 100644 --- a/includedBuild/gradleConfiguration/src/main/kotlin/com/badoo/reaktive/configuration/JsPlugin.kt +++ b/includedBuild/gradleConfiguration/src/main/kotlin/com/badoo/reaktive/configuration/JsPlugin.kt @@ -5,9 +5,7 @@ import com.badoo.reaktive.dependencies.Deps import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.api.tasks.SourceSet -import org.jetbrains.kotlin.gradle.dsl.KotlinJsOptions import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension -import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile @Suppress("UnstableApiUsage") class JsPlugin : Plugin { @@ -46,26 +44,9 @@ class JsPlugin : Plugin { } } } - target.tasks.named(TASK_COMPILE_KOTLIN_JS, Kotlin2JsCompile::class.java) { - kotlinOptions.configure() - } - target.tasks.named(TASK_COMPILE_KOTLIN_JS_TEST, Kotlin2JsCompile::class.java) { - kotlinOptions.configure() - } - } - - private fun KotlinJsOptions.configure() { - metaInfo = true - sourceMap = true - sourceMapEmbedSources = "always" - moduleKind = "umd" - main = "call" } companion object { - private const val TASK_COMPILE_KOTLIN_JS = "compileKotlinJs" - private const val TASK_COMPILE_KOTLIN_JS_TEST = "compileTestKotlinJs" - const val TARGET_NAME_JS = "js" } } From 8a85e0804562b4aab394beee01f7d9efe5e5c352 Mon Sep 17 00:00:00 2001 From: Arkadii Ivanov Date: Fri, 26 Mar 2021 12:50:43 +0000 Subject: [PATCH 2/2] Remove default value of assertSuccess in testAwait --- .../kotlin/com/badoo/reaktive/test/single/TestAwait.kt | 2 +- .../kotlin/com/badoo/reaktive/test/single/TestAwaitTest.kt | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/reaktive-testing/src/commonMain/kotlin/com/badoo/reaktive/test/single/TestAwait.kt b/reaktive-testing/src/commonMain/kotlin/com/badoo/reaktive/test/single/TestAwait.kt index c0d0c36ab..88533eb54 100644 --- a/reaktive-testing/src/commonMain/kotlin/com/badoo/reaktive/test/single/TestAwait.kt +++ b/reaktive-testing/src/commonMain/kotlin/com/badoo/reaktive/test/single/TestAwait.kt @@ -50,4 +50,4 @@ import com.badoo.reaktive.single.Single * @param assertSuccess when provided, it will be called in case of [Single] success. * This gives an opportunity to assert the result. */ -expect fun Single.testAwait(assertError: ((Throwable) -> Unit)? = null, assertSuccess: (T) -> Unit = {}) +expect fun Single.testAwait(assertError: ((Throwable) -> Unit)? = null, assertSuccess: (T) -> Unit) diff --git a/reaktive-testing/src/commonTest/kotlin/com/badoo/reaktive/test/single/TestAwaitTest.kt b/reaktive-testing/src/commonTest/kotlin/com/badoo/reaktive/test/single/TestAwaitTest.kt index 0c1eb00f0..52040e97e 100644 --- a/reaktive-testing/src/commonTest/kotlin/com/badoo/reaktive/test/single/TestAwaitTest.kt +++ b/reaktive-testing/src/commonTest/kotlin/com/badoo/reaktive/test/single/TestAwaitTest.kt @@ -9,9 +9,9 @@ import kotlin.test.assertSame class TestAwaitTest { @Test - fun succeeds_WHEN_upstream_succeeded_and_no_assertSuccess() = + fun succeeds_WHEN_upstream_succeeded_and_empty_assertSuccess() = singleOf(1) - .testAwait() + .testAwait(assertSuccess = {}) @Test fun succeeds_WHEN_upstream_succeeded_and_assertSuccess_did_not_throw() = @@ -23,6 +23,6 @@ class TestAwaitTest { val error = Exception() return singleOfError(error) - .testAwait(assertError = { assertSame(error, it) }) + .testAwait(assertError = { assertSame(error, it) }, assertSuccess = {}) } }