From faa73ea1cd84a8d1becf9d4d476ec063ef19924a Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Mon, 12 Aug 2024 22:27:47 +0200 Subject: [PATCH 1/9] Update Kotlin 2.0.20-RC --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a3676bfcf..01899cf72 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,14 +6,14 @@ coroutines = "1.8.1" detekt = "1.23.6" junit = "4.13.2" kctfork = "0.4.1" -kotlin = "2.0.10" +kotlin = "2.0.20-RC" kotlinPoet = "1.18.1" -kspVersion = "2.0.10-1.0.24" +kspVersion = "2.0.20-RC-1.0.24" groupId = "de.jensklingenberg.ktorfit" ktorfit = "2.0.1" ktorfitKsp = "2.0.1-1.0.24" -ktorfitCompiler = "2.0.1-2.0.10" +ktorfitCompiler = "2.0.1-2.0.20-RC" ktorfitCallConverter = "2.0.1" ktorfitFlowConverter = "2.0.1" ktorfitResponseConverter = "2.0.1" From 8cce4e6fc67d2fd392e5aef9f87756abe8c5d813 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Tue, 13 Aug 2024 21:11:12 +0200 Subject: [PATCH 2/9] Update Kotlin 2.0.20-RC --- example/MultiplatformExample/build.gradle.kts | 6 ++--- .../shared/build.gradle.kts | 14 +++++------ gradle/libs.versions.toml | 2 +- .../ktorfit/CreateFuncTransformer.kt | 23 ++++++++++++++----- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/example/MultiplatformExample/build.gradle.kts b/example/MultiplatformExample/build.gradle.kts index f071dc823..917caeff7 100644 --- a/example/MultiplatformExample/build.gradle.kts +++ b/example/MultiplatformExample/build.gradle.kts @@ -1,6 +1,6 @@ buildscript { repositories { - //mavenLocal() + // mavenLocal() gradlePluginPortal() google() mavenCentral() @@ -9,7 +9,7 @@ buildscript { } } dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20-RC") classpath("com.android.tools.build:gradle:7.3.1") classpath("org.jetbrains.kotlin:kotlin-serialization:2.0.0") } @@ -17,7 +17,7 @@ buildscript { allprojects { repositories { - //mavenLocal() + // mavenLocal() google() mavenCentral() maven { diff --git a/example/MultiplatformExample/shared/build.gradle.kts b/example/MultiplatformExample/shared/build.gradle.kts index 2d8550ed0..45d7e0df2 100644 --- a/example/MultiplatformExample/shared/build.gradle.kts +++ b/example/MultiplatformExample/shared/build.gradle.kts @@ -4,9 +4,9 @@ plugins { kotlin("multiplatform") kotlin("native.cocoapods") id("com.android.library") - id("com.google.devtools.ksp") version "2.0.0-1.0.22" + id("com.google.devtools.ksp") version "2.0.20-RC-1.0.24" id("kotlinx-serialization") - id("de.jensklingenberg.ktorfit") version "2.0.0" + id("de.jensklingenberg.ktorfit") version "2.0.1" } ktorfit { @@ -16,7 +16,7 @@ ktorfit { version = "1.0" val ktorVersion = "2.3.11" -val ktorfitVersion = "2.0.0" +val ktorfitVersion = "2.0.1" kotlin { jvmToolchain(8) @@ -46,13 +46,13 @@ kotlin { val commonMain by getting { dependencies { implementation("de.jensklingenberg.ktorfit:ktorfit-lib:$ktorfitVersion") - //implementation("de.jensklingenberg.ktorfit:ktorfit-lib-light:$ktorfitVersion") + // implementation("de.jensklingenberg.ktorfit:ktorfit-lib-light:$ktorfitVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-response:$ktorfitVersion") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-call:$ktorfitVersion") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-flow:$ktorfitVersion") - //Only needed when you want to use Kotlin Serialization + // Only needed when you want to use Kotlin Serialization implementation("io.ktor:ktor-client-serialization:$ktorVersion") implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion") implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion") @@ -82,10 +82,8 @@ android { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } - } - tasks.withType { kotlinOptions { jvmTarget = "1.8" @@ -99,4 +97,4 @@ allprojects { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } } -} \ No newline at end of file +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 01899cf72..00083aa34 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ binaryCompatibilityValidator = "0.14.0" coroutines = "1.8.1" detekt = "1.23.6" junit = "4.13.2" -kctfork = "0.4.1" +kctfork = "0.5.1" kotlin = "2.0.20-RC" kotlinPoet = "1.18.1" kspVersion = "2.0.20-RC-1.0.24" diff --git a/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt b/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt index 0d0ed6aed..5f2f4764a 100644 --- a/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt +++ b/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt @@ -2,15 +2,17 @@ package de.jensklingenberg.ktorfit import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.defaultType -import org.jetbrains.kotlin.ir.types.impl.originalKotlinType import org.jetbrains.kotlin.ir.util.constructors +import org.jetbrains.kotlin.ir.util.dumpKotlinLike import org.jetbrains.kotlin.ir.util.isInterface +import org.jetbrains.kotlin.js.descriptorUtils.getKotlinTypeFqName import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -42,10 +44,15 @@ internal class CreateFuncTransformer( // Find exampleKtorfit.create() (expression as? IrCall)?.let { irCall -> if (irCall.typeArgumentsCount > 0) { - if (!expression.symbol.owner.symbol.toString().contains(KTORFIT_PACKAGE)) { + if (!expression.symbol.owner.symbol + .toString() + .contains(KTORFIT_PACKAGE) + ) { return expression } - if (expression.symbol.owner.name.asString() != KTORFIT_CREATE) { + if (expression.symbol.owner.name + .asString() != KTORFIT_CREATE + ) { return expression } @@ -59,12 +66,14 @@ internal class CreateFuncTransformer( if (!argumentType.isInterface()) { throw IllegalStateException( - errorTypeArgumentNotInterface(argumentType.originalKotlinType.toString()), + errorTypeArgumentNotInterface(argumentType.dumpKotlinLike()), ) } if (classFqName == null) { - throw IllegalStateException(errorClassNotFound(argumentType.originalKotlinType.toString())) + throw IllegalStateException( + errorClassNotFound(argumentType.toIrBasedKotlinType().getKotlinTypeFqName(false)) + ) } val packageName = classFqName.packageName @@ -98,7 +107,9 @@ internal class CreateFuncTransformer( // Set _ExampleApiProvider() as argument for create() irCall.putValueArgument(0, newCall) debugLogger.log( - "Transformed " + argumentType.originalKotlinType.toString() + " to _$className" + "Provider", + "Transformed " + argumentType.toIrBasedKotlinType().getKotlinTypeFqName(false).substringAfterLast(".") + + " to _$className" + + "Provider", ) return super.visitExpression(irCall) } From 80d4cfd45b2019e84c267a886c2bb7633600419d Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Tue, 13 Aug 2024 21:30:13 +0200 Subject: [PATCH 3/9] Fix test --- .../ktorfit/ReqBuilderAnnotationsTest.kt | 26 +++---------------- .../de/jensklingenberg/ktorfit/Utils.kt | 6 +++-- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt index a9226cd96..e916cb696 100644 --- a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt +++ b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt @@ -2,9 +2,7 @@ package de.jensklingenberg.ktorfit import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile -import com.tschuchort.compiletesting.kspIncremental import com.tschuchort.compiletesting.kspSourcesDir -import com.tschuchort.compiletesting.symbolProcessorProviders import de.jensklingenberg.ktorfit.model.KtorfitError import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse @@ -79,13 +77,7 @@ interface TestService { val expectedRequestBuilderArgumentText = "builder(this)" - val compilation = - KotlinCompilation().apply { - sources = listOf(httpReqBuilderSource, source) - inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) - kspIncremental = true - } + val compilation = getCompilation(listOf(httpReqBuilderSource, source)) val result = compilation.compile() assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode) @@ -120,13 +112,7 @@ interface TestService { """, ) - val compilation = - KotlinCompilation().apply { - sources = listOf(httpReqBuilderSource, source) - inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) - kspIncremental = true - } + val compilation = getCompilation(listOf(httpReqBuilderSource, source)) val result = compilation.compile() assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode) @@ -153,13 +139,7 @@ interface TestService { """, ) - val compilation = - KotlinCompilation().apply { - sources = listOf(httpReqBuilderSource, source) - inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) - kspIncremental = true - } + val compilation = getCompilation(listOf(httpReqBuilderSource, source)) val result = compilation.compile() assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode) diff --git a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt index 5d339e688..4e6848c6b 100644 --- a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt +++ b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt @@ -4,6 +4,7 @@ import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.kspArgs import com.tschuchort.compiletesting.kspIncremental +import com.tschuchort.compiletesting.kspProcessorOptions import com.tschuchort.compiletesting.symbolProcessorProviders import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi @@ -13,9 +14,10 @@ fun getCompilation( kspArgs: MutableMap = mutableMapOf(), ): KotlinCompilation = KotlinCompilation().apply { + languageVersion = "1.9" this.sources = sources inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) + symbolProcessorProviders = mutableListOf(KtorfitProcessorProvider()) kspIncremental = true - this.kspArgs = kspArgs + this.kspProcessorOptions = kspArgs } From cbfb4cf311c437db182c995343cca4dbe368c4bb Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Mon, 12 Aug 2024 22:27:47 +0200 Subject: [PATCH 4/9] Update Kotlin 2.0.20-RC --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5aa556d14..93b29fbf0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,14 +6,14 @@ coroutines = "1.8.1" detekt = "1.23.6" junit = "4.13.2" kctfork = "0.4.1" -kotlin = "2.0.10" +kotlin = "2.0.20-RC" kotlinPoet = "1.18.1" -kspVersion = "2.0.10-1.0.24" +kspVersion = "2.0.20-RC-1.0.24" groupId = "de.jensklingenberg.ktorfit" ktorfit = "2.0.1" ktorfitKsp = "2.0.1-1.0.24" -ktorfitCompiler = "2.0.1-2.0.10" +ktorfitCompiler = "2.0.1-2.0.20-RC" ktorfitCallConverter = "2.0.1" ktorfitFlowConverter = "2.0.1" ktorfitResponseConverter = "2.0.1" From c6ed07af1ba74e086a4e8f6e9f136d6611646b8c Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Tue, 13 Aug 2024 21:11:12 +0200 Subject: [PATCH 5/9] Update Kotlin 2.0.20-RC --- example/MultiplatformExample/build.gradle.kts | 6 ++--- .../shared/build.gradle.kts | 14 +++++------ gradle/libs.versions.toml | 2 +- .../ktorfit/CreateFuncTransformer.kt | 23 ++++++++++++++----- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/example/MultiplatformExample/build.gradle.kts b/example/MultiplatformExample/build.gradle.kts index f071dc823..917caeff7 100644 --- a/example/MultiplatformExample/build.gradle.kts +++ b/example/MultiplatformExample/build.gradle.kts @@ -1,6 +1,6 @@ buildscript { repositories { - //mavenLocal() + // mavenLocal() gradlePluginPortal() google() mavenCentral() @@ -9,7 +9,7 @@ buildscript { } } dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.0") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20-RC") classpath("com.android.tools.build:gradle:7.3.1") classpath("org.jetbrains.kotlin:kotlin-serialization:2.0.0") } @@ -17,7 +17,7 @@ buildscript { allprojects { repositories { - //mavenLocal() + // mavenLocal() google() mavenCentral() maven { diff --git a/example/MultiplatformExample/shared/build.gradle.kts b/example/MultiplatformExample/shared/build.gradle.kts index 2d8550ed0..45d7e0df2 100644 --- a/example/MultiplatformExample/shared/build.gradle.kts +++ b/example/MultiplatformExample/shared/build.gradle.kts @@ -4,9 +4,9 @@ plugins { kotlin("multiplatform") kotlin("native.cocoapods") id("com.android.library") - id("com.google.devtools.ksp") version "2.0.0-1.0.22" + id("com.google.devtools.ksp") version "2.0.20-RC-1.0.24" id("kotlinx-serialization") - id("de.jensklingenberg.ktorfit") version "2.0.0" + id("de.jensklingenberg.ktorfit") version "2.0.1" } ktorfit { @@ -16,7 +16,7 @@ ktorfit { version = "1.0" val ktorVersion = "2.3.11" -val ktorfitVersion = "2.0.0" +val ktorfitVersion = "2.0.1" kotlin { jvmToolchain(8) @@ -46,13 +46,13 @@ kotlin { val commonMain by getting { dependencies { implementation("de.jensklingenberg.ktorfit:ktorfit-lib:$ktorfitVersion") - //implementation("de.jensklingenberg.ktorfit:ktorfit-lib-light:$ktorfitVersion") + // implementation("de.jensklingenberg.ktorfit:ktorfit-lib-light:$ktorfitVersion") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-response:$ktorfitVersion") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-call:$ktorfitVersion") implementation("de.jensklingenberg.ktorfit:ktorfit-converters-flow:$ktorfitVersion") - //Only needed when you want to use Kotlin Serialization + // Only needed when you want to use Kotlin Serialization implementation("io.ktor:ktor-client-serialization:$ktorVersion") implementation("io.ktor:ktor-client-content-negotiation:$ktorVersion") implementation("io.ktor:ktor-serialization-kotlinx-json:$ktorVersion") @@ -82,10 +82,8 @@ android { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } - } - tasks.withType { kotlinOptions { jvmTarget = "1.8" @@ -99,4 +97,4 @@ allprojects { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } } -} \ No newline at end of file +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 93b29fbf0..a0b0e77f0 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ binaryCompatibilityValidator = "0.14.0" coroutines = "1.8.1" detekt = "1.23.6" junit = "4.13.2" -kctfork = "0.4.1" +kctfork = "0.5.1" kotlin = "2.0.20-RC" kotlinPoet = "1.18.1" kspVersion = "2.0.20-RC-1.0.24" diff --git a/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt b/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt index 0d0ed6aed..5f2f4764a 100644 --- a/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt +++ b/ktorfit-compiler-plugin/src/main/java/de/jensklingenberg/ktorfit/CreateFuncTransformer.kt @@ -2,15 +2,17 @@ package de.jensklingenberg.ktorfit import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.UnsafeDuringIrConstructionAPI import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.defaultType -import org.jetbrains.kotlin.ir.types.impl.originalKotlinType import org.jetbrains.kotlin.ir.util.constructors +import org.jetbrains.kotlin.ir.util.dumpKotlinLike import org.jetbrains.kotlin.ir.util.isInterface +import org.jetbrains.kotlin.js.descriptorUtils.getKotlinTypeFqName import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name @@ -42,10 +44,15 @@ internal class CreateFuncTransformer( // Find exampleKtorfit.create() (expression as? IrCall)?.let { irCall -> if (irCall.typeArgumentsCount > 0) { - if (!expression.symbol.owner.symbol.toString().contains(KTORFIT_PACKAGE)) { + if (!expression.symbol.owner.symbol + .toString() + .contains(KTORFIT_PACKAGE) + ) { return expression } - if (expression.symbol.owner.name.asString() != KTORFIT_CREATE) { + if (expression.symbol.owner.name + .asString() != KTORFIT_CREATE + ) { return expression } @@ -59,12 +66,14 @@ internal class CreateFuncTransformer( if (!argumentType.isInterface()) { throw IllegalStateException( - errorTypeArgumentNotInterface(argumentType.originalKotlinType.toString()), + errorTypeArgumentNotInterface(argumentType.dumpKotlinLike()), ) } if (classFqName == null) { - throw IllegalStateException(errorClassNotFound(argumentType.originalKotlinType.toString())) + throw IllegalStateException( + errorClassNotFound(argumentType.toIrBasedKotlinType().getKotlinTypeFqName(false)) + ) } val packageName = classFqName.packageName @@ -98,7 +107,9 @@ internal class CreateFuncTransformer( // Set _ExampleApiProvider() as argument for create() irCall.putValueArgument(0, newCall) debugLogger.log( - "Transformed " + argumentType.originalKotlinType.toString() + " to _$className" + "Provider", + "Transformed " + argumentType.toIrBasedKotlinType().getKotlinTypeFqName(false).substringAfterLast(".") + + " to _$className" + + "Provider", ) return super.visitExpression(irCall) } From 88d52e6037a5a03b688ac1e0bdde8d17f84c9e81 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Tue, 13 Aug 2024 21:30:13 +0200 Subject: [PATCH 6/9] Fix test --- .../ktorfit/ReqBuilderAnnotationsTest.kt | 26 +++---------------- .../de/jensklingenberg/ktorfit/Utils.kt | 6 +++-- 2 files changed, 7 insertions(+), 25 deletions(-) diff --git a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt index a9226cd96..e916cb696 100644 --- a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt +++ b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/ReqBuilderAnnotationsTest.kt @@ -2,9 +2,7 @@ package de.jensklingenberg.ktorfit import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile -import com.tschuchort.compiletesting.kspIncremental import com.tschuchort.compiletesting.kspSourcesDir -import com.tschuchort.compiletesting.symbolProcessorProviders import de.jensklingenberg.ktorfit.model.KtorfitError import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse @@ -79,13 +77,7 @@ interface TestService { val expectedRequestBuilderArgumentText = "builder(this)" - val compilation = - KotlinCompilation().apply { - sources = listOf(httpReqBuilderSource, source) - inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) - kspIncremental = true - } + val compilation = getCompilation(listOf(httpReqBuilderSource, source)) val result = compilation.compile() assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode) @@ -120,13 +112,7 @@ interface TestService { """, ) - val compilation = - KotlinCompilation().apply { - sources = listOf(httpReqBuilderSource, source) - inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) - kspIncremental = true - } + val compilation = getCompilation(listOf(httpReqBuilderSource, source)) val result = compilation.compile() assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode) @@ -153,13 +139,7 @@ interface TestService { """, ) - val compilation = - KotlinCompilation().apply { - sources = listOf(httpReqBuilderSource, source) - inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) - kspIncremental = true - } + val compilation = getCompilation(listOf(httpReqBuilderSource, source)) val result = compilation.compile() assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode) diff --git a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt index 5d339e688..4e6848c6b 100644 --- a/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt +++ b/ktorfit-ksp/src/test/kotlin/de/jensklingenberg/ktorfit/Utils.kt @@ -4,6 +4,7 @@ import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import com.tschuchort.compiletesting.kspArgs import com.tschuchort.compiletesting.kspIncremental +import com.tschuchort.compiletesting.kspProcessorOptions import com.tschuchort.compiletesting.symbolProcessorProviders import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi @@ -13,9 +14,10 @@ fun getCompilation( kspArgs: MutableMap = mutableMapOf(), ): KotlinCompilation = KotlinCompilation().apply { + languageVersion = "1.9" this.sources = sources inheritClassPath = true - symbolProcessorProviders = listOf(KtorfitProcessorProvider()) + symbolProcessorProviders = mutableListOf(KtorfitProcessorProvider()) kspIncremental = true - this.kspArgs = kspArgs + this.kspProcessorOptions = kspArgs } From 3e32884e9ed316dfc37ca9dc6f8446a65a9bbf30 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Tue, 13 Aug 2024 22:19:09 +0200 Subject: [PATCH 7/9] Update Kotlin 2.0.20-RC2 --- gradle/libs.versions.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a0b0e77f0..0b0c1224f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,14 +6,14 @@ coroutines = "1.8.1" detekt = "1.23.6" junit = "4.13.2" kctfork = "0.5.1" -kotlin = "2.0.20-RC" +kotlin = "2.0.20-RC2" kotlinPoet = "1.18.1" kspVersion = "2.0.20-RC-1.0.24" groupId = "de.jensklingenberg.ktorfit" ktorfit = "2.0.1" ktorfitKsp = "2.0.1-1.0.24" -ktorfitCompiler = "2.0.1-2.0.20-RC" +ktorfitCompiler = "2.0.1-2.0.20-RC2" ktorfitCallConverter = "2.0.1" ktorfitFlowConverter = "2.0.1" ktorfitResponseConverter = "2.0.1" From ae065045562833366bfba8738ba8b01a23230949 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Fri, 23 Aug 2024 17:32:45 +0200 Subject: [PATCH 8/9] Update to Kotlin 2.0.20 --- docs/CHANGELOG.md | 1 + docs/development.md | 10 +++++++++- gradle/libs.versions.toml | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 676efe355..e2886d9cd 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -20,6 +20,7 @@ But there is no intent to bump the Ktorfit major version for every KSP update. ### compilerPlugin - Kotlin 2.0.0: 2.0.1-2.0.0 - 2024-08-08 - Kotlin 2.0.10: 2.0.1-2.0.10 - 2024-08-10 +- Kotlin 2.0.20: 2.0.1-2.0.20 - 2024-08-23 ### ktorfit-ksp - KSP 1.0.24: ktorfit-ksp-2.0.1-1.0.24 - 2024-08-08 diff --git a/docs/development.md b/docs/development.md index 90c64e52f..70fe44ec0 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1 +1,9 @@ -# Development \ No newline at end of file +# Development + +# Update Ktorfit for new Kotlin version +- Bump **kotlin** in libs.versions +- Change **ktorfitCompiler** in libs.versions to KTORFIT_VERSION-NEW_KOTLIN_VERSION +- Run tests in :ktorfit-compiler-plugin +- Create a PR against master +- Merge PR +- Run GitHub Actions "publish" workflow \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0b0c1224f..cbda8a502 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,14 +6,14 @@ coroutines = "1.8.1" detekt = "1.23.6" junit = "4.13.2" kctfork = "0.5.1" -kotlin = "2.0.20-RC2" +kotlin = "2.0.20" kotlinPoet = "1.18.1" -kspVersion = "2.0.20-RC-1.0.24" +kspVersion = "2.0.20-1.0.24" groupId = "de.jensklingenberg.ktorfit" ktorfit = "2.0.1" ktorfitKsp = "2.0.1-1.0.24" -ktorfitCompiler = "2.0.1-2.0.20-RC2" +ktorfitCompiler = "2.0.1-2.0.20" ktorfitCallConverter = "2.0.1" ktorfitFlowConverter = "2.0.1" ktorfitResponseConverter = "2.0.1" From 4e98097cc817e06df5ef75e85244603692d5e132 Mon Sep 17 00:00:00 2001 From: Jens Klingenberg Date: Fri, 23 Aug 2024 17:36:42 +0200 Subject: [PATCH 9/9] Update to Kotlin 2.0.20 --- example/MultiplatformExample/build.gradle.kts | 2 +- example/MultiplatformExample/shared/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/MultiplatformExample/build.gradle.kts b/example/MultiplatformExample/build.gradle.kts index 917caeff7..46058a423 100644 --- a/example/MultiplatformExample/build.gradle.kts +++ b/example/MultiplatformExample/build.gradle.kts @@ -9,7 +9,7 @@ buildscript { } } dependencies { - classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20-RC") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.0.20") classpath("com.android.tools.build:gradle:7.3.1") classpath("org.jetbrains.kotlin:kotlin-serialization:2.0.0") } diff --git a/example/MultiplatformExample/shared/build.gradle.kts b/example/MultiplatformExample/shared/build.gradle.kts index 45d7e0df2..c36a5f5e7 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.20-RC-1.0.24" + id("com.google.devtools.ksp") version "2.0.20-1.0.24" id("kotlinx-serialization") id("de.jensklingenberg.ktorfit") version "2.0.1" }