diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 3ee9f18d2..c97a924ba 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,7 +7,7 @@ and this project orients towards [Semantic Versioning](http://semver.org/spec/v2 Note: This project needs KSP to work and every new Ktorfit with an update of the KSP version is technically a breaking change. But there is no intent to bump the Ktorfit major version for every KSP update. -2.0.0 - 2024-XX-XX +2.0.0 - 2024-05-27 ======================================== ### Changed - Build with KSP 1.0.21, Kotlin 2.0.0, Ktor 2.3.11 diff --git a/docs/index.md b/docs/index.md index 1543ccec4..38a6f8b17 100644 --- a/docs/index.md +++ b/docs/index.md @@ -15,18 +15,15 @@ inspired by [Retrofit](https://square.github.io/retrofit/) ## Compatibility -| Ktorfit-version | Kotlin | KSP | Ktor | -|-------------------|:-------------:|:----------:|:----------:| -| **_2.0.0** | **2.0.0** | **1.0.20** | **2.3.11** | -| **_2.0.0-rc01_** | **2.0.0-RC3** | **1.0.20** | **2.3.11** | -| **_2.0.0-beta1_** | **2.0.0-RC1** | **1.0.20** | **2.3.10** | -| **_1.14.0_** | **2.0.0-RC1** | **1.0.20** | **2.3.10** | -| **_1.13.0_** | **1.9.23** | **1.0.20** | **2.3.10** | -| **_1.12.0_** | **1.9.22** | **1.0.16** | **2.3.6** | -| **_1.11.0_** | **1.9.21** | **1.0.15** | **2.3.6** | -| **_1.10.2_** | **1.9.20** | **1.0.14** | **2.3.6** | -| **_1.10.1_** | **1.9.20** | **1.0.14** | **2.3.4** | -| **_1.10.0_** | **1.9.20** | **1.0.14** | **2.3.4** | +| Ktorfit-version | Kotlin | KSP | Ktor | +|-------------------|:-------------:|:------------:|:----------:| +| **_2.0.0** | **>=2.0.0** | **>=1.0.21** | **2.3.11** | +| **_2.0.0-rc01_** | **2.0.0-RC3** | **1.0.20** | **2.3.11** | +| **_2.0.0-beta1_** | **2.0.0-RC1** | **1.0.20** | **2.3.10** | +| **_1.14.0_** | **2.0.0-RC1** | **1.0.20** | **2.3.10** | +| **_1.13.0_** | **1.9.23** | **1.0.20** | **2.3.10** | +| **_1.12.0_** | **1.9.22** | **1.0.16** | **2.3.6** | + # Installation diff --git a/example/AndroidOnlyExample/app/build.gradle.kts b/example/AndroidOnlyExample/app/build.gradle.kts index 304b45175..adf3e060d 100644 --- a/example/AndroidOnlyExample/app/build.gradle.kts +++ b/example/AndroidOnlyExample/app/build.gradle.kts @@ -1,9 +1,11 @@ plugins { id("com.android.application") id("org.jetbrains.kotlin.android") - id("com.google.devtools.ksp") version "1.9.23-1.0.20" - id("org.jetbrains.kotlin.plugin.serialization") version "1.9.23" - id("de.jensklingenberg.ktorfit") version "2.0.0-beta2-SNAPSHOT" + id("com.google.devtools.ksp") version "2.0.0-1.0.21" + id("org.jetbrains.kotlin.plugin.serialization") version "2.0.0" + id("de.jensklingenberg.ktorfit") version "2.0.0" + id("org.jetbrains.kotlin.plugin.compose") version "2.0.0" + } @@ -40,9 +42,6 @@ android { buildFeatures { compose = (true) } - composeOptions { - kotlinCompilerExtensionVersion = "1.5.11" - } } tasks.withType().configureEach { @@ -51,11 +50,10 @@ tasks.withType().configureEach } } -val ktorfit = "2.0.0-beta2-SNAPSHOT" +val ktorfit = "2.0.0" val ktor = "2.3.10" val compose_ui_version = "1.5.1" dependencies { - ksp("de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfit") implementation("de.jensklingenberg.ktorfit:ktorfit-lib:$ktorfit") implementation("io.ktor:ktor-client-serialization:$ktor") implementation("io.ktor:ktor-client-content-negotiation:$ktor") diff --git a/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt b/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt index beff01dc0..685c328af 100644 --- a/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt +++ b/example/AndroidOnlyExample/app/src/main/java/de/jensklingenberg/androidonlyexample/MainActivity.kt @@ -35,6 +35,7 @@ val ktorfit = ktorfit { ) } +val api = ktorfit.createStarWarsApi() class MainActivity : ComponentActivity() { @@ -57,8 +58,9 @@ class MainActivity : ComponentActivity() { } } + lifecycleScope.launch { - peopleState.value = ktorfit.create().getPerson(1) + peopleState.value = api.getPerson(1) } } } \ No newline at end of file diff --git a/example/AndroidOnlyExample/build.gradle b/example/AndroidOnlyExample/build.gradle index e2e73a856..79d216f34 100644 --- a/example/AndroidOnlyExample/build.gradle +++ b/example/AndroidOnlyExample/build.gradle @@ -2,5 +2,5 @@ plugins { id 'com.android.application' version '8.0.2' apply false id 'com.android.library' version '8.0.2' apply false - id 'org.jetbrains.kotlin.android' version '1.9.23' apply false + id 'org.jetbrains.kotlin.android' version '2.0.0' apply false } \ No newline at end of file diff --git a/example/MultiplatformExample/shared/build.gradle.kts b/example/MultiplatformExample/shared/build.gradle.kts index 8221ddaaa..33170614a 100644 --- a/example/MultiplatformExample/shared/build.gradle.kts +++ b/example/MultiplatformExample/shared/build.gradle.kts @@ -6,13 +6,17 @@ plugins { id("com.android.library") id("com.google.devtools.ksp") version "2.0.0-1.0.21" id("kotlinx-serialization") - id("de.jensklingenberg.ktorfit") version "2.0.0-SNAPSHOT" + id("de.jensklingenberg.ktorfit") version "2.0.0" } +ktorfit { + errorCheckingMode = ErrorCheckingMode.WARNING + generateQualifiedTypeName = false +} version = "1.0" val ktorVersion = "2.3.10" -val ktorfitVersion = "2.0.0-beta2-SNAPSHOT" +val ktorfitVersion = "2.0.0" kotlin { jvmToolchain(8) @@ -76,25 +80,6 @@ android { } } -dependencies { - with("de.jensklingenberg.ktorfit:ktorfit-ksp:$ktorfitVersion") { - add("kspCommonMainMetadata", this) - add("kspJvm", this) - add("kspJvmTest", this) - add("kspAndroid", this) - add("kspAndroidTest", this) - add("kspIosX64", this) - add("kspIosX64Test", this) - add("kspIosArm64", this) - add("kspIosArm64Test", this) - add("kspIosSimulatorArm64", this) - add("kspIosSimulatorArm64Test", this) - add("kspMacosX64", this) - add("kspMacosX64Test", this) - add("kspJs", this) - add("kspJsTest", this) - } -} tasks.withType { kotlinOptions { diff --git a/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt b/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt index 799cc6413..b255e8c01 100644 --- a/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt +++ b/example/MultiplatformExample/shared/src/commonMain/kotlin/com/example/ktorfittest/Greeting.kt @@ -4,9 +4,9 @@ package com.example.ktorfittest import de.jensklingenberg.ktorfit.converter.CallConverterFactory import de.jensklingenberg.ktorfit.converter.FlowConverterFactory import de.jensklingenberg.ktorfit.ktorfit -import io.ktor.client.HttpClient -import io.ktor.client.plugins.contentnegotiation.ContentNegotiation -import io.ktor.serialization.kotlinx.json.json +import io.ktor.client.* +import io.ktor.client.plugins.contentnegotiation.* +import io.ktor.serialization.kotlinx.json.* import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch @@ -26,7 +26,7 @@ val ktorfit = ktorfit { } -val starWarsApi = ktorfit.create() +val starWarsApi = ktorfit.createStarWarsApi() class Greeting { fun greeting(): String { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 19a7cdba9..0a07a4779 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -10,13 +10,13 @@ kotlin = "2.0.0" kotlinPoet = "1.16.0" kspVersion = "2.0.0-1.0.21" -ktorfit = "2.0.0-rc01" +ktorfit = "2.0.0" ktorfitKsp = "2.0.0-1.0.21" ktorfitCompiler = "2.0.0-2.0.0" -ktorfitCallConverter = "2.0.0-rc01" -ktorfitFlowConverter = "2.0.0-rc01" -ktorfitResponseConverter = "2.0.0-rc01" -ktorfitGradle = "2.0.0-SNAPSHOT" +ktorfitCallConverter = "2.0.0" +ktorfitFlowConverter = "2.0.0" +ktorfitResponseConverter = "2.0.0" +ktorfitGradle = "2.0.0" ktorfitGradlePlugin = "1.14.0" ktorVersion = "2.3.11" diff --git a/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt b/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt index 06204abcf..b78e9a596 100644 --- a/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt +++ b/ktorfit-gradle-plugin/src/main/java/de/jensklingenberg/ktorfit/gradle/KtorfitGradlePlugin.kt @@ -3,9 +3,7 @@ package de.jensklingenberg.ktorfit.gradle import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.findByType import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension -import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinSingleTargetExtension import org.jetbrains.kotlin.gradle.dsl.kotlinExtension import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask @@ -18,7 +16,7 @@ class KtorfitGradlePlugin : Plugin { const val ARTIFACT_NAME = "compiler-plugin" const val COMPILER_PLUGIN_ID = "ktorfitPlugin" const val KTORFIT_VERSION = "2.0.0" // remember to bump this version before any release! - const val SNAPSHOT = "-SNAPSHOT" + const val SNAPSHOT = "" const val MIN_KSP_VERSION = "1.0.21" const val MIN_KOTLIN_VERSION = "2.0.0" } @@ -79,6 +77,16 @@ class KtorfitGradlePlugin : Plugin { } }", dependency ) + + dependencies.add( + "ksp${ + targetName.replaceFirstChar { + if (it.isLowerCase()) it.titlecase( + US + ) else it.toString() + } + }Test", dependency + ) } kotlinExtension.sourceSets.named("commonMain").configure { @@ -108,8 +116,5 @@ class KtorfitGradlePlugin : Plugin { } -private val Project.kotlinExtension: KotlinProjectExtension? - get() = this.extensions.findByType() - internal fun Project.getKtorfitConfig() = this.extensions.findByType(KtorfitGradleConfiguration::class.java) ?: KtorfitGradleConfiguration() \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 80352b379..e740007e9 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -13,7 +13,7 @@ extra: site: images: '../../images' ktorfit: - release: "2.0.0-rc01" + release: "2.0.0" ktor: release: "2.3.11" social: