Skip to content

Commit 3515d48

Browse files
committed
update: k2 guide - kotlin libraries and plugins
1 parent 28a05ec commit 3515d48

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

docs/topics/k2-compiler-migration-guide.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,13 @@ The following Kotlin releases have support for the new K2 compiler:
12581258
| 1.9.0–1.9.10 | JVM is Beta |
12591259
| 1.7.0–1.8.22 | Alpha |
12601260

1261+
## Compatibility with Kotlin libraries
1262+
1263+
If you're working with Kotlin/JVM, the K2 compiler works with libraries compiled with any version of Kotlin.
1264+
1265+
If you're working with Kotlin Multiplatform, the K2 compiler is guaranteed to work with libraries compiled with Kotlin
1266+
version 1.9.20 and onwards.
1267+
12611268
## Compiler plugins support
12621269

12631270
Currently, the Kotlin K2 compiler supports the following Kotlin compiler plugins:
@@ -1276,12 +1283,36 @@ Currently, the Kotlin K2 compiler supports the following Kotlin compiler plugins
12761283
In addition, the Kotlin K2 compiler supports:
12771284

12781285
* The [Jetpack Compose](https://developer.android.com/jetpack/compose) 1.5.0 compiler plugin and later versions.
1279-
* The [Kotlin Symbol Processing (KSP) plugin](ksp-overview.md) since [KSP2](https://android-developers.googleblog.com/2023/12/ksp2-preview-kotlin-k2-standalone.html).
1286+
* [Kotlin Symbol Processing (KSP)](ksp-overview.md) since [KSP2](https://android-developers.googleblog.com/2023/12/ksp2-preview-kotlin-k2-standalone.html).
12801287

12811288
> If you use any additional compiler plugins, check their documentation to see if they are compatible with K2.
12821289
>
12831290
{type="tip"}
12841291

1292+
### Upgrade your custom compiler plugins
1293+
1294+
> Custom compiler plugins use the plugin API, which is [Experimental](https://kotlinlang.org/docs/components-stability.html#stability-levels-explained).
1295+
> As a result, the API may change at any time, so we can't guarantee backward compatibility.
1296+
>
1297+
{type="warning"}
1298+
1299+
The upgrade process has two paths depending on the type of custom plugin you have.
1300+
1301+
#### Backend-only compiler plugins
1302+
1303+
If your plugin implements only `IrGenerationExtension` extension points, the process is the same as for any other new
1304+
compiler release. Check if there are any changes to the API that you use and make changes if necessary.
1305+
1306+
#### Backend and frontend compiler plugins
1307+
1308+
If your plugin uses frontend-related extension points, you need to rewrite the plugin using the new K2 compiler API. For
1309+
an introduction to the new API, see [FIR Plugin API](https://github.com/JetBrains/kotlin/blob/master/docs/fir/fir-plugins.md).
1310+
1311+
> If you have questions about upgrading your custom compiler plugin, join our [#compiler](https://kotlinlang.slack.com/archives/C7L3JB43G)
1312+
> Slack channel, and we will do our best to help you.
1313+
>
1314+
{type="note"}
1315+
12851316
## Share your feedback on the new K2 compiler
12861317

12871318
We would appreciate any feedback you may have!

0 commit comments

Comments
 (0)