Go和Kotlin/Native协程对比

时间:2024-10-14 07:33:59
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTargetWithTests plugins { id '' version '1.4.10' } group = 'me.10221903' version = '1.0-SNAPSHOT' repositories { mavenCentral() } kotlin { def hostOs = System.getProperty("") def isMingwX64 = hostOs.startsWith("Windows") KotlinNativeTargetWithTests nativeTarget if (hostOs == "Mac OS X") nativeTarget = macosX64('native') else if (hostOs == "Linux") nativeTarget = linuxX64("native") else if (isMingwX64) nativeTarget = mingwX64("native") else throw new GradleException("Host OS is not supported in Kotlin/Native.") nativeTarget.with { binaries { executable { entryPoint = 'main' } } } sourceSets { nativeMain { dependencies { // implementation ":coroutineworker:0.6.2" implementation ":kotlinx-coroutines-core:1.3.9-native-mt" } } nativeTest { } } }