Plugins
The kotlinx.rpc
library offers plugins that simplify project configuration by automating repetitive tasks. Specifically, kotlinx.rpc
provides two Gradle plugins:
org.jetbrains.kotlinx.rpc.platform
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:
org.jetbrains.kotlinx.rpc.plugin
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.
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.
For kotlinx.rpc
library to work correctly with user-defined services, two additional configurations are required: the Kotlin compiler plugin and the KSP plugin. By adding the kotlinx.rpc
and KSP Gradle plugins, all necessary configurations will be automatically set up: