Skip to content

Commit

Permalink
Update to Kotlin 2.1.10 (#763)
Browse files Browse the repository at this point in the history
  • Loading branch information
Foso authored Jan 27, 2025
2 parents 278765b + bdc1d6f commit 7b4f0e0
Show file tree
Hide file tree
Showing 27 changed files with 76 additions and 99 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ env:
GRADLE_OPTS: "-Dorg.gradle.jvmargs=-Xmx8g -Dorg.gradle.daemon=false -Dkotlin.incremental=false"

jobs:
lint_check:
name: Lint check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v4
- name: API check
run: ./gradlew ktLintCheck
api_check:
name: API check
runs-on: ubuntu-latest
Expand All @@ -33,7 +47,7 @@ jobs:
java-version: 21
- uses: gradle/actions/setup-gradle@v4
- name: API check
run: ./gradlew ktLintCheck apiCheck
run: ./gradlew apiCheck
build:
runs-on: macos-latest
steps:
Expand Down
10 changes: 5 additions & 5 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ binaryCompatibilityValidator = "0.16.3"
coroutines = "1.8.1"
detekt = "1.23.7"
junit = "4.13.2"
kctfork = "0.5.1"
kotlin = "2.0.21"
kctfork = "0.7.0"
kotlin = "2.1.10"
kotlinPoet = "1.18.1"
kspVersion = "2.0.21-1.0.28"
kspVersion = "2.1.10-RC2-1.0.29"

groupId = "de.jensklingenberg.ktorfit"
ktorfit = "2.2.0"
ktorfitKsp = "2.2.0-1.0.28"
ktorfitKsp = "2.2.0-1.0.29"
ktorfitCompiler = "2.1.0-2.0.21"
ktorfitCallConverter = "2.2.0"
ktorfitFlowConverter = "2.2.0"
ktorfitResponseConverter = "2.2.0"
ktorfitGradle = "2.2.0"

ktorfitGradlePlugin = "2.1.0"
ktorfitGradlePlugin = "2.2.0"
ktorVersion = "3.0.1"
mockk = "1.13.13"
mockito-kotlin = "4.1.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ internal class CreateFuncTransformer(
symbol = newConstructor,
0,
0,
0,
null,
)

// Set _ExampleApiProvider() as argument for create<ExampleApi>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ interface ClassProvider<T>

val result = compile(listOf(source2, source))

assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

assertTrue(result.messages.contains("_TestServiceProvider"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ import de.jensklingenberg.ktorfit.model.annotations.HttpMethod
import de.jensklingenberg.ktorfit.model.annotations.HttpMethodAnnotation
import de.jensklingenberg.ktorfit.model.annotations.Multipart
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Body
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Field
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.FieldMap
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Header
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.HeaderMap
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Body
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Path
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.RequestBuilder
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.RequestType
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Field
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Tag
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.FieldMap
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.Url
import de.jensklingenberg.ktorfit.model.annotations.ParameterAnnotation.RequestBuilder
import de.jensklingenberg.ktorfit.poetspec.findTypeName
import de.jensklingenberg.ktorfit.utils.anyInstance
import de.jensklingenberg.ktorfit.utils.getFormUrlEncodedAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ private fun propertySpec(property: KSPropertyDeclaration): PropertySpec {
*/
private fun TypeSpec.Builder.addKtorfitSuperInterface(superClasses: List<KSTypeReference>): TypeSpec.Builder {
(superClasses).forEach { superClassReference ->
val hasNoDelegationAnnotation = superClassReference.annotations.any { it.shortName.getShortName() == "NoDelegation" }
val hasNoDelegationAnnotation =
superClassReference.annotations.any { it.shortName.getShortName() == "NoDelegation" }

val superClassDeclaration = superClassReference.resolve().declaration
val superTypeClassName = superClassDeclaration.simpleName.asString()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package de.jensklingenberg.ktorfit

import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import com.tschuchort.compiletesting.kspSourcesDir
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
Expand Down Expand Up @@ -40,7 +38,7 @@ suspend fun test(@Header("testHeader") testParameterNonNullable: String?, @Heade

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -90,7 +90,7 @@ interface TestService {
val compilation = getCompilation(listOf(source))

val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CompilationErrorsTest {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode)

assertTrue(result.messages.contains(KtorfitError.JAVA_INTERFACES_ARE_NOT_SUPPORTED))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
Expand Down Expand Up @@ -96,7 +95,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -135,7 +134,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -174,7 +173,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -213,7 +212,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -251,7 +250,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -295,7 +294,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -330,7 +329,7 @@ interface TestService {
val compilation = getCompilation(listOf(source))

val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode)

assertTrue(result.messages.contains(KtorfitError.FIELD_MAP_PARAMETER_TYPE_MUST_BE_MAP))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import com.tschuchort.compiletesting.kspSourcesDir
import de.jensklingenberg.ktorfit.model.KtorfitError
import org.junit.Assert
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
Expand Down Expand Up @@ -85,7 +84,6 @@ suspend fun test(@Field("id") id: String): String?

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
Assert.assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package de.jensklingenberg.ktorfit

import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import com.tschuchort.compiletesting.kspSourcesDir
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
Expand Down Expand Up @@ -41,7 +39,7 @@ suspend fun test(): List<Triple<String,Int?,String>>

val compilation = getCompilation(listOf(source2, source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -76,7 +74,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -112,7 +110,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -147,7 +145,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -182,7 +180,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -218,7 +216,6 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
Expand Down Expand Up @@ -255,7 +252,6 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
Expand Down Expand Up @@ -292,7 +288,6 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
Expand Down Expand Up @@ -330,7 +325,6 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -71,7 +71,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -102,7 +102,6 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode)

assertTrue(result.messages.contains(HEADER_MAP_PARAMETER_TYPE_MUST_BE_MAP))
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package de.jensklingenberg.ktorfit

import com.tschuchort.compiletesting.KotlinCompilation
import com.tschuchort.compiletesting.SourceFile
import com.tschuchort.compiletesting.kspSourcesDir
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Test
import java.io.File
Expand Down Expand Up @@ -36,7 +34,7 @@ suspend fun test(): String

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -66,7 +66,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down Expand Up @@ -105,7 +105,7 @@ interface TestService {

val compilation = getCompilation(listOf(source))
val result = compilation.compile()
assertEquals(ExitCode.OK, result.exitCode)

val generatedSourcesDir = compilation.kspSourcesDir
val generatedFile =
File(
Expand Down
Loading

0 comments on commit 7b4f0e0

Please sign in to comment.