Skip to content

Commit

Permalink
and common linux source set, remove duplications
Browse files Browse the repository at this point in the history
  • Loading branch information
bcmedeiros committed May 12, 2023
1 parent 2e0895e commit 70651e4
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 114 deletions.
29 changes: 27 additions & 2 deletions buildSrc/src/main/kotlin/TargetsConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ val Project.hasJvmAndNix: Boolean get() = hasCommon || files.any { it.name == "j
val Project.hasPosix: Boolean get() = hasCommon || files.any { it.name == "posix" }
val Project.hasDesktop: Boolean get() = hasPosix || files.any { it.name == "desktop" }
val Project.hasNix: Boolean get() = hasPosix || hasJvmAndNix || files.any { it.name == "nix" }
val Project.hasLinux: Boolean get() = hasNix || files.any { it.name == "linux" }
val Project.hasDarwin: Boolean get() = hasNix || files.any { it.name == "darwin" }
val Project.hasWindows: Boolean get() = hasPosix || files.any { it.name == "windows" }
val Project.hasJs: Boolean get() = hasCommon || files.any { it.name == "js" }
val Project.hasJvm: Boolean get() = hasCommon || hasJvmAndNix || files.any { it.name == "jvm" }
val Project.hasNative: Boolean get() = hasCommon || hasNix || hasPosix || hasDarwin || hasDesktop || hasWindows
val Project.hasNative: Boolean get() = hasCommon || hasNix || hasPosix || hasLinux || hasDarwin || hasDesktop || hasWindows

fun Project.configureTargets() {
configureCommon()
Expand All @@ -37,7 +38,7 @@ fun Project.configureTargets() {
configureJs()
}

if (hasPosix || hasDarwin || hasWindows) extra.set("hasNative", true)
if (hasPosix || hasLinux || hasDarwin || hasWindows) extra.set("hasNative", true)

sourceSets {
if (hasPosix) {
Expand Down Expand Up @@ -80,6 +81,11 @@ fun Project.configureTargets() {
}
}

if (hasLinux) {
val linuxMain by creating
val linuxTest by creating
}

if (hasWindows) {
val windowsMain by creating
val windowsTest by creating
Expand Down Expand Up @@ -186,6 +192,25 @@ fun Project.configureTargets() {
}
}

if (hasLinux) {
val linuxMain by getting {
findByName("nixMain")?.let { dependsOn(it) }
}

val linuxTest by getting {
findByName("nixTest")?.let { dependsOn(it) }

dependencies {
implementation(kotlin("test"))
}
}

linuxTargets().forEach {
getByName("${it}Main").dependsOn(linuxMain)
getByName("${it}Test").dependsOn(linuxTest)
}
}

if (hasDesktop) {
val desktopMain by getting {
findByName("posixMain")?.let { dependsOn(it) }
Expand Down

This file was deleted.

37 changes: 0 additions & 37 deletions ktor-network/linuxX64/src/io/ktor/network/util/SocketUtilsLinux.kt

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package io.ktor.test.dispatcher

import kotlinx.coroutines.*
import platform.posix.*
import kotlin.coroutines.*

/**
Expand Down
20 changes: 0 additions & 20 deletions ktor-test-dispatcher/linuxArm64/src/TestLinuxArm64.kt

This file was deleted.

21 changes: 0 additions & 21 deletions ktor-utils/linuxX64/src/io/ktor/util/ThreadInfoLinux.kt

This file was deleted.

0 comments on commit 70651e4

Please sign in to comment.