Get rid of kotlinx-coroutines usage in scripting libs and plugins

the dependency on the coroutines library caused various problems like
KT-30778, or stdlib/runtime version conflicts.
The only function used was `runBlocking`, so this change replaces it
with the internal implementation based on the similar internal thing
from the stdlib.
#KT-30778 fixed
This commit is contained in:
Ilya Chernikov
2021-07-16 11:02:17 +02:00
committed by TeamCityServer
parent 9b1de90452
commit 0cd29adcc7
20 changed files with 89 additions and 67 deletions
@@ -18,9 +18,8 @@
package kotlin.script.experimental.host
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.runBlocking
import kotlin.script.experimental.api.*
import kotlin.script.experimental.impl.internalScriptingRunSuspend
/**
* The base class for scripting host implementations
@@ -32,7 +31,9 @@ abstract class BasicScriptingHost(
/**
* The overridable wrapper for executing evaluation in a desired coroutines context
*/
open fun <T> runInCoroutineContext(block: suspend CoroutineScope.() -> T): T = runBlocking { block() }
open fun <T> runInCoroutineContext(block: suspend () -> T): T =
@Suppress("DEPRECATION_ERROR")
internalScriptingRunSuspend { block() }
/**
* The default implementation of the evaluation function