diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ea5c9a9..a38b7e3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Build & Test & Publish +name: Build & Publish on: workflow_dispatch: diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dfb3cf..52a3265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,21 @@ - Date format: YYYY-MM-dd +## 2.0.0 / 2025-10-xx + +### All + +* Update `Kotlin`'s version to `2.2.20` +* Remove the Desuger configuration + +### sqllin-driver + +* Update the `sqlite-jdbc`'s version to `3.50.3.0` + +### sqllin-processor + +* Update `KSP`'s version to `2.2.20-2.0.4` + ## 1.4.4 / 2025-07-07 ### All diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index aaafc87..b5c76d2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,26 +1,26 @@ [versions] -kotlin = "2.2.0" -agp = "8.10.1" -ksp = "2.2.0-2.0.2" +kotlin = "2.2.20" +agp = "8.12.3" +ksp = "2.2.20-2.0.4" serialization = "1.9.0" coroutines = "1.10.2" androidx-annotation = "1.9.1" -androidx-test = "1.6.1" -androidx-test-runner = "1.6.2" -sqlite-jdbc = "3.50.2.0" -desugar-jdk-libs = "2.1.5" +androidx-test = "1.7.0" +androidx-test-runner = "1.7.0" +sqlite-jdbc = "3.50.3.0" jvm-toolchain = "21" android-sdk-compile = "36" android-sdk-min = "23" -vanniktech-maven-publish = "0.33.0" +vanniktech-maven-publish = "0.34.0" [libraries] ksp = { group = "com.google.devtools.ksp", name= "symbol-processing-api", version.ref = "ksp" } kotlinx-serialization = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-core", version.ref = "serialization" } -kotlinx-coroutines = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } +kotlinx-coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" } +kotlinx-coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines" } androidx-annotation = { group = "androidx.annotation", name = "annotation", version.ref = "androidx-annotation" } androidx-test-core = { group = "androidx.test", name = "core", version.ref = "androidx-test" } @@ -29,8 +29,6 @@ androidx-test-rules = { group = "androidx.test", name = "rules", version.ref = " sqlite-jdbc = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite-jdbc" } -desugar-jdk-libs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "desugar-jdk-libs" } - [plugins] kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index 59a260f..0c9ab93 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -35,7 +35,7 @@ kotlin { dependencies { implementation(project(":sqllin-dsl")) implementation(libs.kotlinx.serialization) - implementation(libs.kotlinx.coroutines) + implementation(libs.kotlinx.coroutines.core) } } } @@ -47,13 +47,9 @@ android { defaultConfig { minSdk = libs.versions.android.sdk.min.get().toInt() } - compileOptions { - isCoreLibraryDesugaringEnabled = true - } } dependencies { - coreLibraryDesugaring(libs.desugar.jdk.libs) add("kspCommonMainMetadata", project(":sqllin-processor")) } diff --git a/sqllin-driver/build.gradle.kts b/sqllin-driver/build.gradle.kts index c21185d..b5184c4 100644 --- a/sqllin-driver/build.gradle.kts +++ b/sqllin-driver/build.gradle.kts @@ -67,7 +67,8 @@ kotlin { } commonTest.dependencies { implementation(kotlin("test")) - implementation(libs.kotlinx.coroutines) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.kotlinx.coroutines.test) } androidMain.dependencies { implementation(libs.androidx.annotation) @@ -105,9 +106,6 @@ android { minSdk = libs.versions.android.sdk.min.get().toInt() testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } - compileOptions { - isCoreLibraryDesugaringEnabled = true - } } fun KotlinNativeTarget.setupNativeConfig() { @@ -124,10 +122,6 @@ fun KotlinNativeTarget.setupNativeConfig() { } } -dependencies { - coreLibraryDesugaring(libs.desugar.jdk.libs) -} - mavenPublishing { publishToMavenCentral() signAllPublications() diff --git a/sqllin-driver/src/commonTest/kotlin/com/ctrip/sqllin/driver/CommonBasicTest.kt b/sqllin-driver/src/commonTest/kotlin/com/ctrip/sqllin/driver/CommonBasicTest.kt index 6b44705..0edcdb5 100644 --- a/sqllin-driver/src/commonTest/kotlin/com/ctrip/sqllin/driver/CommonBasicTest.kt +++ b/sqllin-driver/src/commonTest/kotlin/com/ctrip/sqllin/driver/CommonBasicTest.kt @@ -17,6 +17,7 @@ package com.ctrip.sqllin.driver import kotlinx.coroutines.* +import kotlinx.coroutines.test.runTest import kotlin.test.assertEquals /** @@ -194,7 +195,7 @@ class CommonBasicTest(private val path: DatabasePath) { } @OptIn(DelicateCoroutinesApi::class, ExperimentalCoroutinesApi::class) - fun testConcurrency() = runBlocking { + fun testConcurrency() = runTest { val readWriteConfig = getDefaultDBConfig(false) openDatabase(readWriteConfig) { launch(newSingleThreadContext("test0")) { diff --git a/sqllin-dsl-test/build.gradle.kts b/sqllin-dsl-test/build.gradle.kts index f858304..b8a42bc 100644 --- a/sqllin-dsl-test/build.gradle.kts +++ b/sqllin-dsl-test/build.gradle.kts @@ -66,11 +66,12 @@ kotlin { dependencies { implementation(project(":sqllin-dsl")) implementation(libs.kotlinx.serialization) - implementation(libs.kotlinx.coroutines) + implementation(libs.kotlinx.coroutines.core) } } commonTest.dependencies { implementation(kotlin("test")) + implementation(libs.kotlinx.coroutines.test) } androidInstrumentedTest { dependencies { @@ -89,9 +90,6 @@ android { minSdk = libs.versions.android.sdk.min.get().toInt() testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } - compileOptions { - isCoreLibraryDesugaringEnabled = true - } } fun KotlinNativeTarget.setupNativeConfig() { @@ -107,7 +105,6 @@ fun KotlinNativeTarget.setupNativeConfig() { } dependencies { - coreLibraryDesugaring(libs.desugar.jdk.libs) add("kspCommonMainMetadata", project(":sqllin-processor")) } diff --git a/sqllin-dsl-test/src/commonTest/kotlin/com/ctrip/sqllin/dsl/test/CommonBasicTest.kt b/sqllin-dsl-test/src/commonTest/kotlin/com/ctrip/sqllin/dsl/test/CommonBasicTest.kt index 89972fd..76f42b0 100644 --- a/sqllin-dsl-test/src/commonTest/kotlin/com/ctrip/sqllin/dsl/test/CommonBasicTest.kt +++ b/sqllin-dsl-test/src/commonTest/kotlin/com/ctrip/sqllin/dsl/test/CommonBasicTest.kt @@ -24,9 +24,11 @@ import com.ctrip.sqllin.dsl.sql.clause.* import com.ctrip.sqllin.dsl.sql.clause.OrderByWay.ASC import com.ctrip.sqllin.dsl.sql.clause.OrderByWay.DESC import com.ctrip.sqllin.dsl.sql.statement.SelectStatement -import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.DelicateCoroutinesApi +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.launch -import kotlinx.coroutines.runBlocking +import kotlinx.coroutines.newSingleThreadContext +import kotlinx.coroutines.test.runTest import kotlin.test.assertEquals import kotlin.test.assertNotEquals @@ -77,7 +79,7 @@ class CommonBasicTest(private val path: DatabasePath) { } } assertEquals(true, statement!!.getResults().any { it == book1 }) - assertEquals(true, statement!!.getResults().any { it == book2 }) + assertEquals(true, statement.getResults().any { it == book2 }) var statement1: SelectStatement? = null var statement2: SelectStatement? = null @@ -105,7 +107,7 @@ class CommonBasicTest(private val path: DatabasePath) { } assertEquals(true, statement!!.getResults().any { it == book1 }) - assertEquals(true, statement!!.getResults().any { it == book2 }) + assertEquals(true, statement.getResults().any { it == book2 }) val book1NewPrice = 18.96 val book2NewPrice = 21.95 @@ -124,7 +126,7 @@ class CommonBasicTest(private val path: DatabasePath) { } assertEquals(true, newResult!!.getResults().any { it == newBook1 }) - assertEquals(true, newResult!!.getResults().any { it == newBook2 }) + assertEquals(true, newResult.getResults().any { it == newBook2 }) } fun testSelectWhereClause() = Database(getDefaultDBConfig(), true).databaseAutoClose { database -> @@ -281,10 +283,10 @@ class CommonBasicTest(private val path: DatabasePath) { } } assertEquals(7, statement!!.getResults().size) - assertEquals(2, statement!!.getResults().count { it == book0 }) - assertEquals(2, statement!!.getResults().count { it == book1 }) - assertEquals(1, statement!!.getResults().count { it == book2 }) - assertEquals(2, statement!!.getResults().count { it == book3 }) + assertEquals(2, statement.getResults().count { it == book0 }) + assertEquals(2, statement.getResults().count { it == book1 }) + assertEquals(1, statement.getResults().count { it == book2 }) + assertEquals(2, statement.getResults().count { it == book3 }) } fun testFunction() = Database(getDefaultDBConfig(), true).databaseAutoClose { database -> @@ -370,11 +372,12 @@ class CommonBasicTest(private val path: DatabasePath) { assertEquals(outerJoinStatementWithOn?.getResults()?.size, books.size) } + @OptIn(DelicateCoroutinesApi::class, ExperimentalCoroutinesApi::class) fun testConcurrency() = Database(getDefaultDBConfig(), true).databaseAutoClose { database -> - runBlocking(Dispatchers.Default) { + runTest { val book1 = Book(name = "The Da Vinci Code", author = "Dan Brown", pages = 454, price = 16.96) val book2 = Book(name = "The Lost Symbol", author = "Dan Brown", pages = 510, price = 19.95) - launch { + launch(newSingleThreadContext("test0")) { lateinit var statement: SelectStatement database suspendedScope { statement = BookTable { table -> @@ -385,7 +388,7 @@ class CommonBasicTest(private val path: DatabasePath) { assertEquals(true, statement.getResults().any { it == book1 }) assertEquals(true, statement.getResults().any { it == book2 }) } - launch { + launch(newSingleThreadContext("test1")) { val book1NewPrice = 18.96 val book2NewPrice = 21.95 val newBook1 = Book(name = "The Da Vinci Code", author = "Dan Brown", pages = 454, price = book1NewPrice) @@ -407,7 +410,7 @@ class CommonBasicTest(private val path: DatabasePath) { fun testPrimitiveTypeForKSP() { TestPrimitiveTypeForKSPTable { - SET { + SET { assertEquals(0, testInt) assertEquals(0L, testLong) assertEquals(0, testShort) diff --git a/sqllin-dsl-test/src/jvmTest/kotlin/com/ctrip/sqllin/dsl/test/JvmTest.kt b/sqllin-dsl-test/src/jvmTest/kotlin/com/ctrip/sqllin/dsl/test/JvmTest.kt index b8ae245..1f630d8 100644 --- a/sqllin-dsl-test/src/jvmTest/kotlin/com/ctrip/sqllin/dsl/test/JvmTest.kt +++ b/sqllin-dsl-test/src/jvmTest/kotlin/com/ctrip/sqllin/dsl/test/JvmTest.kt @@ -46,6 +46,9 @@ class JvmTest { @Test fun testJoinClause() = commonTest.testJoinClause() + @Test + fun testConcurrency() = commonTest.testConcurrency() + @Test fun testPrimitiveTypeForKSP() = commonTest.testPrimitiveTypeForKSP() diff --git a/sqllin-dsl/build.gradle.kts b/sqllin-dsl/build.gradle.kts index dcbdb26..1c416a3 100644 --- a/sqllin-dsl/build.gradle.kts +++ b/sqllin-dsl/build.gradle.kts @@ -61,7 +61,7 @@ kotlin { commonMain.dependencies { api(project(":sqllin-driver")) implementation(libs.kotlinx.serialization) - implementation(libs.kotlinx.coroutines) + implementation(libs.kotlinx.coroutines.core) } } } @@ -87,13 +87,6 @@ android { defaultConfig { minSdk = libs.versions.android.sdk.min.get().toInt() } - compileOptions { - isCoreLibraryDesugaringEnabled = true - } -} - -dependencies { - coreLibraryDesugaring(libs.desugar.jdk.libs) } mavenPublishing {