Skip to content

[WIP] Upgrade to Kotlin 2.2.0#828

Closed
zacharee wants to merge 22 commits into
icerockdev:masterfrom
zacharee:kotlin-2.2.0
Closed

[WIP] Upgrade to Kotlin 2.2.0#828
zacharee wants to merge 22 commits into
icerockdev:masterfrom
zacharee:kotlin-2.2.0

Conversation

@zacharee

Copy link
Copy Markdown
Contributor

This does the necessary work to support Kotlin 2.2.0.

Comment thread gradle/libs.versions.toml
Comment on lines +14 to +17
composeUiVersion = "1.8.3"

# jetbrains compose
composeJetbrainsVersion = "1.6.0"
composeJetbrainsVersion = "1.8.2"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These had to be upgraded to versions that support Kotlin 2.0 and its newly-removed native targets.

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is necessary for the project to build, but Android Studio was really unhappy about the old Gradle version.


fun KonanTarget.getAppleSdk(): String {
return when (this) {
KonanTarget.IOS_ARM32,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target was removed in Kotlin 2.0.

Comment on lines -127 to -128
KonanTarget.WATCHOS_X64,
KonanTarget.WATCHOS_X86 -> "watchsimulator"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target was removed in Kotlin 2.0.


fun KonanTarget.getClangTarget(): String {
return when (this) {
KonanTarget.IOS_ARM32 -> "armv7-apple-ios"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target was removed in Kotlin 2.0.

KotlinPlatformType.androidJvm -> createAndroid()
KotlinPlatformType.js -> createJs()
KotlinPlatformType.native -> when (konanTarget()) {
KonanTarget.IOS_ARM32,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target was removed in Kotlin 2.0.

KonanTarget.WATCHOS_DEVICE_ARM64,
KonanTarget.WATCHOS_SIMULATOR_ARM64,
KonanTarget.WATCHOS_X64,
KonanTarget.WATCHOS_X86 -> createApple()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This target was removed in Kotlin 2.0.

Comment on lines -54 to -55
KonanTarget.LINUX_MIPS32,
KonanTarget.LINUX_MIPSEL32,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These targets were removed in Kotlin 2.0.

Comment on lines -59 to -63
KonanTarget.MINGW_X86,

KonanTarget.WASM32,

is KonanTarget.ZEPHYR -> error("$konanTarget not supported by moko-resources now")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These targets were removed in Kotlin 2.0.

actual fun createStringResourceMock(): StringResource = StringResource("")
actual fun createFileResourceMock(): FileResource = FileResource("", "")
actual fun createColorResourceMock(): ColorResource = ColorResource("")
actual fun createFontResourceMock(): FontResource = FontResource("")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving this to appleMain ended up not being necessary to build, but it makes the code a little cleaner.

@checoalejandro

Copy link
Copy Markdown

Does this PR will resolve incompatiblity with Kotlin 2.2.20-RC as well? moko-resources is not compiling with this last version.

@zacharee

Copy link
Copy Markdown
Contributor Author

This was just for 2.2.0, and the changes were included in the latest release separately. It works for 2.2.10 for me but I don't think I've tried 2.2.20.

@checoalejandro

Copy link
Copy Markdown

This was just for 2.2.0, and the changes were included in the latest release separately. It works for 2.2.10 for me but I don't think I've tried 2.2.20.

Just tried and still failing.

@treitter

Copy link
Copy Markdown

This was just for 2.2.0, and the changes were included in the latest release separately. It works for 2.2.10 for me but I don't think I've tried 2.2.20.

Same for me.

Also, please note this is soon to impact more users:

  • macOS / Xcode 26 just got released and they require Kotlin 2.2.21 (not yet released)
  • anyone who updates to macOS 26 is required to update to Xcode 26 (I believe; it was at least heavily implied) and you can't downgrade in an officially-supported way as far as I can tell

I'm currently unable to build my project on iOS for that last reason.

@zacharee

zacharee commented Oct 2, 2025

Copy link
Copy Markdown
Contributor Author

#846

@zacharee zacharee closed this Oct 2, 2025
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