diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 382e1a04..9cc8b738 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -20,7 +20,7 @@ env:
ALGOLIA_INDEX_NAME: 'prod_kotlin_rpc'
ALGOLIA_KEY: '${{ secrets.ALGOLIA_KEY }}'
CONFIG_JSON_PRODUCT: 'kotlinx-rpc'
- CONFIG_JSON_VERSION: '0.3.0'
+ CONFIG_JSON_VERSION: '0.4.0'
jobs:
build:
diff --git a/README.md b/README.md
index 59337624..125e43e3 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
[![Kotlin Experimental](https://kotl.in/badges/experimental.svg)](https://kotlinlang.org/docs/components-stability.html)
[![Official JetBrains project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
-[![Kotlin](https://img.shields.io/badge/kotlin-1.7.0--2.0.10-blue.svg?logo=kotlin)](http://kotlinlang.org)
+[![Kotlin](https://img.shields.io/badge/kotlin-2.0.0--2.0.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
[//]: # ([![TeamCity build](https://img.shields.io/teamcity/build/s/Build_kRPC_All.svg?server=http%3A%2F%2Fkrpc.teamcity.com)](https://teamcity.jetbrains.com/viewType.html?buildTypeId=Build_kRPC_All&guest=1))
@@ -84,33 +84,18 @@ Check out our [getting started guide](https://kotlin.github.io/kotlinx-rpc) for
### Plugin dependencies
-`kotlinx.rpc` has the following plugin dependencies:
-- The `org.jetbrains.kotlinx.rpc.plugin` will set up BOM and code generation for targets in the project.
-- The `org.jetbrains.kotlinx.rpc.platform` will only set up BOM. It is useful when you want to split your app into modules,
-and some of them will contain service declarations, thus using code generation, while others will only consume them.
+`kotlinx.rpc` provides Gradle plugin `org.jetbrains.kotlinx.rpc.plugin`
+that will set up code generation in a project.
-Example of plugins setup in a project's `build.gradle.kts`:
+Example of a setup in a project's `build.gradle.kts`:
```kotlin
plugins {
- kotlin("jvm") version "2.0.10"
- kotlin("plugin.serialization") version "2.0.10"
- id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0"
+ kotlin("multiplatform") version "2.0.21"
+ kotlin("plugin.serialization") version "2.0.21"
+ id("org.jetbrains.kotlinx.rpc.plugin") version "0.4.0"
}
```
-For Kotlin versions prior to 2.0,
-KSP plugin is required
-(Corresponding configurations will be set up automatically by `org.jetbrains.kotlinx.rpc.plugin` plugin):
-
-```kotlin
-// build.gradle.kts
-plugins {
- kotlin("jvm") version "1.9.25"
- kotlin("plugin.serialization") version "1.9.25"
- id("com.google.devtools.ksp") version "1.9.25-1.0.20"
- id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0"
-}
-```
### Runtime dependencies
To use `kotlinx.rpc` runtime dependencies, add Maven Central to the list of your repositories:
```kotlin
@@ -121,16 +106,16 @@ repositories {
And now you can add dependencies to your project:
```kotlin
dependencies {
- // client API
- implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-client")
- // server API
- implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-server")
- // serialization module. also, protobuf and cbor are available
- implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json")
+ // Client API
+ implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-client:0.4.0")
+ // Server API
+ implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-server:0.4.0")
+ // Serialization module. Also, protobuf and cbor are provided
+ implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-serialization-json:0.4.0")
- // transport implementation for Ktor
- implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client")
- implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server")
+ // Transport implementation for Ktor
+ implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-client:0.4.0")
+ implementation("org.jetbrains.kotlinx:kotlinx-rpc-krpc-ktor-server:0.4.0")
// Ktor API
implementation("io.ktor:ktor-client-cio-jvm:$ktor_version")
@@ -143,7 +128,7 @@ You can see example projects in the [samples](samples) folder.
`kotlinx.rpc` is designed to be transport agnostic.
That means that the library aims to provide the best RPC experience regardless of how the resulting messages are transferred.
That allows for easy integration into existing solutions, such as Ktor, without the need to rewrite code.
-Just plug-in `kotlinx.rpc`, provide it with means to transfer encoded data (or use out-of-the-box integrations) and it will run.
+Add `kotlinx.rpc`, provide it with means to transfer encoded data (or use out-of-the-box integrations) and it will run.
With enough time it might even work with [avian carriers](https://en.wikipedia.org/wiki/IP_over_Avian_Carriers).
`kotlinx.rpc` provides its own transfer protocol called kRPC, which takes responsibility for tracking serializing and handling other complex request operations.
@@ -154,26 +139,12 @@ Besides that, one can even provide their own protocol or integration with one to
Though possible, it is much more complicated way to use the library and generally not needed.
`kotlinx.rpc` aims to provide most common protocols integrations as well as the in-house one called kRPC.
Integrations in progress:
-- Integration with [gRPC](https://grpc.io/) (in prototype)
+- Integration with [gRPC](https://grpc.io/) (in prototype)
## Kotlin compatibility
We support all stable Kotlin versions starting from 2.0.0:
- 2.0.0, 2.0.10, 2.0.20, 2.0.21
-To simplify project configuration, our Gradle plugin sets a proper library version automatically using BOM,
-based on the project's Kotlin version:
-```kotlin
-plugins {
- kotlin("jvm") version "2.0.10"
- id("org.jetbrains.kotlinx.rpc.plugin") version "0.3.0"
-}
-
-dependencies {
- // version 0.3.0 is set by the Gradle plugin
- implementation("org.jetbrains.kotlinx:kotlinx-rpc-core")
-}
-```
-
For a full compatibility checklist,
see [Versions](https://kotlin.github.io/kotlinx-rpc/versions.html).
diff --git a/docs/pages/kotlinx-rpc/help-versions.json b/docs/pages/kotlinx-rpc/help-versions.json
index aefc80e9..a5e4e23e 100644
--- a/docs/pages/kotlinx-rpc/help-versions.json
+++ b/docs/pages/kotlinx-rpc/help-versions.json
@@ -1,3 +1,3 @@
[
- {"version":"0.3.0","url":"/kotlinx-rpc/0.3.0/","isCurrent":true}
+ {"version":"0.4.0","url":"/kotlinx-rpc/0.4.0/","isCurrent":true}
]
diff --git a/docs/pages/kotlinx-rpc/rpc.tree b/docs/pages/kotlinx-rpc/rpc.tree
index 23ab1e14..53f20105 100644
--- a/docs/pages/kotlinx-rpc/rpc.tree
+++ b/docs/pages/kotlinx-rpc/rpc.tree
@@ -26,6 +26,7 @@
+ Version
+ This version brings changes to service definitions. Starting with this version, service definitions require
+ the
+ Prior to
+ Starting from
+ This definition is sufficient for the project to build. However, it will not fully support IDE features,
+ such as code highlighting.
+ All interfaces annotated with
+ To ensure proper IDE support, add explicit typing:
+
+ The reasoning behind this update is that the Kotlin Compiler Plugin API has changed.
+ Versions
+ To track changes in this regard, we raised an issue
+ with the compiler team.
+ Note that this approach is subject to change, and the final API design may be updated before the stable
+ release.
+
+ We stopped publishing compiler plugin artifacts for Kotlin versions prior to
+ Currently supported Kotlin versions:
+ The Gradle plugin with id
+ The Gradle plugin with id
+ To configure BOM manually, add the following dependency:
+ 0.4.0
introduces breaking changes.
+ @Rpc
annotation.
+ 0.4.0
, a service was defined as follows:
+ 0.4.0
, the new service definition should be:
+ @Rpc
are inherently of type RemoteService
, which is
+ added by the compiler plugin, but IDEs won't be able to resolve it.
+ 2.0.0
and 2.0.10
allowed our plugin to resolve marker interfaces (like RPC
)
+ before the code generation phase. Starting from version 2.0.20
, this behaviour changed,
+ making annotations the only reliable way to detect RPC services.
+ 2.0.0
.
+ The reason being its high maintenance cost with little to no usage.
+ We encourage the migration to Kotlin 2.0, where all stable versions are now supported.
+
+ 2.0.0
, 2.0.10
, 2.0.20
, 2.0.21
+ org.jetbrains.kotlinx.rpc.platform
is not being published anymore.
+ The reason is that it's sole role was to set BOM in the project, which is now considered unnecessary.
+ Gradle version catalogs
+ can be used instead.
+ org.jetbrains.kotlinx.rpc.plugin
+ does not set BOM for the project anymore.
+
Note that this API is experimental and may be removed in future releases.
+
+ Another way of managing streams is to do it manually.
+ For this, you can use the StreamScope
constructor function together with
+ withStreamScope
:
+
Our protocol provides you with an ability to declare service fields:
diff --git a/docs/pages/kotlinx-rpc/topics/get-started.topic b/docs/pages/kotlinx-rpc/topics/get-started.topic index 1b2652ec..6ba7fe8f 100644 --- a/docs/pages/kotlinx-rpc/topics/get-started.topic +++ b/docs/pages/kotlinx-rpc/topics/get-started.topic @@ -110,21 +110,8 @@kotlinx.rpc
provides two Gradle plugins:
- To add a plugin to your project, you need to define the following in your
To learn more about versioning, see .
+ ++ This will configure code generation for your project. +
kotlinx.rpc
requires you to add
+
kotlinx.rpc
requires you to add the
kotlinx.serialization
Gradle plugin to your project.
- The kotlinx.rpc
library offers plugins that simplify project configuration by automating repetitive
- tasks.
- Specifically, kotlinx.rpc
provides two Gradle plugins:
+ The kotlinx.rpc
library offers a Gradle plugin
+ that simplifies project configuration by automating repetitive tasks: `org.jetbrains.kotlinx.rpc.plugin`
The org.jetbrains.kotlinx.rpc.platform
plugin
- is particularly useful for versioning project dependencies.
- It adds BOM
- dependency to your project, that specifies proper versions for kotlinx.rpc
dependencies.
- With this, you can skip specifying versions for each runtime dependency:
Using this plugin with version catalogs, your code can be rewritten like this:
- -
- The org.jetbrains.kotlinx.rpc.plugin
plugin
- has the same BOM functionality as org.jetbrains.kotlinx.rpc.platform
and it also sets
- up code generation configurations.
+ The org.jetbrains.kotlinx.rpc.plugin
plugin sets up code generation configurations.
It is useful for multi-project setups - where you define your RPC services in one set of subprojects and use in the - other. In such a setup, you can add the plugin only to modules with service definitions - to save time on building your project.
-- If you are using a version of Kotlin prior to 2.0, - you must also add the KSP (Kotlin Symbol Processing) Gradle plugin: -
-+ For multi-project setups + where you define your RPC services in one set of subprojects and use them in + another, you can add the plugin only to modules with service definitions. +
Services are the centerpieces of the library.
- A service is an interface annotated with the RPC
annotation,
+ A service is an interface annotated with the @Rpc
annotation,
and contains a set of methods and fields
that can be executed or accessed remotely.
- A simple service can be declared as follows:
RemoteService
,
+ which can be specified explicitly, or assumed implicitly by the compiler.
+
+ A simple service can be declared as follows:
As kotlinx.rpc
uses Kotlin compiler plugin and KSP plugins,
+
As kotlinx.rpc
uses Kotlin compiler plugin,
we rely on internal functionality that may change over time with any new Kotlin version.
To prevent the library from breaking with an incompatible Kotlin version,
we use version prefix for artifacts with code generating functionality.
@@ -69,9 +69,12 @@
id("org.jetbrains.kotlinx.rpc.plugin") version "%kotlinx-rpc-version%"
}