Skip to content

Add support for Kotlin 2.4.0 - #193

Closed
DevSrSouza wants to merge 11 commits into
touchlab:mainfrom
DevSrSouza:feature/kotlin-2.4.0
Closed

Add support for Kotlin 2.4.0#193
DevSrSouza wants to merge 11 commits into
touchlab:mainfrom
DevSrSouza:feature/kotlin-2.4.0

Conversation

@DevSrSouza

@DevSrSouza DevSrSouza commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Adds Kotlin 2.4.0 support.

Replaces #191, which dropped external-dependency reporting (it returns an empty set now that UserVisibleIrModulesSupport was removed) and quietly changes library classification and default-argument generation. This version restores it by deserializing the dependency graph the Kotlin Gradle plugin still writes to the -Xexternal-dependencies file and passes to the native link, so behavior matches 2.3.x.

That file is generated by default (the only condition is whether external dependencies exist) and fed to the link task, per the Kotlin 2.4.0 source:

Tested locally with Maestro E2E across 10+ full features on iOS, all good.

LionZXY and others added 9 commits June 3, 2026 15:59
Register 2.4.0 (release) in versionSupport.kotlin and switch dev-support to it.

SKIE keeps compiling with the 2.2.20 Kotlin compiler (which still supports
experimental context receivers). That compiler reads klib metadata only one
minor version ahead, so building against the 2.4.0 Kotlin/Native distribution
needs -Xskip-metadata-version-check; it is added in BaseKotlinPlugin for every
JVM module (main and test) when the primary Kotlin version is >= 2.4.0.
Kotlin 2.4.0 renamed several Kotlin/Native compiler types:
- KonanConfig      -> NativeSecondStageCompilationConfig
- KonanConfigKeys  -> NativeConfigurationKeys
- PhaseContext     -> NativePhaseContext

The shared `main` source set now references SKIE-internal typealiases
(co.touchlab.skie.compat.{KonanConfig,KonanConfigKeys,PhaseContext}) defined
per version range (`..2.3.20` -> old names, `2.4.0..` -> new names). The
debugPrefixMapKey/phaseContextKonanConfig version helpers are bounded to
exactly 2.3.20 and reimplemented for 2.4.0+ against the new types.
Kotlin 2.4.0 removed the dedicated IR value-parameter/receiver/argument
accessors (valueParameters, putValueArgument, putTypeArgument,
extensionReceiver, extensionReceiverParameter) in favor of unified positional
parameters/arguments lists, changed IrMutableAnnotationContainer.annotations
to List<IrAnnotation>, and made the GeneratorContext primary constructor
private (the public one gained a CompilerConfiguration parameter).

The shared `main` source set now uses skie* shims and a
skieCreateGeneratorContext helper, implemented per version range, plus a
SkieIrAnnotation alias for the annotation element type.
…dulesSupport removal

- CompilerConfiguration.report(severity, message, location) was removed; SKIE
  now reports through the MessageCollector (reportCompilerMessage shim).
- The framework OUTPUT key was renamed to KONAN_OUTPUT_PATH
  (frameworkOutputPathConfigurationKey shim).
- CompilerConfigurationKey is final; SkieConfigurationKeys holds key instances
  instead of subclassing it.
- UserVisibleIrModulesSupport was removed with no replacement that maps
  resolved libraries to dependency coordinates. getExternalDependencies returns
  an empty set on 2.4.0, so all non-distribution libraries are treated as local
  and per-module analytics no longer distinguish external libraries. Default
  libraries are now detected via KotlinLibrary.isFromKotlinNativeDistribution.
# Conflicts:
#	common-gradle/gradle.properties
#	dev-support/build.gradle.kts
`generateCIActions` regenerates every versioned smoke-test workflow, which
incidentally re-synced the stale smoke-tests-2_3_20-*.yml (its lockfile was
shrunk in b88ae64 without regenerating the workflow). That change is unrelated
to Kotlin 2.4.0 support, so restore those two files to match main and keep this
PR scoped to 2.4.0.
@DevSrSouza
DevSrSouza force-pushed the feature/kotlin-2.4.0 branch from db9a6c4 to 1b2af16 Compare June 11, 2026 16:04
@dacoto dacoto mentioned this pull request Jun 16, 2026
@TadeasKriz

Copy link
Copy Markdown
Collaborator

Merged.

@TadeasKriz TadeasKriz closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants