diff --git a/CHANGELOG.md b/CHANGELOG.md index ef9fb1e4..db22f357 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ * Android: Ensure JNI libraries are 16KB-aligned. * Support receiving binary sync lines over HTTP when the Rust client is enabled. * Remove the experimental websocket transport mode. +* Update to Kotlin 2.2.0. +* Migrate to `kotlin.time` APIs where appropriate. ## 1.3.0 diff --git a/PowerSyncKotlin/build.gradle.kts b/PowerSyncKotlin/build.gradle.kts index 850c46ba..9b5c0f68 100644 --- a/PowerSyncKotlin/build.gradle.kts +++ b/PowerSyncKotlin/build.gradle.kts @@ -50,26 +50,6 @@ kotlin { } } -repositories { - maven { - name = "PowerSyncSQLiterFork" - url = uri("https://powersync-ja.github.io/SQLiter") - content { - includeModuleByRegex("co.touchlab", "sqliter-driver.*") - } - } -} - -configurations.all { - resolutionStrategy { - // This version has not been released yet (https://github.com/touchlab/SQLiter/pull/124), so we're pointing this - // towards our fork with the repositories block above. - // The API is identical, but we have to make sure this particular project builds the xcframework with the - // patched SQLiter version to avoid linker errors on macOS. - force("co.touchlab:sqliter-driver:1.3.2-powersync") - } -} - listOf("Debug", "Release").forEach { buildType -> tasks.register("build$buildType") { group = "build" diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 994baa39..46fa7cac 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -181,6 +181,7 @@ kotlin { all { languageSettings { optIn("kotlinx.cinterop.ExperimentalForeignApi") + optIn("kotlin.time.ExperimentalTime") } } diff --git a/core/src/commonMain/kotlin/com/powersync/attachments/AttachmentQueue.kt b/core/src/commonMain/kotlin/com/powersync/attachments/AttachmentQueue.kt index b3c0d895..c0dbfa04 100644 --- a/core/src/commonMain/kotlin/com/powersync/attachments/AttachmentQueue.kt +++ b/core/src/commonMain/kotlin/com/powersync/attachments/AttachmentQueue.kt @@ -359,8 +359,7 @@ public open class AttachmentQueue( metaData = item.metaData, ), ) - } else if - (existingQueueItem.state == AttachmentState.ARCHIVED) { + } else if (existingQueueItem.state == AttachmentState.ARCHIVED) { // The attachment is present again. Need to queue it for sync. // We might be able to optimize this in future. if (existingQueueItem.hasSynced) { diff --git a/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt b/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt index de64fbad..ecf52d37 100644 --- a/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt +++ b/core/src/commonMain/kotlin/com/powersync/attachments/implementation/AttachmentContextImpl.kt @@ -7,9 +7,8 @@ import com.powersync.attachments.AttachmentContext import com.powersync.attachments.AttachmentState import com.powersync.db.getString import com.powersync.db.internal.ConnectionContext -import kotlinx.datetime.Clock -import kotlinx.serialization.encodeToString import kotlinx.serialization.json.Json +import kotlin.time.Clock /** * Default implementation of [AttachmentContext]. diff --git a/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt b/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt index 51880ee1..704cada8 100644 --- a/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt +++ b/core/src/commonMain/kotlin/com/powersync/db/PowerSyncDatabaseImpl.kt @@ -42,11 +42,11 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.launch import kotlinx.coroutines.sync.Mutex import kotlinx.coroutines.sync.withLock -import kotlinx.datetime.Instant import kotlinx.datetime.LocalDateTime import kotlinx.datetime.TimeZone import kotlinx.datetime.toInstant import kotlin.time.Duration.Companion.milliseconds +import kotlin.time.Instant /** * A PowerSync managed database. diff --git a/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt b/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt index 1fe66704..ced90401 100644 --- a/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt +++ b/core/src/commonMain/kotlin/com/powersync/sync/Instruction.kt @@ -1,7 +1,6 @@ package com.powersync.sync import com.powersync.bucket.BucketPriority -import kotlinx.datetime.Instant import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -16,6 +15,7 @@ import kotlinx.serialization.encoding.decodeStructure import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonObject import kotlinx.serialization.serializer +import kotlin.time.Instant /** * An instruction sent to this SDK by the core extension to implement sync behavior. diff --git a/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt b/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt index 06710b7a..180e1429 100644 --- a/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt +++ b/core/src/commonMain/kotlin/com/powersync/sync/SyncStatus.kt @@ -5,8 +5,8 @@ import com.powersync.connectors.PowerSyncBackendConnector import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.asSharedFlow -import kotlinx.datetime.Clock -import kotlinx.datetime.Instant +import kotlin.time.Clock +import kotlin.time.Instant @ConsistentCopyVisibility public data class PriorityStatusEntry internal constructor( diff --git a/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt b/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt index 581b147f..c1548d3f 100644 --- a/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt +++ b/core/src/commonMain/kotlin/com/powersync/sync/SyncStream.kt @@ -56,12 +56,12 @@ import kotlinx.coroutines.flow.flow import kotlinx.coroutines.flow.map import kotlinx.coroutines.launch import kotlinx.coroutines.withContext -import kotlinx.datetime.Clock import kotlinx.io.readByteArray import kotlinx.io.readIntLe import kotlinx.serialization.json.JsonElement import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.encodeToJsonElement +import kotlin.time.Clock @OptIn(ExperimentalPowerSyncAPI::class) internal class SyncStream( diff --git a/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt b/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt index 5e141e29..fe95675e 100644 --- a/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt +++ b/demos/android-supabase-todolist/app/src/main/java/com/powersync/androidexample/powersync/Todo.kt @@ -15,8 +15,10 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.launch -import kotlinx.datetime.Clock +import kotlin.time.Clock +import kotlin.time.ExperimentalTime +@OptIn(ExperimentalTime::class) internal class Todo( private val db: PowerSyncDatabase, private val attachmentsQueue: AttachmentQueue?, diff --git a/demos/android-supabase-todolist/gradle/libs.versions.toml b/demos/android-supabase-todolist/gradle/libs.versions.toml index 1a1ad84e..ee232c4c 100644 --- a/demos/android-supabase-todolist/gradle/libs.versions.toml +++ b/demos/android-supabase-todolist/gradle/libs.versions.toml @@ -1,18 +1,18 @@ [versions] -agp = "8.10.1" +agp = "8.11.1" coreSplashscreen = "1.0.1" -kotlin = "2.1.10" -coreKtx = "1.15.0" +kotlin = "2.2.0" +coreKtx = "1.16.0" junit = "4.13.2" -junitVersion = "1.2.1" -espressoCore = "3.6.1" -lifecycleRuntimeKtx = "2.8.7" +junitVersion = "1.3.0" +espressoCore = "3.7.0" +lifecycleRuntimeKtx = "2.9.2" activityCompose = "1.10.1" -composeBom = "2025.02.00" +composeBom = "2025.07.00" materialIconsExtended = "1.7.8" -uuid = "0.8.2" -kermit = "2.0.5" -sqldelight = "2.0.2" +uuid = "0.8.4" +kermit = "2.0.6" +sqldelight = "2.1.0" [libraries] androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" } diff --git a/demos/supabase-todolist/gradle/libs.versions.toml b/demos/supabase-todolist/gradle/libs.versions.toml index 5508ffe3..d77deeb3 100644 --- a/demos/supabase-todolist/gradle/libs.versions.toml +++ b/demos/supabase-todolist/gradle/libs.versions.toml @@ -4,36 +4,36 @@ android-minSdk = "24" android-targetSdk = "35" android-compileSdk = "35" java = "17" -atomicfu = "0.27.0" +atomicfu = "0.29.0" # Dependencies -kotlin = "2.1.10" -coroutines = "1.8.1" -kotlinx-datetime = "0.6.2" -kotlinx-io = "0.5.4" -ktor = "3.1.0" -sqliteJdbc = "3.45.2.0" -uuid = "0.8.2" -buildKonfig = "0.15.1" -koin-bom = "4.0.2" +kotlin = "2.2.0" +coroutines = "1.10.2" +kotlinx-datetime = "0.7.1" +kotlinx-io = "0.8.0" +ktor = "3.2.3" +sqliteJdbc = "3.50.3.0" +uuid = "0.8.4" +buildKonfig = "0.17.1" +koin-bom = "4.1.0" junit = "4.13.2" -compose = "1.6.11" -compose-preview = "1.7.8" +compose = "1.8.2" +compose-preview = "1.8.3" lifecycle = "2.8.4" # plugins -android-gradle-plugin = "8.10.1" +android-gradle-plugin = "8.11.1" # Sample - Android -androidx-core = "1.15.0" +androidx-core = "1.16.0" androidx-activity-compose = "1.10.1" -androidx-appcompat = "1.7.0" -androidx-espresso-core = "3.6.1" +androidx-appcompat = "1.7.1" +androidx-espresso-core = "3.7.0" androidx-material = "1.12.0" -androidx-test-junit = "1.2.1" +androidx-test-junit = "1.3.0" [libraries] sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqliteJdbc" } diff --git a/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt b/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt index 06cbf4ff..d014ffdc 100644 --- a/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt +++ b/demos/supabase-todolist/shared/src/commonMain/kotlin/com/powersync/demos/powersync/Todo.kt @@ -11,8 +11,10 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.launch -import kotlinx.datetime.Clock +import kotlin.time.Clock +import kotlin.time.ExperimentalTime +@OptIn(ExperimentalTime::class) internal class Todo( private val db: PowerSyncDatabase, private val userId: String? diff --git a/gradle.properties b/gradle.properties index afd254c7..0e1b740d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ kotlin.code.style=official # Gradle -org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx2048M" +org.gradle.jvmargs=-Xmx40968M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\="-Xmx4096M" org.gradle.caching=true org.gradle.configuration-cache=true # Compose diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d7282066..7e2529a8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -3,51 +3,51 @@ android-minSdk = "24" android-targetSdk = "35" android-compileSdk = "35" -configurationAnnotations = "0.9.5" +configurationAnnotations = "0.10.4" dokkaBase = "2.0.0" -gradleDownloadTask = "5.5.0" +gradleDownloadTask = "5.6.0" java = "17" idea = "243.22562.218" # Meerkat | 2024.3.1 (see https://plugins.jetbrains.com/docs/intellij/android-studio-releases-list.html) # Dependencies -kermit = "2.0.5" -kotlin = "2.1.21" -coroutines = "1.8.1" -kotlinx-datetime = "0.6.2" -kotlinx-io = "0.5.4" -ktor = "3.1.0" -uuid = "0.8.2" +kermit = "2.0.6" +kotlin = "2.2.0" +coroutines = "1.10.2" +kotlinx-datetime = "0.7.1" +kotlinx-io = "0.8.0" +ktor = "3.2.3" +uuid = "0.8.4" powersync-core = "0.4.2" sqlite-jdbc = "3.50.3.0" -sqliter = "1.3.1" -turbine = "1.2.0" +sqliter = "1.3.3" +turbine = "1.2.1" kotest = "5.9.1" -sqlDelight = "2.0.2" +sqlDelight = "2.1.0" stately = "2.1.0" -supabase = "3.0.1" +supabase = "3.2.2" junit = "4.13.2" compose = "1.6.11" -compose-preview = "1.7.8" -androidxSqlite = "2.4.0" +compose-preview = "1.8.3" +androidxSqlite = "2.5.2" # plugins -android-gradle-plugin = "8.10.1" -skie = "0.10.2" -maven-publish = "0.27.0" -download-plugin = "5.5.0" +android-gradle-plugin = "8.11.1" +skie = "0.10.5" +maven-publish = "0.34.0" +download-plugin = "5.6.0" grammarkit-composer = "0.1.12" -mokkery = "2.8.0" -kotlinter = "5.0.1" +mokkery = "2.9.0" +kotlinter = "5.1.1" keeper = "0.16.1" -atomicfu = "0.27.0" +atomicfu = "0.29.0" # Sample - Android -androidx-core = "1.15.0" +androidx-core = "1.16.0" androidx-activity-compose = "1.10.1" -androidx-appcompat = "1.7.0" +androidx-appcompat = "1.7.1" androidx-espresso-core = "3.6.1" androidx-material = "1.12.0" androidx-test-runner = "1.6.2" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index cea7a793..d4081da4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME