Skip to content

Commit

Permalink
Merge pull request #586 from arkivanov/enable-js-ir
Browse files Browse the repository at this point in the history
Enable JS IR backend
  • Loading branch information
Arkadii Ivanov authored Mar 26, 2021
2 parents cba3858 + 8a85e08 commit 22c6f28
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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<Project> {
Expand Down Expand Up @@ -46,26 +44,9 @@ class JsPlugin : Plugin<Project> {
}
}
}
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"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 <T> Single<T>.testAwait(assertError: ((Throwable) -> Unit)? = null, assertSuccess: (T) -> Unit = {})
expect fun <T> Single<T>.testAwait(assertError: ((Throwable) -> Unit)? = null, assertSuccess: (T) -> Unit)
Original file line number Diff line number Diff line change
Expand Up @@ -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() =
Expand All @@ -23,6 +23,6 @@ class TestAwaitTest {
val error = Exception()

return singleOfError<Nothing>(error)
.testAwait(assertError = { assertSame(error, it) })
.testAwait(assertError = { assertSame(error, it) }, assertSuccess = {})
}
}

0 comments on commit 22c6f28

Please sign in to comment.