Don't be a chump and expose runMosaicBlocking everywhere
Or, at least, everywhere possible given our constraints.
This commit is contained in:
parent
2ae0256004
commit
a1a42bf4ee
@ -21,7 +21,12 @@ kotlin {
|
||||
}
|
||||
}
|
||||
|
||||
concurrentMain {
|
||||
dependsOn(commonMain)
|
||||
}
|
||||
|
||||
jvmMain {
|
||||
dependsOn(concurrentMain)
|
||||
dependencies {
|
||||
implementation libs.jansi
|
||||
}
|
||||
@ -35,5 +40,8 @@ kotlin {
|
||||
if (target.platformType != KotlinPlatformType.jvm) {
|
||||
target.compilations.main.source(sourceSets.nonJvmMain)
|
||||
}
|
||||
if (target.platformType == KotlinPlatformType.native) {
|
||||
target.compilations.main.source(sourceSets.concurrentMain)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
package com.jakewharton.mosaic
|
||||
|
||||
expect fun runMosaicBlocking(body: suspend MosaicScope.() -> Unit)
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jakewharton.mosaic
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
actual fun runMosaicBlocking(body: suspend MosaicScope.() -> Unit) {
|
||||
runBlocking {
|
||||
runMosaic(body)
|
||||
}
|
||||
}
|
||||
@ -1,16 +1,9 @@
|
||||
package com.jakewharton.mosaic
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import org.fusesource.jansi.AnsiConsole
|
||||
import java.nio.CharBuffer
|
||||
import java.nio.charset.StandardCharsets.UTF_8
|
||||
|
||||
fun runMosaicBlocking(body: suspend MosaicScope.() -> Unit) {
|
||||
runBlocking {
|
||||
runMosaic(body)
|
||||
}
|
||||
}
|
||||
|
||||
private val out = AnsiConsole.out()!!
|
||||
private val encoder = UTF_8.newEncoder()!!
|
||||
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jakewharton.mosaic
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
actual fun runMosaicBlocking(body: suspend MosaicScope.() -> Unit) {
|
||||
runBlocking {
|
||||
runMosaic(body)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jakewharton.mosaic
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
actual fun runMosaicBlocking(body: suspend MosaicScope.() -> Unit) {
|
||||
runBlocking {
|
||||
runMosaic(body)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jakewharton.mosaic
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
actual fun runMosaicBlocking(body: suspend MosaicScope.() -> Unit) {
|
||||
runBlocking {
|
||||
runMosaic(body)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.jakewharton.mosaic
|
||||
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
actual fun runMosaicBlocking(body: suspend MosaicScope.() -> Unit) {
|
||||
runBlocking {
|
||||
runMosaic(body)
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,7 @@
|
||||
package example
|
||||
|
||||
import com.jakewharton.mosaic.runMosaic
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import com.jakewharton.mosaic.runMosaicBlocking
|
||||
|
||||
fun main() = runBlocking {
|
||||
runMosaic {
|
||||
Counter()
|
||||
}
|
||||
fun main() = runMosaicBlocking {
|
||||
Counter()
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user