From ccb9c5b3aa567fdc33267ffb2fc420a6dbcd72b7 Mon Sep 17 00:00:00 2001 From: Tristan Hamilton Date: Wed, 10 Feb 2021 15:45:16 +0000 Subject: [PATCH] Add iOS build targets --- .github/workflows/ci.yaml | 4 ++-- build.gradle.kts | 2 ++ .../michaelbull/result/coroutines/RunBlockingTest.kt | 11 +++++++++++ .../com/github/michaelbull/result/BindException.kt | 3 +++ 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 kotlin-result-coroutines/src/iosTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt create mode 100644 kotlin-result/src/iosMain/kotlin/com/github/michaelbull/result/BindException.kt diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b905139..da7f78f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,7 +4,7 @@ on: [ push, pull_request ] jobs: check: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 @@ -32,7 +32,7 @@ jobs: publish: needs: check if: github.ref == 'refs/heads/master' && github.event_name == 'push' && needs.check.result == 'success' - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v2 diff --git a/build.gradle.kts b/build.gradle.kts index c0eb4fa..92d03c9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -71,6 +71,8 @@ subprojects { browser() nodejs() } + + ios() } } diff --git a/kotlin-result-coroutines/src/iosTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt b/kotlin-result-coroutines/src/iosTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt new file mode 100644 index 0000000..ee1f583 --- /dev/null +++ b/kotlin-result-coroutines/src/iosTest/kotlin/com/github/michaelbull/result/coroutines/RunBlockingTest.kt @@ -0,0 +1,11 @@ +package com.github.michaelbull.result.coroutines + +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.runBlocking +import kotlin.coroutines.CoroutineContext + +actual fun runBlockingTest(context: CoroutineContext, testBody: suspend CoroutineScope.() -> Unit) { + runBlocking { + testBody(this) + } +} diff --git a/kotlin-result/src/iosMain/kotlin/com/github/michaelbull/result/BindException.kt b/kotlin-result/src/iosMain/kotlin/com/github/michaelbull/result/BindException.kt new file mode 100644 index 0000000..1ea8893 --- /dev/null +++ b/kotlin-result/src/iosMain/kotlin/com/github/michaelbull/result/BindException.kt @@ -0,0 +1,3 @@ +package com.github.michaelbull.result + +internal actual object BindException : Exception()