You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/topics/k2-compiler-migration-guide.md
+32-1Lines changed: 32 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1258,6 +1258,13 @@ The following Kotlin releases have support for the new K2 compiler:
1258
1258
| 1.9.0–1.9.10 | JVM is Beta |
1259
1259
| 1.7.0–1.8.22 | Alpha |
1260
1260
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
+
1261
1268
## Compiler plugins support
1262
1269
1263
1270
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
1276
1283
In addition, the Kotlin K2 compiler supports:
1277
1284
1278
1285
* 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).
1280
1287
1281
1288
> If you use any additional compiler plugins, check their documentation to see if they are compatible with K2.
1282
1289
>
1283
1290
{type="tip"}
1284
1291
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.
0 commit comments