Skip to content

Update to Kotlin 1.6 and enable the new memory model#299

Merged
dpad85 merged 36 commits intomasterfrom
kotlin-1.6
Oct 12, 2022
Merged

Update to Kotlin 1.6 and enable the new memory model#299
dpad85 merged 36 commits intomasterfrom
kotlin-1.6

Conversation

@dpad85
Copy link
Member

@dpad85 dpad85 commented Sep 22, 2022

This PR updates Phoenix to kotlin 1.6.21. Several dependencies are also updated:

  • secp to 0.7.0
  • lightning-kmp to 1.5+
  • ktor to 2.0.3
  • kotlinx-coroutines to 1.6.3
  • kotlinx-datetime to 0.3.2 (transitive from lightning-kmp)
  • kotlinx-serialization to 1.3.3

The Android app is affected and jetpack compose must be updated.

This pull request depends on ACINQ/lightning-kmp#370

dpad85 and others added 11 commits September 22, 2022 10:34
Compose is updated to 1.2.1 which require sdk 32.
preventFreeze() and makeShared() methods have been removed from
io.ktor.utils.io with ktor 2.0.
The old memory model based on freezing objects that moved between threads
caused a lot of issues on iOS. With the upgrade to kotlin 1.6, ktor 2.x
and coroutines 1.6 it makes sense to also move to the new model which is
much more workable than the old one.

To do so we enable an experimental flag and use the adequate kotlinx
coroutine library version.

See
https://github.com/JetBrains/kotlin/blob/master/kotlin-native/NEW_MM.md

This commit is a work in progress, because several changes are needed
for the iOS app to be fully functional. Several thread checks will have
to be removed, for example in SyncTxManager. However a lot of the app
works right away.
@dpad85 dpad85 changed the title Update to Kotlin 1.6 Update to Kotlin 1.6 and enable the new memory model Sep 23, 2022
@dpad85
Copy link
Member Author

dpad85 commented Sep 23, 2022

Latest commit enables the new kotlin Memory Model. For context, see this comment in lightning-kmp repo.

Some more changes are required before this can be merged, especially where we check what thread we're on, or when we use the freeze API (for example SyncTxManager or SqlitePaymentsDb).

Note that we do not upgrade to SQLDelight 2.0.0-alpha03 yet, because that does not seem needed for now.

@dpad85 dpad85 marked this pull request as ready for review October 10, 2022 14:40
@dpad85 dpad85 requested a review from robbiehanson October 10, 2022 14:40
@dpad85 dpad85 merged commit 5b8e498 into master Oct 12, 2022
@dpad85 dpad85 deleted the kotlin-1.6 branch October 12, 2022 13:47
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.

2 participants