From fdcbbe18682cf95452ffd7a3d33ba676cd2a55ca Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Sun, 10 Nov 2024 21:51:46 +0100 Subject: [PATCH 1/2] Add missing client dependencies #720 --- .../AndroidOnlyExample/app/build.gradle.kts | 10 +++--- .../shared/build.gradle.kts | 4 +-- gradle/libs.versions.toml | 2 +- ktorfit-lib/build.gradle.kts | 32 +++++++------------ 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/example/AndroidOnlyExample/app/build.gradle.kts b/example/AndroidOnlyExample/app/build.gradle.kts index 7b2ad76e6..54ba93225 100644 --- a/example/AndroidOnlyExample/app/build.gradle.kts +++ b/example/AndroidOnlyExample/app/build.gradle.kts @@ -1,9 +1,9 @@ plugins { id("com.android.application") id("org.jetbrains.kotlin.android") - id("com.google.devtools.ksp") version "2.0.20-1.0.24" + id("com.google.devtools.ksp") version "2.0.21-1.0.27" id("org.jetbrains.kotlin.plugin.serialization") version "2.0.21" - id("de.jensklingenberg.ktorfit") version "2.0.1" + id("de.jensklingenberg.ktorfit") version "2.1.0" id("org.jetbrains.kotlin.plugin.compose") version "2.0.21" } @@ -52,8 +52,8 @@ tasks.withType().configureEach } } -val ktorfit = "2.0.0" -val ktor = "2.3.11" +val ktorfit = "2.1.0" +val ktor = "3.0.1" val compose_ui_version = "1.7.4" dependencies { implementation("de.jensklingenberg.ktorfit:ktorfit-lib:$ktorfit") @@ -63,8 +63,6 @@ dependencies { implementation("de.jensklingenberg.ktorfit:ktorfit-converters-response:$ktorfit") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-call:$ktorfit") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-flow:$ktorfit") - - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6") implementation("androidx.activity:activity-compose:1.9.3") implementation("androidx.compose.ui:ui:$compose_ui_version") diff --git a/example/MultiplatformExample/shared/build.gradle.kts b/example/MultiplatformExample/shared/build.gradle.kts index 7a7e897ee..cce0a06f1 100644 --- a/example/MultiplatformExample/shared/build.gradle.kts +++ b/example/MultiplatformExample/shared/build.gradle.kts @@ -4,7 +4,7 @@ plugins { kotlin("multiplatform") kotlin("native.cocoapods") id("com.android.library") - id("com.google.devtools.ksp") version "2.0.21-1.0.25" + id("com.google.devtools.ksp") version "2.0.21-1.0.27" id("kotlinx-serialization") id("de.jensklingenberg.ktorfit") version "2.1.0" } @@ -15,7 +15,7 @@ ktorfit { } version = "1.0" -val ktorVersion = "2.3.11" +val ktorVersion = "3.0.1" val ktorfitVersion = "2.1.0" kotlin { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a53c5e9a7..ee4f87776 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -60,7 +60,7 @@ ktor-client-core-mingwx64 = { module = "io.ktor:ktor-client-core-mingwx64", vers ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktorVersion" } ktor-client-ios = { module = "io.ktor:ktor-client-ios", version.ref = "ktorVersion" } ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktorVersion" } - +ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktorVersion" } ktor-client-json-js = { module = "io.ktor:ktor-client-json-js", version.ref = "ktorVersion" } ktor-client-logging = { module = "io.ktor:ktor-client-logging", version.ref = "ktorVersion" } ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktorVersion" } diff --git a/ktorfit-lib/build.gradle.kts b/ktorfit-lib/build.gradle.kts index 19262c00d..f822f6e8a 100644 --- a/ktorfit-lib/build.gradle.kts +++ b/ktorfit-lib/build.gradle.kts @@ -1,4 +1,4 @@ -import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { kotlin("multiplatform") @@ -18,16 +18,7 @@ licensee { val enableSigning = project.hasProperty("signingInMemoryKey") mavenPublishing { - val artifactId = - "ktorfit-lib" + - if (libs.versions.ktorVersion - .get() - .startsWith("3.") - ) { - "-ktor-" + libs.versions.ktorVersion.get() - } else { - "" - } + val artifactId = "ktorfit-lib" coordinates( libs.versions.groupId.get(), artifactId, @@ -40,19 +31,14 @@ mavenPublishing { } } -tasks.withType { +tasks.withType { kotlinOptions.jvmTarget = "1.8" } kotlin { explicitApi() - if (libs.versions.ktorVersion - .get() - .startsWith("3.") - ) { - @OptIn(ExperimentalWasmDsl::class) - wasmJs() - } + @OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class) + wasmJs() jvm { } js(IR) { @@ -129,7 +115,7 @@ kotlin { } val androidMain by getting { dependencies { - implementation(libs.ktor.client.cio.jvm) + implementation(libs.ktor.client.okhttp) } } val jvmMain by getting { @@ -147,7 +133,11 @@ kotlin { } } - val iosMain by getting + val iosMain by getting { + dependencies { + implementation(libs.ktor.client.ios) + } + } } } val javadocJar by tasks.registering(Jar::class) { From 559533c199d0dd31a69749d322153e823326f14b Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Sun, 10 Nov 2024 21:55:11 +0100 Subject: [PATCH 2/2] Add missing client dependencies #720 --- docs/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 348c0485c..28bd8766a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -25,6 +25,7 @@ OptIn annotations on interfaces and functions will now be propagated to the gene - Fixed documentation for converters to match the current version. - Unresolved reference setBody in generated API implementations [#726](https://github.com/Foso/Ktorfit/issues/726) +- [Android] App crashes if not using Ktor platform client [#720](https://github.com/Foso/Ktorfit/issues/720) # [2.1.0]()