Skip to content

Commit

Permalink
Merge branch 'refs/heads/release/v2.1.0' into ktor3
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	example/MultiplatformExample/build.gradle.kts
#	example/MultiplatformExample/shared/build.gradle.kts
#	gradle/libs.versions.toml
  • Loading branch information
Foso committed Sep 1, 2024
2 parents 80c69af + 682ea88 commit 756582e
Show file tree
Hide file tree
Showing 121 changed files with 1,155 additions and 769 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
### :thinking: DOD Checklist

- [ ] I did all relevant changes to the documentation and the [changelog](https://github.com/Foso/Ktorfit/blob/master/docs/CHANGELOG.md).
- [] I did all relevant changes to the documentation and the [changelog](https://github.com/Foso/Ktorfit/blob/master/docs/CHANGELOG.md).
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ jobs:
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
distribution: temurin
java-version: 21
- uses: gradle/actions/setup-gradle@v4
- name: API check
run: ./gradlew ktLintCheck apiCheck
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'zulu'
java-version: 21
distribution: 'temurin'
- name: Cache Gradle and wrapper
uses: actions/cache@v4
with:
Expand All @@ -55,4 +55,4 @@ jobs:
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build and test with Gradle
run: ./gradlew licensee :ktorfit-annotations:publishToMavenLocal :ktorfit-ksp:test :ktorfit-lib-core:jvmTest :ktorfit-converters:call:publishToMavenLocal :ktorfit-converters:flow:publishToMavenLocal :ktorfit-converters:response:publishToMavenLocal
run: ./gradlew licensee :ktorfit-annotations:publishToMavenLocal :ktorfit-compiler-plugin:test :ktorfit-ksp:test :ktorfit-lib-core:jvmTest :ktorfit-converters:call:publishToMavenLocal :ktorfit-converters:flow:publishToMavenLocal :ktorfit-converters:response:publishToMavenLocal
10 changes: 5 additions & 5 deletions .github/workflows/publish-converters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install JDK 11
- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
java-version: 21

- uses: gradle/gradle-build-action@v3
- uses: gradle/gradle-build-action@v4

- name: Publish release
run: ./gradlew :ktorfit-converters:call:publishAllPublicationsToMavenCentralRepository :ktorfit-converters:flow:publishAllPublicationsToMavenCentralRepository :ktorfit-converters:response:publishAllPublicationsToMavenCentralRepository
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
30 changes: 15 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install JDK 11
- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
java-version: 21

- uses: gradle/gradle-build-action@v3

Expand All @@ -31,11 +31,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install JDK 11
- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
java-version: 21

- uses: gradle/gradle-build-action@v3

Expand All @@ -52,11 +52,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install JDK 11
- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
java-version: 21

- uses: gradle/gradle-build-action@v3

Expand All @@ -73,11 +73,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install JDK 11
- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
java-version: 21

- uses: gradle/gradle-build-action@v3

Expand All @@ -94,11 +94,11 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install JDK 11
- name: Install JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
distribution: 'temurin'
java-version: 21

- uses: gradle/gradle-build-action@v3

Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,30 @@ See https://foso.github.io/Ktorfit/#compatibility
|-----------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| Ktorfit Gradle Plugin | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/de.jensklingenberg.ktorfit.gradle.plugin)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/de.jensklingenberg.ktorfit.gradle.plugin) |
| ktorfit-lib | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-lib)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-lib) |
| compiler-plugin | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/compiler-plugin)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/compiler-plugin) |
| ktorfit-lib-light | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-lib-light)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-lib-light) |
| compiler-plugin | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/compiler-plugin)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/compiler-plugin) |
| ktorfit-ksp | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-lib)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-ksp) |
| ktorfit-converters-flow | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-flow)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-flow) |
| ktorfit-converters-call | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-call)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-call) |
| ktorfit-converters-response | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-response)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-response) |

## Ktorfit Ktor 3 Packages
The main dependencies will stay on Ktor 2.x till Ktor 3 is stable.
When you want to use Ktor 3 and WasmJs, you need to replace your dependecies with a "ktor3" version, you can use the following packages:

| Project | Version |
|-----------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| ktorfit-lib-light-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-lib-light-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-lib-light-ktor-3.0.0-beta-2) |
| ktorfit-lib-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-lib-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-lib-ktor-3.0.0-beta-2) |
| ktorfit-converters-flow-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-flow-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-flow-ktor-3.0.0-beta-2) |
| ktorfit-converters-call-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-call-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-call-ktor-3.0.0-beta-2) |
| ktorfit-converters-response-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-response-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-response-ktor-3.0.0-beta-2) |

You can find all Ktorfit packages on [Maven Central](https://search.maven.org/search?q=de.jensklingenberg.ktorfit).

🔎 Check the [latest changes](https://github.com/Foso/Ktorfit/blob/master/docs/CHANGELOG.md) to update your Koin project.

🛠 Follow the [setup page](https://foso.github.io/Ktorfit/installation/) for more details

## 👷 Project Structure

Expand Down
2 changes: 0 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ plugins {
id("org.jlleitschuh.gradle.ktlint") version "12.1.1" apply false
}



buildscript {
repositories {
mavenLocal()
Expand Down
70 changes: 62 additions & 8 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,74 @@ 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.1.0]()

* Supported Kotlin version: (min) 2.0.20
* Supported KSP version: (min) 1.0.24
* Ktor version: 2.3.12

## Added
- documentation page for [known issues](https://foso.github.io/Ktorfit/knownissues/)

## Changed
- Allow Http Delete with Body [#647](https://github.com/Foso/Ktorfit/issues/647)
- By default, nullable response types will not throw an exception. You can now override this behavior by adding the **DontSwallowExceptionsConverterFactory**
or your own ConverterFactory to the converterFactories. [#618](https://github.com/Foso/Ktorfit/issues/618)

## Fixed
- Task with path 'kspCommonMainKotlinMetadata' not found in project [#593](https://github.com/Foso/Ktorfit/issues/593)
- Ktorfit Gradle Plugin not compatible with Android Multiplatform Library plugin [#638](https://github.com/Foso/Ktorfit/issues/638)

## Ktor3
The "normal" dependencies will stay on Ktor 2.x till 3.0 is stable. But here are versions that you can use when want to use Ktor3 and WasmJs

de.jensklingenberg.ktorfit:ktorfit-lib-light-ktor-3.0.0-beta-2:2.1.0

de.jensklingenberg.ktorfit:ktorfit-lib-ktor-3.0.0-beta-2:2.1.0

de.jensklingenberg.ktorfit:ktorfit-converters-flow-ktor-3.0.0-beta-2:2.1.0

de.jensklingenberg.ktorfit:ktorfit-converters-call-ktor-3.0.0-beta-2:2.1.0

de.jensklingenberg.ktorfit:ktorfit-converters-response-ktor-3.0.0-beta-2:2.1.0

# [2.0.1]()

compiler-plugin:2.0.1-2.0.10 - 2024-08-10
========================================
- Kotlin 2.0.10
* Supported Kotlin version: (min) 2.0.0 (max) 2.0.20
* Supported KSP version: (min) 1.0.24 (max) 1.0.24
* Ktor version: 2.3.12

2.0.1 - 2024-08-08
========================================
### Fixed
- #594 Endpoint with types from other module
- #591 Ktorfit plugin doesn't include correct generate source if build directory changes #591
- #621 RequestConverter causing compile error
## Fixed
- Endpoint with types from other module #594
- Ktorfit plugin doesn't include correct generate source if build directory changes #591
- RequestConverter causing compile error #621
- Build with Ktor 2.3.12

## ktorfit-annotations
- 2.0.1: The annotations are now also available for WasmJs

## 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-RC: 2.0.1-2.0.20-RC - 2024-08-13
- Kotlin 2.0.20-RC2: 2.0.1-2.0.20-RC2 - 2024-08-13
- 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

## Ktor3
The "normal" dependencies will stay on Ktor 2.x till 3.0 is stable. But here are versions that you can use when want to use Ktor3 and WasmJs

| Project | Version |
|-----------------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| ktorfit-lib-light-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-lib-light-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-lib-light-ktor-3.0.0-beta-2) |
| ktorfit-lib-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-lib-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-lib-ktor-3.0.0-beta-2) |
| ktorfit-converters-flow-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-flow-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-flow-ktor-3.0.0-beta-2) |
| ktorfit-converters-call-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-call-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-call-ktor-3.0.0-beta-2) |
| ktorfit-converters-response-ktor-3.0.0-beta-2 | [![Maven Central](https://img.shields.io/maven-central/v/de.jensklingenberg.ktorfit/ktorfit-converters-response-ktor-3.0.0-beta-2)](https://central.sonatype.com/artifact/de.jensklingenberg.ktorfit/ktorfit-converters-response-ktor-3.0.0-beta-2) |

# [2.0.0]()

Expand All @@ -39,7 +92,8 @@ ktorfit-ksp-2.0.0-1.0.22 - 2024-06-06

2.0.0 - 2024-05-27
========================================
### Changed

# Changed
- Build with KSP 1.0.21, Kotlin 2.0.0, Ktor 2.3.11
- The needed dependencies for Ktorfit KSP processor are now included in the Ktorfit Gradle plugin. You can remove the ksp() block from your build.gradle.kts file. You still need to apply the KSP plugin.

Expand Down
5 changes: 5 additions & 0 deletions docs/android/proguard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
proguard-rules.pro
```
-keep class de.jensklingenberg.ktorfit.** { *; }
-keepclassmembers class de.jensklingenberg.ktorfit.** { *; }
```
16 changes: 10 additions & 6 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Then it looks at the parent interfaces of that functions and generates, the sour
public class _ExampleApiImpl(
private val _ktorfit: Ktorfit,
) : ExampleApi {
public val _converter: KtorfitConverterHelper = KtorfitConverterHelper(_ktorfit)
private val _helper: KtorfitConverterHelper = KtorfitConverterHelper(_ktorfit)

override suspend fun exampleGet(): People {
val _ext: HttpRequestBuilder.() -> Unit = {
Expand All @@ -43,14 +43,18 @@ public class _ExampleApiImpl(
takeFrom(_ktorfit.baseUrl + "/test")
}
}
val _typeData = TypeData.createTypeData(qualifiedTypename = "com.example.model.People",
typeInfo = typeInfo<People>())

return _converter.suspendRequest<People, People>(_typeData,_ext)!!
val _typeData = TypeData.createTypeData(
typeInfo = typeInfo<People>(),
)
return _helper.suspendRequest(_typeData,_ext)!!
}
}

public fun Ktorfit.createExampleApi(): ExampleApi = this.create(_ExampleApiImpl(this))
public class _ExampleApiProvider : ClassProvider<ExampleApi> {
override fun create(_ktorfit: Ktorfit): ExampleApi = _ExampleApiImpl(_ktorfit)
}

public fun Ktorfit.createExampleApi(): ExampleApi = _ExampleApiImpl(this)
```

The next part is the compiler plugin which is added by the gradle plugin.
Expand Down
9 changes: 5 additions & 4 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Compile errors
# Gradle
## Compile errors
By default, Ktorfit will throw compile error when it finds conditions under which it can't ensure that it will work correct.
You can set it in the Ktorfit config to change this

Expand All @@ -16,7 +17,7 @@ You can set it in your build.gradle.kts file,

* WARNING: Turn errors into warnings

# QualifiedTypeName
## QualifiedTypeName
By default, Ktorfit will keep qualifiedTypename for TypeData in the generated code empty. You can set it in the Ktorfit config to change this:

```kotlin
Expand All @@ -42,9 +43,9 @@ val _typeData = TypeData.createTypeData(
...
```

# Ktorfit Builder


# Add your own Ktor client
## Add your own Ktor client
You can set your Ktor client instance to the Ktorfit builder:

```kotlin
Expand Down
10 changes: 9 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# Development
# 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
16 changes: 5 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ inspired by [Retrofit](https://square.github.io/retrofit/)

## Compatibility

| Ktorfit-version | Kotlin | KSP | Ktor |
|-------------------|:-------------:|:-----------------------------:|:----------:|
| **_2.0.1_** | **>=2.0.0** | **>=1.0.24** | **2.3.12** |
| **_2.0.0_** | **2.0.0** | **1.0.21 (min) 1.0.24 (max)** | **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** |


| Ktorfit-version |
|-------------------------------------------------------------------------------|
| **_2.1.0_** https://github.com/Foso/Ktorfit/blob/master/docs/CHANGELOG.md#210 |
| **_2.0.1_** https://github.com/Foso/Ktorfit/blob/master/docs/CHANGELOG.md#201 |
| **_2.0.0_** https://github.com/Foso/Ktorfit/blob/master/docs/CHANGELOG.md#200 |

# Installation

Expand Down
Loading

0 comments on commit 756582e

Please sign in to comment.