Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ Changelog
- [FIR] Named annotation arguments in different order from declared parameters getting silently skipped.
- [IR] Prohibit duplicate map keys.

### Changes

- Remove testing of 2.3.0 prereleases. IntelliJ stable currently builds off Kotlin `2.3.2x` and Android Studio stable currently points to Kotlin `2.2.2x`.

0.9.2
-----

Expand Down
10 changes: 10 additions & 0 deletions compiler-compat/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ IDE plugins can be downloaded from https://plugins.jetbrains.com/plugin/6954-kot

Note this version may not have published artifacts anywhere, so it may require picking the nearest one and specifying the appropriate `minVersion` in its factory.

### Extracting Compiler Version from IDE

Use the provided script to extract the bundled Kotlin compiler version from an Android Studio or IntelliJ installation:

```bash
./extract-kotlin-compiler-txt.sh "/path/to/Android Studio.app"
```

This prints the compiler version (e.g., `2.2.255-dev-255`) to stdout.

## Architecture

### Core Interface
Expand Down
16 changes: 16 additions & 0 deletions compiler-compat/extract-kotlin-compiler-txt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

if [ -z "$1" ]; then
echo "Usage: $0 <path-to-intellij.app>"
exit 1
fi

BASE="$1/Contents/plugins/Kotlin"
JAR="$BASE/lib/kotlinc.kotlin-compiler-common.jar"

if [ ! -f "$JAR" ]; then
echo "Error: kotlinc.kotlin-compiler-common.jar not found at $JAR"
exit 1
fi

unzip -p "$JAR" META-INF/compiler.version
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (C) 2025 Zac Sweers
// SPDX-License-Identifier: Apache-2.0
package dev.zacsweers.metro.compiler.compat.k230_beta1
package dev.zacsweers.metro.compiler.compat.k230

import dev.zacsweers.metro.compiler.compat.CompatContext
import org.jetbrains.kotlin.GeneratedDeclarationKey
Expand Down Expand Up @@ -248,7 +248,7 @@ public class CompatContextImpl : CompatContext {
}

public class Factory : CompatContext.Factory {
override val minVersion: String = "2.3.0-Beta1"
override val minVersion: String = "2.3.0"

override fun create(): CompatContext = CompatContextImpl()
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dev.zacsweers.metro.compiler.compat.k230.CompatContextImpl$Factory
1 change: 1 addition & 0 deletions compiler-compat/k230/version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.0

This file was deleted.

1 change: 0 additions & 1 deletion compiler-compat/k230_beta1/version.txt

This file was deleted.

2 changes: 1 addition & 1 deletion compiler-compat/k2320_dev_5437/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ dependencies {
compileOnly(kotlinVersion.map { "org.jetbrains.kotlin:kotlin-compiler:$it" })
compileOnly(libs.kotlin.stdlib)
api(project(":compiler-compat"))
implementation(project(":compiler-compat:k230_beta1"))
implementation(project(":compiler-compat:k230"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
package dev.zacsweers.metro.compiler.compat.k2320_dev_5437

import dev.zacsweers.metro.compiler.compat.CompatContext
import dev.zacsweers.metro.compiler.compat.k230_beta1.CompatContextImpl as DelegateType
import dev.zacsweers.metro.compiler.compat.k230.CompatContextImpl as DelegateType
import org.jetbrains.kotlin.GeneratedDeclarationKey
import org.jetbrains.kotlin.descriptors.Modality
import org.jetbrains.kotlin.descriptors.Visibilities
Expand Down
5 changes: 0 additions & 5 deletions compiler-compat/version-aliases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,5 @@

2.2.20
2.2.21
2.3.0-Beta1
2.3.0-Beta2
2.3.0-RC
2.3.0-RC2
2.3.0-RC3
2.3.0
2.3.20-dev-5437
14 changes: 9 additions & 5 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ The Kotlin compiler plugin API is not a stable API, so not every version of Metr

Starting with Metro `0.6.9`, Metro tries to support forward compatibility on a best-effort basis. Usually, it's `N+.2` (so a Metro version built against Kotlin `2.3.0` will try to support up to `2.3.20`.

Pre-release versions are normally only tested during their development cycle. After their stable release, Metro should continue to work with them but they will no longer be tested against. Their last tested release is indicated by putting the version in brackets like `[0.9.1]`.

| Kotlin version | Metro versions (inclusive) | Notes |
|-----------------|----------------------------|--------------------------------------|
| 2.3.20-dev-5437 | 0.8.1 - | |
| 2.3.0 | 0.9.1 - | [1] |
| 2.3.0-RC3 | 0.6.9, 0.6.11 - | |
| 2.3.0-RC2 | 0.6.9, 0.6.11 - | |
| 2.3.0-RC | 0.6.9, 0.6.11 - | Reporting doesn't work until `0.7.3` |
| 2.3.0-Beta2 | 0.6.9, 0.6.11 - | Reporting doesn't work until `0.7.3` |
| 2.3.0-Beta1 | 0.6.9, 0.6.11 - | |
| 2.3.0-RC3 | 0.6.9, 0.6.11 - [0.9.2] | |
| 2.3.0-RC2 | 0.6.9, 0.6.11 - [0.9.2] | |
| 2.3.0-RC | 0.6.9, 0.6.11 - [0.9.2] | Reporting doesn't work until `0.7.3` |
| 2.3.0-Beta2 | 0.6.9, 0.6.11 - [0.9.2] | Reporting doesn't work until `0.7.3` |
| 2.3.0-Beta1 | 0.6.9, 0.6.11 - [0.9.2] | |
| 2.2.21 | 0.6.6 - | |
| 2.2.20 | 0.6.6 - | |
| 2.2.10 | 0.4.0 - 0.6.5 | |
Expand All @@ -22,6 +24,8 @@ Starting with Metro `0.6.9`, Metro tries to support forward compatibility on a b

[1]: Metro versions 0.6.9–0.9.0 had a [version comparison bug](https://github.com/ZacSweers/metro/issues/1544) that caused them to incorrectly select a compat module for Kotlin 2.2.20 when running on the Kotlin 2.3.0 final release. This was fixed in 0.9.1.

IDEs have their own compatibility story with Kotlin versions. The Kotlin IDE plugin embeds Kotlin versions built from source, so Metro's IDE support selects the nearest compatible version and tries to support the latest stable IntelliJ and Android Studio releases + the next IntelliJ EAP release.

Some releases may introduce prohibitively difficult breaking changes that require companion release, so check Metro's open PRs for one targeting that Kotlin version for details. There is a tested versions table at the bottom of this page that is updated with each Metro release.

## Tested Versions
Expand Down