From f583759e815cd4a0e56a142006ab2d238706fb52 Mon Sep 17 00:00:00 2001 From: Andrey Mischenko Date: Wed, 10 Oct 2018 01:30:07 +0800 Subject: [PATCH] Version 0.13.0-eap13 with Kotlin 1.3.0-rc-146 --- build.gradle.kts | 6 +++--- src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt | 4 ++-- .../kotlin/ru/gildor/coroutines/retrofit/CallAwaitTest.kt | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index cd8e192..227d03b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper plugins { - id("org.jetbrains.kotlin.jvm") version "1.3-M1" + id("org.jetbrains.kotlin.jvm") version "1.3.0-rc-146" id("com.jfrog.bintray") version "1.8.4" jacoco `maven-publish` @@ -35,7 +35,7 @@ java { dependencies { compile("org.jetbrains.kotlin:kotlin-stdlib") - compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.24.0-eap13") + compile("org.jetbrains.kotlinx:kotlinx-coroutines-core:0.30.2-eap13") compile("com.squareup.retrofit2:retrofit:2.4.0") testCompile("junit:junit:4.12") } @@ -78,7 +78,7 @@ val releaseTag = "v${project.version}" val sourcesJar by tasks.creating(Jar::class) { dependsOn("classes") classifier = "sources" - from(sourceSets["main"].allSource) + from(sourceSets["main"].allJava) } val javadocJar by tasks.creating(Jar::class) { diff --git a/src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt b/src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt index ddc0c4a..bb0bde7 100644 --- a/src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt +++ b/src/main/kotlin/ru/gildor/coroutines/retrofit/CallAwait.kt @@ -34,7 +34,7 @@ public suspend fun Call.await(): T { return suspendCancellableCoroutine { continuation -> enqueue(object : Callback { override fun onResponse(call: Call?, response: Response) { - continuation.resumeWith(SuccessOrFailure.runCatching { + continuation.resumeWith(runCatching { if (response.isSuccessful) { response.body() ?: throw NullPointerException("Response body is null: $response") @@ -89,7 +89,7 @@ public suspend fun Call.awaitResult(): Result { return suspendCancellableCoroutine { continuation -> enqueue(object : Callback { override fun onResponse(call: Call?, response: Response) { - continuation.resumeWith(SuccessOrFailure.runCatching { + continuation.resumeWith(runCatching { if (response.isSuccessful) { val body = response.body() if (body == null) { diff --git a/src/test/kotlin/ru/gildor/coroutines/retrofit/CallAwaitTest.kt b/src/test/kotlin/ru/gildor/coroutines/retrofit/CallAwaitTest.kt index b1a801e..2941e6d 100644 --- a/src/test/kotlin/ru/gildor/coroutines/retrofit/CallAwaitTest.kt +++ b/src/test/kotlin/ru/gildor/coroutines/retrofit/CallAwaitTest.kt @@ -17,7 +17,7 @@ package ru.gildor.coroutines.retrofit import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.Unconfined +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.async import kotlinx.coroutines.runBlocking import org.junit.Assert.assertEquals @@ -32,7 +32,6 @@ import retrofit2.HttpException import ru.gildor.coroutines.retrofit.util.MockedCall import ru.gildor.coroutines.retrofit.util.NullBodyCall import ru.gildor.coroutines.retrofit.util.errorResponse -import kotlin.coroutines.coroutineContext private const val DONE = "Done!" @@ -296,6 +295,6 @@ class CallAwaitTest { } private fun testBlocking(block: suspend CoroutineScope.() -> Unit) { - runBlocking(Unconfined, block) + runBlocking(Dispatchers.Unconfined, block) }