Skip to content

Commit

Permalink
Merge pull request #78 from efirestone/firestone/fix-native-tests
Browse files Browse the repository at this point in the history
Fix Kotlin/Native tests
  • Loading branch information
efirestone authored Oct 22, 2023
2 parents 581d304 + 4651ce2 commit 6a356a6
Show file tree
Hide file tree
Showing 4 changed files with 556 additions and 516 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,7 @@ jobs:
java-version: '17'

- name: Code Check
# Skip nativeTest for now. We support building for multiplatform, but won't support
# deploying to iOS (native) will be supported once the new Kotlin/Native memory and
# threading model is released.
run: ./gradlew --no-daemon clean check -x nativeTest
run: ./gradlew --no-daemon clean check

# Error out if any files were left dirty as the result of running the above.
- name: Check for dirty files
Expand Down
29 changes: 9 additions & 20 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import org.jetbrains.dokka.gradle.DokkaTask
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import javax.xml.parsers.DocumentBuilderFactory

val kermitVersion: String by project
Expand All @@ -22,6 +22,7 @@ repositories {
mavenCentral()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
kotlin {
jvm {
compilations.all {
Expand All @@ -31,12 +32,12 @@ kotlin {
}
}
}
val hostOs = System.getProperty("os.name")
val nativeTarget = when (hostOs) {
"Mac OS X" -> macosX64("native")
"Linux" -> linuxX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}

targetHierarchy.default()

linuxX64()
macosX64()
macosArm64()

sourceSets {
val commonMain by getting {
Expand Down Expand Up @@ -68,10 +69,7 @@ kotlin {
val jvmTest by getting
val nativeMain by getting {
dependencies {
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-macosx64:1.6.0-native-mt") {
// https://youtrack.jetbrains.com/issue/KT-41378
version { strictly("1.6.0-native-mt") }
}
implementation("io.ktor:ktor-client-cio:$ktorVersion")
}
}
val nativeTest by getting
Expand Down Expand Up @@ -147,12 +145,3 @@ ktlint {
version.set("0.50.0")
ignoreFailures.set(false)
}

val compileKotlinNative: KotlinNativeCompile by tasks
compileKotlinNative.apply {
kotlinOptions.freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
}
val compileTestKotlinNative: KotlinNativeCompile by tasks
compileTestKotlinNative.apply {
kotlinOptions.freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
}
Loading

0 comments on commit 6a356a6

Please sign in to comment.