Skip to content

Commit

Permalink
Actually build voice on Windows and fix KLib dump
Browse files Browse the repository at this point in the history
  • Loading branch information
lukellmann committed Apr 17, 2024
1 parent 3500c53 commit 0796312
Show file tree
Hide file tree
Showing 12 changed files with 109 additions and 44 deletions.
34 changes: 19 additions & 15 deletions buildSrc/src/main/kotlin/Targets.kt
Original file line number Diff line number Diff line change
@@ -1,24 +1,10 @@
import org.gradle.api.tasks.TaskContainer
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.kpm.external.ExternalVariantApi
import org.jetbrains.kotlin.gradle.kpm.external.project
import org.jetbrains.kotlin.konan.target.HostManager

@OptIn(ExternalVariantApi::class)
fun KotlinMultiplatformExtension.targets() {
// There are issues with compiling the linux variant on windows
// Please use WSL if you need to work on the linux port
if (!HostManager.hostIsMingw) {
linuxX64()
linuxArm64()
}

jvm()

if (project.name != "voice" && project.name != "core-voice") {
// https://youtrack.jetbrains.com/issue/KTOR-4080
mingwX64()
}

js {
nodejs {
testTask {
Expand All @@ -32,6 +18,11 @@ fun KotlinMultiplatformExtension.targets() {
useCommonJs()
}

linuxX64()
linuxArm64()

mingwX64()

macosArm64()
macosX64()

Expand All @@ -52,3 +43,16 @@ fun KotlinMultiplatformExtension.targets() {
}
}
}

// There are issues with linking the linux variant on windows.
// Please use WSL if you need to work on the linux port.
fun TaskContainer.disableLinuxLinkTestTasksOnWindows() {
if (HostManager.hostIsMingw) {
val linuxLinkTestTasks = listOf("linkDebugTestLinuxX64", "linkDebugTestLinuxArm64")
for (task in linuxLinkTestTasks) {
named(task) {
enabled = false
}
}
}
}
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/kord-multiplatform-module.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,6 @@ tasks {
applyKordDokkaOptions()
dependsOn("kspCommonMainKotlinMetadata")
}

disableLinuxLinkTestTasksOnWindows()
}
2 changes: 1 addition & 1 deletion common/api/common.klib.api
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Klib ABI Dump
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
Expand Down
2 changes: 1 addition & 1 deletion core-voice/api/core-voice.klib.api
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Klib ABI Dump
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, macosArm64, macosX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
Expand Down
2 changes: 1 addition & 1 deletion core/api/core.klib.api
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Klib ABI Dump
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
Expand Down
1 change: 1 addition & 0 deletions core/live-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ tasks {
withType<Test>().configureEach {
useJUnitPlatform()
}
disableLinuxLinkTestTasksOnWindows()
}
2 changes: 1 addition & 1 deletion gateway/api/gateway.klib.api
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Klib ABI Dump
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
Expand Down
2 changes: 1 addition & 1 deletion rest/api/rest.klib.api
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Klib ABI Dump
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Targets: [iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, watchosArm64, watchosSimulatorArm64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
Expand Down
20 changes: 20 additions & 0 deletions samples/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.konan.target.Family
import org.jetbrains.kotlin.konan.target.HostManager

plugins {
org.jetbrains.kotlin.multiplatform
Expand Down Expand Up @@ -59,3 +60,22 @@ kotlin {
}
}
}

tasks {
// There are issues with linking the linux variant on windows.
// Please use WSL if you need to work on the linux port.
/** see [disableLinuxLinkTestTasksOnWindows] */
if (HostManager.hostIsMingw) {
val linuxLinkExecutableTasks = listOf(
"linkDebugExecutableLinuxX64",
"linkDebugExecutableLinuxArm64",
"linkReleaseExecutableLinuxX64",
"linkReleaseExecutableLinuxArm64",
)
for (task in linuxLinkExecutableTasks) {
named(task) {
enabled = false
}
}
}
}
Loading

0 comments on commit 0796312

Please sign in to comment.