Skip to content

Commit

Permalink
Gonna Try Darwin and Curl Again...
Browse files Browse the repository at this point in the history
  • Loading branch information
gmitch215 committed Dec 22, 2024
1 parent 443f533 commit 7506f60
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 16 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,15 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- name: linux
os: ubuntu-latest
- name: macos-arm64
os: macos-latest
- name: macos-x64
os: macos-13
- name: windows
os: windows-latest

name: Build Java 17 / ${{ matrix.os }}
steps:
Expand All @@ -67,6 +75,9 @@ jobs:
key: ${{ runner.os }}-konan-${{ hashFiles('**/Dependencies.kt') }}
restore-keys: |
${{ runner.os }}-konan-
- name: Install Linux Dependencies
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get install libcurl4-gnutls-dev
- name: Change Permissions
run: chmod +x ./gradlew
- name: Build with Gradle
Expand All @@ -77,7 +88,7 @@ jobs:
- name: Archive Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts-${{ runner.os }}
name: build-artifacts-${{ matrix.name }}
path: build/libs/
- name: Stop Gradle
run: ./gradlew --stop
Expand Down
12 changes: 5 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,13 @@ kotlin {
implementation("io.ktor:ktor-client-winhttp:$ktorVersion")
}

val posixMain by creating {
dependsOn(commonMain.get())
appleMain.dependencies {
implementation("io.ktor:ktor-client-darwin:$ktorVersion")
}

dependencies {
implementation("io.ktor:ktor-client-cio:$ktorVersion")
implementation("io.ktor:ktor-network-tls:$ktorVersion")
}
linuxMain.dependencies {
implementation("io.ktor:ktor-client-curl:3.0.2")
}
listOf(appleMain, linuxMain).forEach { it.get().dependsOn(posixMain) }

jsMain.dependencies {
implementation("io.ktor:ktor-client-js:$ktorVersion")
Expand Down
18 changes: 18 additions & 0 deletions src/appleMain/kotlin/xyz/gmitch215/tabroom/util/http.apple.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package xyz.gmitch215.tabroom.util

import io.ktor.client.engine.*
import io.ktor.client.engine.darwin.*
import kotlinx.coroutines.Dispatchers

actual val engine: HttpClientEngine = Darwin.create {
pipelining = true
dispatcher = Dispatchers.Default

configureRequest {
setAllowsCellularAccess(true)
}

configureSession {
setAllowsCellularAccess(true)
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
package xyz.gmitch215.tabroom.util

import io.ktor.client.engine.*
import io.ktor.client.engine.cio.*
import io.ktor.client.engine.curl.*
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.IO

internal actual val engine: HttpClientEngine = CIO.create {
internal actual val engine: HttpClientEngine = Curl.create {
pipelining = true
dispatcher = Dispatchers.IO.limitedParallelism(PARALLEL_COUNT)

endpoint {
connectTimeout = 10000
requestTimeout = 10000
}
}

0 comments on commit 7506f60

Please sign in to comment.