Skip to content

Update Kotlin version to 2.1.0 #1778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 17, 2025
Merged

Update Kotlin version to 2.1.0 #1778

merged 2 commits into from
Jan 17, 2025

Conversation

eymar
Copy link
Member

@eymar eymar commented Jan 15, 2025

Release Notes

Highlights - Multiple Platforms

  • Compose Multiplatform codebase is fully migrated to K2. Please note that native and web klibs can be consumed only with Kotlin 2.1.0 or newer. Also, due to underlying changes in the compiler plugin, it's better to recompile libraries against the new version. Please let us know if you find any compatibility issues during this migration.

Copy link
Member

@MatkovIvan MatkovIvan left a comment

Choose a reason for hiding this comment

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

Not blocking, just a few questions

@@ -67,7 +68,7 @@ class SelectionContainerTests : OnCanvasTests {
selection = it
syncChannel.sendFromScope(it)
},
children = {
children = @Composable {
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't the compiler plugin take care of this?

Copy link
Member Author

@eymar eymar Jan 15, 2025

Choose a reason for hiding this comment

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

I was surprised too. It didn't compile without this change.
Actually, it's indeed better to create a YT ticket and investigate too.

Copy link
Member Author

@eymar eymar Jan 16, 2025

Choose a reason for hiding this comment

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

added a YT ticket. My guess the reason is that the function we call here is internal and we suppress the call of an internal function. The frontent didn't expect such a call and @composable was not added implicitly.

Otherwise it would be broken in many other cases.

@@ -50,6 +49,6 @@ internal expect fun removePost(token: Any?)
*/
internal expect abstract class PlatformOptimizedCancellationException(
message: String? = null
) : CancellationException
) : kotlinx.coroutines.CancellationException
Copy link
Member

@MatkovIvan MatkovIvan Jan 15, 2025

Choose a reason for hiding this comment

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

Why do we remove import here? Let's try to avoid changes in commonMain in fork, especially in cases where it is not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

didn't compile. I'll create a YT ticket

Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have issue with this particular import? I can understand that it was an issue with kotlin.coroutines.cancellation.CancellationException -> kotlinx.coroutines.CancellationException, but can be this line changed by mistake?

Copy link
Member Author

Choose a reason for hiding this comment

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

Right. I fixed that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to fix it integration as well. otherwise the next merge it will be restored

Copy link
Collaborator

@igordmn igordmn Jan 16, 2025

Choose a reason for hiding this comment

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

Better to revert that commit completely, and cherry-pick this after merge.

It should be the general approach - commit to one branch, and move to another, not having 2 different versions in 2 branches.

Copy link
Member Author

@eymar eymar Jan 17, 2025

Choose a reason for hiding this comment

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

Yes, I thought that integration will be merged into jb-main eventually. But that won't happen as we discussed with Ivan. So I made this PR.

@@ -172,15 +172,12 @@ class AndroidXImplPlugin @Inject constructor(val componentFactory: SoftwareCompo
// }
// }

// We Use languageVersion 1.9 for now to align with Jetpack Compose
Copy link
Member

Choose a reason for hiding this comment

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

Why is it not the case anymore? Probably it makes sense for JVM/Desktop

Copy link
Member Author

Choose a reason for hiding this comment

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

cc: @igordmn Do we want LV 1_9 for desktop?

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we don't have issues with LV 1_9, better to keep it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed

@eymar eymar merged commit f56f6e7 into jb-main Jan 17, 2025
7 checks passed
@eymar eymar deleted the ok/upd_jbmain_kotlin_2_1_0 branch January 17, 2025 11:29
@kropp kropp changed the title Update kotlin version to 2.1.0 Update Kotlin version to 2.1.0 Feb 11, 2025
igordmn pushed a commit that referenced this pull request Feb 25, 2025
# Conflicts:
#	buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt
#	compose/material3/material3/api/desktop/material3.api
#	compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt
#	gradle/libs.versions.toml
#	navigation/navigation-compose/build.gradle
#	navigation/navigation-compose/src/commonMain/kotlin/androidx/navigation/compose/DialogNavigator.kt
#	navigation/navigation-runtime/src/commonMain/kotlin/androidx/navigation/NavControllerViewModel.kt
#	navigation/navigation-runtime/src/jbMain/kotlin/androidx/navigation/NavControllerViewModel.jb.kt
igordmn pushed a commit that referenced this pull request Feb 25, 2025
# Conflicts:
#	buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt
#	compose/material3/material3/api/desktop/material3.api
#	compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt
#	gradle/libs.versions.toml
#	navigation/navigation-compose/build.gradle
#	navigation/navigation-compose/src/commonMain/kotlin/androidx/navigation/compose/DialogNavigator.kt
#	navigation/navigation-runtime/src/commonMain/kotlin/androidx/navigation/NavControllerViewModel.kt
#	navigation/navigation-runtime/src/jbMain/kotlin/androidx/navigation/NavControllerViewModel.jb.kt
igordmn pushed a commit that referenced this pull request Apr 10, 2025
# Conflicts:
#	buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt
#	compose/foundation/foundation/src/skikoTest/kotlin/test/IgnoreTargets.kt
#	compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt
#	gradle/libs.versions.toml
#	navigation/navigation-compose/api/desktop/navigation-compose.api
#	navigation/navigation-compose/build.gradle
#	navigation/navigation-compose/src/commonMain/kotlin/androidx/navigation/compose/DialogNavigator.kt
#	navigation/navigation-runtime/src/commonMain/kotlin/androidx/navigation/NavControllerViewModel.kt
#	navigation/navigation-runtime/src/jbMain/kotlin/androidx/navigation/NavControllerViewModel.jb.kt
igordmn pushed a commit that referenced this pull request Apr 11, 2025
# Conflicts:
#	buildSrc/private/src/main/kotlin/androidx/build/AndroidXMultiplatformExtension.kt
#	compose/foundation/foundation/src/skikoTest/kotlin/test/IgnoreTargets.kt
#	compose/runtime/runtime/src/nonEmulatorCommonTest/kotlin/androidx/compose/runtime/snapshots/SnapshotStateMapTests.kt
#	gradle/libs.versions.toml
#	navigation/navigation-compose/api/desktop/navigation-compose.api
#	navigation/navigation-compose/build.gradle
#	navigation/navigation-compose/src/commonMain/kotlin/androidx/navigation/compose/DialogNavigator.kt
#	navigation/navigation-runtime/src/commonMain/kotlin/androidx/navigation/NavControllerViewModel.kt
#	navigation/navigation-runtime/src/jbMain/kotlin/androidx/navigation/NavControllerViewModel.jb.kt
igordmn added a commit that referenced this pull request Apr 11, 2025
Fixes
https://youtrack.jetbrains.com/issue/CMP-7918/Inconsistent-source-with-NavigationSuiteScaffold-in-1.8.0-beta01

Continuation of
#1868

There are more folders that also use Material3 version:
```
git checkout --no-overlay v1.7.3 -- compose/material3/material3-window-size-class
git checkout --no-overlay v1.7.3 -- compose/material3/material3-common
git checkout --no-overlay v1.7.3 -- compose/material3/material3-adaptive-navigation-suite
```

From:
```
$ git log origin/jb-main --not v1.7.3 --not origin/integration --not aosp/androidx-main --oneline -- compose/material3/material3-adaptive-navigation-suite
a75f494 Merge branch 'jb-main' into integration
3e4c674 Support API dumping for Klibs (#1947)
c1a20ec Merge branch 'jb-main' into integration
0edb57f Depend on collection/annotation `project` instead of an artifact (#1945)
e3e9ddc Merge commit '7a145e052ae61e272e91ffe285e9451b8ab71870' into integration
a273606 (tag: v1.8.0+dev2134) Fix Compose usage in non-Gradle Desktop projects (#1872)
4818376 Copy compose-material3 from e545e49
de5792a Copy compose-material3 from 1469382
f56f6e7 Update kotlin version to 2.1.0 (#1778)
330c557 Copy compose-material3 from fccc3e0
b6eba02 (tag: v1.8.0-alpha01, tag: v1.8.0+dev1955) Set the default version to 9999.0.0-SNAPSHOT, pin all dependencies (#1696)
38bd05f Copy compose-material3 from 0c5014a

$ git log origin/jb-main --not v1.7.3 --not origin/integration --not aosp/androidx-main --oneline -- compose/material3/material3-common
47911ee Restore stubs from commit '78132378b67c86698d1ade3dc368c9f15d738a71' to avoid conflicts
a75f494 Merge branch 'jb-main' into integration
3e4c674 Support API dumping for Klibs (#1947)
e3e9ddc Merge commit '7a145e052ae61e272e91ffe285e9451b8ab71870' into integration
a273606 (tag: v1.8.0+dev2134) Fix Compose usage in non-Gradle Desktop projects (#1872)
551007f Reimplement js and was identityHashCode family of implementations with WeakMap (#1752)
330c557 Copy compose-material3 from fccc3e0
38bd05f Copy compose-material3 from 0c5014a

$ git log origin/jb-main --not v1.7.3 --not origin/integration --not aosp/androidx-main --oneline -- compose/material3/material3-window-size-class
47911ee Restore stubs from commit '78132378b67c86698d1ade3dc368c9f15d738a71' to avoid conflicts
a75f494 Merge branch 'jb-main' into integration
3e4c674 Support API dumping for Klibs (#1947)
e3e9ddc Merge commit '7a145e052ae61e272e91ffe285e9451b8ab71870' into integration
a273606 (tag: v1.8.0+dev2134) Fix Compose usage in non-Gradle Desktop projects (#1872)
38bd05f Copy compose-material3 from 0c5014a
```
I chose to cherry-pick:
```
3e4c674 Support API dumping for Klibs (#1947)
0edb57f Depend on collection/annotation `project` instead of an artifact (#1945)
a273606 (tag: v1.8.0+dev2134) Fix Compose usage in non-Gradle Desktop projects (#1872)
f56f6e7 Update kotlin version to 2.1.0 (#1778)
b6eba02 (tag: v1.8.0-alpha01, tag: v1.8.0+dev1955) Set the default version to 9999.0.0-SNAPSHOT, pin all dependencies (#1696)
551007f Reimplement js and was identityHashCode family of implementations with WeakMap (#1752)
```

## Release Notes
### Fixes - Multiple Platforms
- _(prerelease fix)_
`org.jetbrains.compose.material3:material3-adaptive-navigation-suite`,
`org.jetbrains.compose.material3:material3-window-size-class` are
reverted to the 1.3.1 state. They will be reverted to 1.4 in CMP 1.9
with material3
MatkovIvan added a commit that referenced this pull request Apr 11, 2025
Drop 1.9 leftovers from #1778
Fixes [CMP-7975](https://youtrack.jetbrains.com/issue/CMP-7975) NPE in
K1 PsiElementNode after merging navigation 2.9.0-beta01

## Release Notes
N/A
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