Skip to content

Commit 1112cf2

Browse files
authored
Merge pull request #105 from qiaoyuang/main
Upgrade to KSP2
2 parents 3aaedad + cd51088 commit 1112cf2

File tree

33 files changed

+190
-275
lines changed

33 files changed

+190
-275
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
path: |
7171
~/.android/avd/*
7272
~/.android/adb*
73-
key: avd-34
73+
key: avd-35
7474

7575
- name: Create AVD and Generate Snapshot for Caching
7676
if: steps.avd-cache.outputs.cache-hit != 'true'
@@ -154,10 +154,10 @@ jobs:
154154
run: ./gradlew :sqllin-dsl:mingwX64MainKlibrary
155155

156156
- name: Run sqllin-dsl MinGW X64 Tests
157-
run: ./gradlew :sqllin-dsl:cleanMingwX64Test && ./gradlew :sqllin-dsl:mingwX64Test --stacktrace
157+
run: ./gradlew :sqllin-dsl-test:cleanMingwX64Test && ./gradlew :sqllin-dsl-test:mingwX64Test --stacktrace
158158

159159
- name: Run sqllin-dsl JVM Unit Tests on MinGW X64
160-
run: ./gradlew :sqllin-dsl:cleanJvmTest && ./gradlew :sqllin-dsl:jvmTest --stacktrace
160+
run: ./gradlew :sqllin-dsl-test:cleanJvmTest && ./gradlew :sqllin-dsl-test:jvmTest --stacktrace
161161

162162
- name: Upload sqllin-driver Reports
163163
uses: actions/upload-artifact@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ local.properties
1212
/sqllin-driver/build
1313
/sqllin-dsl/build
1414
/sqllin-processor/build
15+
/sqllin-dsl-test/build
1516
/sample/build
1617
*.podspec
1718
.kotlin

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
- Date format: YYYY-MM-dd
44

5+
## v1.4.3 / 2025-06-02
6+
7+
### All
8+
9+
* Update `Kotlin`'s version to `2.1.21`
10+
11+
### sqllin-processor
12+
13+
* Update `KSP`'s version to `2.1.21-2.0.1`
14+
515
## v1.4.2 / 2025-04-23
616

717
### All

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
VERSION=1.4.2
1+
VERSION=1.4.3
22
GROUP=com.ctrip.kotlin
33

4-
#Maven Publish Information
4+
#Maven Publishing Information
55
githubURL=https://github.com/ctripcorp/SQLlin
66
licenseName=The Apache License, Version 2.0
77
licenseURL=https://www.apache.org/licenses/LICENSE-2.0.txt

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[versions]
22

3-
kotlin = "2.1.20"
4-
agp = "8.9.2"
5-
ksp = "2.1.20-1.0.32"
3+
kotlin = "2.1.21"
4+
agp = "8.9.3"
5+
ksp = "2.1.21-2.0.1"
66
serialization = "1.8.1"
77
coroutines = "1.10.2"
88
androidx-annotation = "1.9.1"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Tue Mar 08 15:11:46 CST 2022
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.1-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ rootProject.name = "SQLlin"
22
include(":sqllin-driver")
33
include(":sqllin-dsl")
44
include(":sqllin-processor")
5+
include(":sqllin-dsl-test")
56
include(":sample")
67

78
pluginManagement {

sqllin-dsl-test/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Test Module for _sqllin-dsl_
2+
3+
中文版请见[这里](README_CN.md)
4+
5+
>**Note: This is not an unit test tool for _sqllin-dsl_, it's the main implementations of unit tests for _sqllin-dsl_. Due to KSP doesn't support generating code for `commonTest` at the moment, I put all code of _sqllin-dsl_'s unit tests in this module.**

sqllin-dsl-test/README_CN.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# _sqllin-dsl_ 的测试模块
2+
3+
>**注意:这不是 _sqllin-dsl_ 的单元测试工具,而是 _sqllin-dsl_ 单元测试的主要实现。由于 KSP 当前不支持为 `commonTest` 生成代码,因此我将 _sqllin-dsl_ 的单元测试的所有代码都放在了本模块中。**

sqllin-dsl-test/build.gradle.kts

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
2+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
3+
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
4+
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
5+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
6+
import org.jetbrains.kotlin.konan.target.HostManager
7+
import kotlin.collections.plusAssign
8+
9+
plugins {
10+
alias(libs.plugins.kotlin.multiplatform)
11+
alias(libs.plugins.kotlinx.serialization)
12+
alias(libs.plugins.android.library)
13+
alias(libs.plugins.ksp)
14+
}
15+
16+
version = "1.0"
17+
18+
@OptIn(ExperimentalKotlinGradlePluginApi::class)
19+
kotlin {
20+
jvmToolchain(21)
21+
androidTarget {
22+
publishLibraryVariants("release")
23+
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
24+
}
25+
26+
jvm {
27+
compilerOptions.jvmTarget.set(JvmTarget.JVM_11)
28+
}
29+
30+
listOf(
31+
iosX64(),
32+
iosArm64(),
33+
iosSimulatorArm64(),
34+
35+
macosX64(),
36+
macosArm64(),
37+
38+
watchosArm32(),
39+
watchosArm64(),
40+
watchosX64(),
41+
watchosSimulatorArm64(),
42+
watchosDeviceArm64(),
43+
44+
tvosArm64(),
45+
tvosX64(),
46+
tvosSimulatorArm64(),
47+
48+
linuxX64(),
49+
linuxArm64(),
50+
51+
mingwX64(),
52+
).forEach {
53+
it.setupNativeConfig()
54+
}
55+
56+
compilerOptions {
57+
freeCompilerArgs.add("-Xexpect-actual-classes")
58+
}
59+
60+
sourceSets {
61+
all {
62+
languageSettings.optIn("kotlin.RequiresOptIn")
63+
}
64+
commonMain {
65+
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
66+
dependencies {
67+
implementation(project(":sqllin-dsl"))
68+
implementation(libs.kotlinx.serialization)
69+
implementation(libs.kotlinx.coroutines)
70+
}
71+
}
72+
commonTest.dependencies {
73+
implementation(kotlin("test"))
74+
}
75+
androidInstrumentedTest {
76+
dependencies {
77+
implementation(libs.androidx.test.core)
78+
implementation(libs.androidx.test.runner)
79+
implementation(libs.androidx.test.rules)
80+
}
81+
}
82+
}
83+
}
84+
85+
android {
86+
namespace = "com.ctrip.sqllin.dsl.test"
87+
compileSdk = 35
88+
defaultConfig {
89+
minSdk = 23
90+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
91+
}
92+
compileOptions {
93+
isCoreLibraryDesugaringEnabled = true
94+
}
95+
}
96+
97+
fun KotlinNativeTarget.setupNativeConfig() {
98+
binaries {
99+
all {
100+
linkerOpts += when {
101+
HostManager.hostIsLinux -> listOf("-lsqlite3", "-L$rootDir/libs/linux", "-L/usr/lib/x86_64-linux-gnu", "-L/usr/lib", "-L/usr/lib64")
102+
HostManager.hostIsMingw -> listOf("-Lc:\\msys64\\mingw64\\lib", "-L$rootDir\\libs\\windows", "-lsqlite3")
103+
else -> listOf("-lsqlite3")
104+
}
105+
}
106+
}
107+
}
108+
109+
dependencies {
110+
coreLibraryDesugaring(libs.desugar.jdk.libs)
111+
add("kspCommonMainMetadata", project(":sqllin-processor"))
112+
}
113+
114+
afterEvaluate { // WORKAROUND: both register() and named() fail – https://github.com/gradle/gradle/issues/9331
115+
tasks {
116+
withType<KotlinCompilationTask<*>> {
117+
if (name != "kspCommonMainKotlinMetadata")
118+
dependsOn("kspCommonMainKotlinMetadata")
119+
}
120+
}
121+
}

sqllin-dsl/src/androidInstrumentedTest/kotlin/com/ctrip/sqllin/dsl/AndroidTest.kt renamed to sqllin-dsl-test/src/androidInstrumentedTest/kotlin/com/ctrip/sqllin/dsl/test/AndroidTest.kt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
1-
/*
2-
* Copyright (C) 2022 Ctrip.com.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
17-
package com.ctrip.sqllin.dsl
1+
package com.ctrip.sqllin.dsl.test
182

193
import android.content.Context
204
import androidx.test.core.app.ApplicationProvider
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest package="com.ctrip.sqllin.dsl.test" />

sqllin-dsl/src/appleTest/kotlin/com/ctrip/sqllin/dsl/PlatformApple.kt renamed to sqllin-dsl-test/src/appleTest/kotlin/com/ctrip/sqllin/dsl/test/PlatformApple.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
import kotlinx.cinterop.UnsafeNumber
2020
import platform.Foundation.NSDocumentDirectory

sqllin-dsl/src/commonTestCode/kotlin/com/ctrip/sqllin/dsl/Entities.kt renamed to sqllin-dsl-test/src/commonMain/kotlin/com/ctrip/sqllin/dsl/test/Entities.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
import com.ctrip.sqllin.dsl.annotation.DBRow
2020
import kotlinx.serialization.Serializable

sqllin-dsl/src/commonTestCode/kotlin/com/ctrip/sqllin/dsl/TestPrimitiveTypeForKSP.kt renamed to sqllin-dsl-test/src/commonMain/kotlin/com/ctrip/sqllin/dsl/test/TestPrimitiveTypeForKSP.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
import com.ctrip.sqllin.dsl.annotation.DBRow
2020
import kotlinx.serialization.Serializable

sqllin-dsl/src/commonTestCode/kotlin/com/ctrip/sqllin/dsl/CommonBasicTest.kt renamed to sqllin-dsl-test/src/commonTest/kotlin/com/ctrip/sqllin/dsl/test/CommonBasicTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
import com.ctrip.sqllin.driver.DatabaseConfiguration
2020
import com.ctrip.sqllin.driver.DatabasePath
21+
import com.ctrip.sqllin.dsl.Database
2122
import com.ctrip.sqllin.dsl.sql.X
2223
import com.ctrip.sqllin.dsl.sql.clause.*
2324
import com.ctrip.sqllin.dsl.sql.clause.OrderByWay.ASC

sqllin-dsl/src/jvmTest/kotlin/com/ctrip/sqllin/dsl/JvmTest.kt renamed to sqllin-dsl-test/src/jvmTest/kotlin/com/ctrip/sqllin/dsl/test/JvmTest.kt

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
1-
/*
2-
* Copyright (C) 2023 Ctrip.com.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
17-
package com.ctrip.sqllin.dsl
1+
package com.ctrip.sqllin.dsl.test
182

193
import com.ctrip.sqllin.driver.deleteDatabase
204
import com.ctrip.sqllin.driver.toDatabasePath

sqllin-dsl/src/linuxTest/kotlin/com/ctrip/sqllin/dsl/PlatformLinux.kt renamed to sqllin-dsl-test/src/linuxTest/kotlin/com/ctrip/sqllin/dsl/test/PlatformLinux.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
import kotlinx.cinterop.ExperimentalForeignApi
2020
import kotlinx.cinterop.toKString

sqllin-dsl/src/mingwTest/kotlin/com/ctrip/sqllin/dsl/PlatformMingw.kt renamed to sqllin-dsl-test/src/mingwTest/kotlin/com/ctrip/sqllin/dsl/test/PlatformMingw.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
import kotlinx.cinterop.*
2020
import platform.posix._wgetcwd

sqllin-dsl/src/nativeTestCode/kotlin/com/ctrip/sqllin/dsl/NativeTest.kt renamed to sqllin-dsl-test/src/nativeTest/kotlin/com/ctrip/sqllin/dsl/test/NativeTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
import com.ctrip.sqllin.driver.deleteDatabase
2020
import com.ctrip.sqllin.driver.toDatabasePath

sqllin-dsl/src/nativeTest/kotlin/com/ctrip/sqllin/dsl/Platform.kt renamed to sqllin-dsl-test/src/nativeTest/kotlin/com/ctrip/sqllin/dsl/test/Platform.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.ctrip.sqllin.dsl
17+
package com.ctrip.sqllin.dsl.test
1818

1919
/**
2020
* Some platform-related functions

0 commit comments

Comments
 (0)