Skip to content

Commit

Permalink
KTOR-5753: Enable linuxArm64 builds
Browse files Browse the repository at this point in the history
commit 3f22965
Merge: d6655c5 dd58daa
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Wed Jun 28 01:01:37 2023 +0800

    Merge branch 'main' into linuxArm64

commit d6655c5
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Wed Jun 28 00:54:51 2023 +0800

    revert gradle.properties change

commit 95c5f0d
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Mon Jun 26 23:32:11 2023 +0800

    reverting coroutine unrelated changes

commit ef0c362
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Mon Jun 26 23:25:49 2023 +0800

    use kotlinx.html 0.9.0

commit 05fda8c
Merge: 14f2fd8 cbf747e
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Mon Jun 26 23:24:43 2023 +0800

    Merge remote-tracking branch 'upstream/main' into linuxArm64

commit 14f2fd8
Merge: 60ac170 b4876ca
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Mon Jun 5 22:50:27 2023 +0800

    Merge remote-tracking branch 'mine/linuxArm64' into linuxArm64

commit b4876ca
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Mon Jun 5 22:10:40 2023 +0800

    enable linux/amr64

commit 60ac170
Merge: 8670cdd 299a04b
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Mon Jun 5 21:46:50 2023 +0800

    Merge remote-tracking branch 'upstream/main' into linuxArm64

    # Conflicts:
    #	gradle.properties
    #	gradle/libs.versions.toml
    #	ktor-test-dispatcher/linux/src/TestLinux.kt
    #	ktor-test-dispatcher/linuxX64/src/TestLinuxX64.kt
    #	ktor-test-dispatcher/posix/src/TestPosix.kt

commit 8670cdd
Merge: 84dc07b a5f3c53
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Mon May 15 23:38:36 2023 +0800

    Merge branch 'main' into linuxArm64

commit 84dc07b
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Fri May 12 23:19:46 2023 +0800

    add removed import

commit 70651e4
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Fri May 12 23:17:56 2023 +0800

    and common linux source set, remove duplications

commit 2e0895e
Author: Bruno Medeiros <brunojcm@gmail.com>
Date:   Sun Apr 30 21:58:48 2023 +0800

    Enabling linuxArm64 builds
  • Loading branch information
bcmedeiros committed Jul 6, 2023
1 parent 89a1cb6 commit 44abe43
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 8 deletions.
1 change: 1 addition & 0 deletions buildSrc/src/main/kotlin/IdeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import org.jetbrains.kotlin.konan.target.*

fun KotlinMultiplatformExtension.ideaTarget(): KotlinNativeTarget = when (HostManager.host) {
is KonanTarget.LINUX_X64 -> linuxX64()
is KonanTarget.LINUX_ARM64 -> linuxArm64()
is KonanTarget.MACOS_X64 -> macosX64()
is KonanTarget.MACOS_ARM64 -> macosArm64()
is KonanTarget.MINGW_X64 -> mingwX64()
Expand Down
12 changes: 11 additions & 1 deletion buildSrc/src/main/kotlin/NativeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,16 @@ fun Project.posixTargets(): List<String> = fastOr {
}

fun Project.nixTargets(): List<String> = fastOr {
darwinTargets() + kotlin.linuxX64().name
darwinTargets() + linuxTargets()
}

fun Project.linuxTargets(): List<String> = fastOr {
with(kotlin) {
listOf (
linuxX64(),
linuxArm64(),
)
}.map { it.name }
}

fun Project.darwinTargets(): List<String> = fastOr {
Expand Down Expand Up @@ -71,6 +80,7 @@ fun Project.desktopTargets(): List<String> = fastOr {
macosX64(),
macosArm64(),
linuxX64(),
linuxArm64(),
mingwX64()
).map { it.name }
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Publication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fun isAvailableForPublication(publication: Publication): Boolean {
"kotlinMultiplatform"
)
result = result || name in jvmAndCommon
result = result || (HOST_NAME == "linux" && name == "linuxX64")
result = result || (HOST_NAME == "linux" && (name == "linuxX64" || name == "linuxArm64"))
result = result || (HOST_NAME == "windows" && name == "mingwX64")
val macPublications = setOf(
"iosX64",
Expand Down
30 changes: 28 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 Expand Up @@ -218,6 +243,7 @@ fun Project.configureTargets() {

if (hasNative) {
tasks.findByName("linkDebugTestLinuxX64")?.onlyIf { HOST_NAME == "linux" }
tasks.findByName("linkDebugTestLinuxArm64")?.onlyIf { HOST_NAME == "linux" }
tasks.findByName("linkDebugTestMingwX64")?.onlyIf { HOST_NAME == "windows" }
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ kotlin.native.binary.memoryModel=experimental

kotlin_version=1.8.22
coroutines_version=1.7.1
atomicfu_version=0.20.0
atomicfu_version=0.20.2
slf4j_version=1.7.36
junit_version=4.13.2
logback_version=1.2.11
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[versions]
kotlin-version = "1.8.22"
kotlinx-html-version = "0.8.1"
kotlinx-html-version = "0.9.0"
coroutines-version = "1.7.1"
atomicfu-version = "0.18.5"
atomicfu-version = "0.20.2"
serialization-version = "1.5.1"
validator-version = "0.8.0"
ktlint-version = "3.15.0"
Expand Down
2 changes: 1 addition & 1 deletion ktor-client/ktor-client-curl/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ kotlin {
includeDirs.headerFilterOnly(paths)
}

createCInterop("libcurl", listOf("macosArm64")) {
createCInterop("libcurl", listOf("macosArm64", "linuxArm64")) {
defFile = File(projectDir, "desktop/interop/libcurl_arm64.def")
includeDirs.headerFilterOnly(paths)
}
Expand Down

0 comments on commit 44abe43

Please sign in to comment.