Skip to content

Commit d85c713

Browse files
authored
Merge pull request #59 from qiaoyuang/main
Update the version to 1.2.2
2 parents ee2b759 + bfbc5e3 commit d85c713

File tree

17 files changed

+92
-35
lines changed

17 files changed

+92
-35
lines changed

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
- Date format: YYYY-MM-dd
44

5-
## v1.2.2 / 2023-xx-xx
5+
## v1.2.2 / 2023-11-08
66

77
### All
88

@@ -22,6 +22,7 @@
2222
### sqllin-processor
2323

2424
* Update `KSP`'s version to `1.9.20-1.0.13`
25+
* Fix the bug for when the code that is generated by `sqllin-processor` can't be compiled([#58](https://github.com/ctripcorp/SQLlin/pull/58))
2526

2627
## v1.2.1 / 2023-10-18
2728

build.gradle.kts

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
dependencies {
88
val kotlinVersion: String by project
99
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
10-
classpath("com.android.tools.build:gradle:7.4.2")
10+
classpath("com.android.tools.build:gradle:8.1.2")
1111
}
1212
}
1313

@@ -16,8 +16,4 @@ allprojects {
1616
google()
1717
mavenCentral()
1818
}
19-
}
20-
21-
tasks.register("clean", Delete::class) {
22-
delete(rootProject.buildDir)
2319
}

gradle.properties

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=1.2.1
1+
VERSION=1.2.2
22
GROUP=com.ctrip.kotlin
33

44
kotlinVersion=1.9.20
@@ -25,11 +25,10 @@ org.gradle.caching=true
2525
#Android
2626
android.useAndroidX=true
2727
android.enableJetifier=true
28-
android.disableAutomaticComponentCreation=true
2928

3029
#Kotlin
3130
kotlin.code.style=official
3231
kotlin.mpp.stability.nowarn=true
3332
kotlin.mpp.enableCInteropCommonization=true
3433
kotlin.natvie.increment=true
35-
#kotlin.compiler.execution.strategy=out-of-process
34+
#kotlin.compiler.execution.strategy=out-of-process
+2-2
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-7.6.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
6-
zipStoreBase=GRADLE_USER_HOME
6+
zipStoreBase=GRADLE_USER_HOME

sqllin-driver/build.gradle.kts

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
22
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
33
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
4-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
54
import org.jetbrains.kotlin.konan.target.HostManager
65

76
plugins {
@@ -58,6 +57,14 @@ kotlin {
5857
).forEach {
5958
it.setupNativeConfig()
6059
}
60+
61+
targets.configureEach {
62+
compilations.configureEach {
63+
compilerOptions.configure {
64+
freeCompilerArgs.add("-Xexpect-actual-classes")
65+
}
66+
}
67+
}
6168

6269
sourceSets {
6370
all {
@@ -181,8 +188,4 @@ publishing {
181188
useInMemoryPgpKeys(SIGNING_KEY_ID, SIGNING_KEY, SIGNING_PASSWORD)
182189
sign(publishing.publications)
183190
}
184-
}
185-
186-
tasks.withType<KotlinCompile> {
187-
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
188191
}

sqllin-dsl/build.gradle.kts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
22
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
33
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
4-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
54
import org.jetbrains.kotlin.konan.target.HostManager
65

76
plugins {
@@ -60,6 +59,14 @@ kotlin {
6059
).forEach {
6160
it.setupNativeConfig()
6261
}
62+
63+
targets.configureEach {
64+
compilations.configureEach {
65+
compilerOptions.configure {
66+
freeCompilerArgs.add("-Xexpect-actual-classes")
67+
}
68+
}
69+
}
6370

6471
sourceSets {
6572
all {
@@ -113,9 +120,6 @@ android {
113120
}
114121

115122
fun KotlinNativeTarget.setupNativeConfig() {
116-
val compileArgs = listOf("-Xruntime-logs=gc=info")
117-
compilations["main"].kotlinOptions.freeCompilerArgs += compileArgs
118-
compilations["test"].kotlinOptions.freeCompilerArgs += compileArgs
119123
binaries {
120124
all {
121125
linkerOpts += when {
@@ -215,8 +219,4 @@ publishing {
215219
useInMemoryPgpKeys(SIGNING_KEY_ID, SIGNING_KEY, SIGNING_PASSWORD)
216220
sign(publishing.publications)
217221
}
218-
}
219-
220-
tasks.withType<KotlinCompile> {
221-
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
222222
}

sqllin-dsl/doc/getting-start-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ plugins {
1414
id("com.google.devtools.ksp")
1515
}
1616

17-
val sqllinVersion = "1.2.1"
17+
val sqllinVersion = "1.2.2"
1818

1919
kotlin {
2020
// ......

sqllin-dsl/doc/getting-start.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ plugins {
1616
id("com.google.devtools.ksp")
1717
}
1818

19-
val sqllinVersion = "1.2.1"
19+
val sqllinVersion = "1.2.2"
2020

2121
kotlin {
2222
// ......

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

+3
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ class AndroidTest {
7171
@Test
7272
fun testConcurrency() = commonTest.testConcurrency()
7373

74+
@Test
75+
fun testPrimitiveTypeForKSP() = commonTest.testPrimitiveTypeForKSP()
76+
7477
@Before
7578
fun setUp() {
7679
val context = InstrumentationRegistry.getInstrumentation().targetContext

sqllin-dsl/src/commonMain/kotlin/com/ctrip/sqllin/dsl/sql/clause/BaseJoinClause.kt

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public sealed class JoinClause<R>(vararg tables: Table<*>) : BaseJoinClause<R>(*
4747
public infix fun <R> JoinStatementWithoutCondition<R>.ON(condition: SelectCondition): JoinSelectStatement<R> =
4848
convertToJoinSelectStatement(condition)
4949

50+
@Suppress("NOTHING_TO_INLINE")
5051
public inline infix fun <R> JoinStatementWithoutCondition<R>.USING(clauseElement: ClauseElement): JoinSelectStatement<R> =
5152
USING(listOf(clauseElement))
5253

sqllin-dsl/src/commonMain/kotlin/com/ctrip/sqllin/dsl/sql/clause/InnerJoinClause.kt

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ internal class InnerJoinClause<R>(
3232

3333
public fun <R> JOIN(vararg tables: Table<*>): JoinClause<R> = InnerJoinClause(*tables)
3434

35+
@Suppress("NOTHING_TO_INLINE")
3536
public inline fun <R> INNER_JOIN(vararg tables: Table<*>): JoinClause<R> = JOIN(*tables)
3637

3738
internal class NaturalInnerJoinClause<R>(
@@ -43,4 +44,5 @@ internal class NaturalInnerJoinClause<R>(
4344

4445
public fun <R> NATURAL_JOIN(vararg tables: Table<*>): NaturalJoinClause<R> = NaturalInnerJoinClause(*tables)
4546

47+
@Suppress("NOTHING_TO_INLINE")
4648
public inline fun <R> NATURAL_INNER_JOIN(vararg tables: Table<*>): NaturalJoinClause<R> = NATURAL_JOIN(*tables)

sqllin-dsl/src/commonMain/kotlin/com/ctrip/sqllin/dsl/sql/clause/OrderByClause.kt

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public enum class OrderByWay(internal val str: String) {
5252
public fun <T> ORDER_BY(vararg column2Ways: Pair<ClauseElement, OrderByWay>): OrderByClause<T> =
5353
OrderByClause(mapOf(*column2Ways))
5454

55+
@Suppress("NOTHING_TO_INLINE")
5556
public inline infix fun <T> WhereSelectStatement<T>.ORDER_BY(column2Way: Pair<ClauseElement, OrderByWay>): OrderBySelectStatement<T> =
5657
ORDER_BY(mapOf(column2Way))
5758

@@ -60,6 +61,7 @@ public infix fun <T> WhereSelectStatement<T>.ORDER_BY(column2WayMap: Map<ClauseE
6061
container changeLastStatement it
6162
}
6263

64+
@Suppress("NOTHING_TO_INLINE")
6365
public inline infix fun <T> HavingSelectStatement<T>.ORDER_BY(column2Way: Pair<ClauseElement, OrderByWay>): OrderBySelectStatement<T> =
6466
ORDER_BY(mapOf(column2Way))
6567

@@ -68,6 +70,7 @@ public infix fun <T> HavingSelectStatement<T>.ORDER_BY(column2WayMap: Map<Clause
6870
container changeLastStatement it
6971
}
7072

73+
@Suppress("NOTHING_TO_INLINE")
7174
public inline infix fun <T> GroupBySelectStatement<T>.ORDER_BY(column2Way: Pair<ClauseElement, OrderByWay>): OrderBySelectStatement<T> =
7275
ORDER_BY(mapOf(column2Way))
7376

@@ -76,6 +79,7 @@ public infix fun <T> GroupBySelectStatement<T>.ORDER_BY(column2WayMap: Map<Claus
7679
container changeLastStatement it
7780
}
7881

82+
@Suppress("NOTHING_TO_INLINE")
7983
public inline infix fun <T> JoinSelectStatement<T>.ORDER_BY(column2Way: Pair<ClauseElement, OrderByWay>): OrderBySelectStatement<T> =
8084
ORDER_BY(mapOf(column2Way))
8185

sqllin-dsl/src/commonTest/kotlin/com/ctrip/sqllin/dsl/CommonBasicTest.kt

+20
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,26 @@ class CommonBasicTest(private val path: DatabasePath) {
384384
Unit
385385
}
386386

387+
fun testPrimitiveTypeForKSP() {
388+
TestPrimitiveTypeForKSPTable {
389+
SET<TestPrimitiveTypeForKSP> {
390+
assertEquals(0, testInt)
391+
assertEquals(0L, testLong)
392+
assertEquals(0, testShort)
393+
assertEquals(0, testByte)
394+
assertEquals(0F, testFloat)
395+
assertEquals(0.0, testDouble)
396+
assertEquals(0U, testUInt)
397+
assertEquals(0UL, testULong)
398+
assertEquals(0U, testUShort)
399+
assertEquals(0U, testUByte)
400+
assertEquals(false, testBoolean)
401+
assertEquals('0', testChar)
402+
assertEquals("", testString)
403+
}
404+
}
405+
}
406+
387407
private fun getDefaultDBConfig(): DatabaseConfiguration =
388408
DatabaseConfiguration(
389409
name = DATABASE_NAME,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.ctrip.sqllin.dsl
2+
3+
import com.ctrip.sqllin.dsl.annotation.DBRow
4+
import kotlinx.serialization.Serializable
5+
6+
@DBRow
7+
@Serializable
8+
data class TestPrimitiveTypeForKSP(
9+
val testInt: Int,
10+
val testLong: Long,
11+
val testShort: Short,
12+
val testByte: Byte,
13+
val testFloat: Float,
14+
val testDouble: Double,
15+
val testUInt: UInt,
16+
val testULong: ULong,
17+
val testUShort: UShort,
18+
val testUByte: UByte,
19+
val testBoolean: Boolean,
20+
val testChar: Char,
21+
val testString: String,
22+
)

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2022 Ctrip.com.
2+
* Copyright (C) 2023 Ctrip.com.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,6 +62,9 @@ class JvmTest {
6262
@Test
6363
fun testJoinClause() = commonTest.testJoinClause()
6464

65+
@Test
66+
fun testPrimitiveTypeForKSP() = commonTest.testPrimitiveTypeForKSP()
67+
6568
@BeforeTest
6669
fun setUp() {
6770
deleteDatabase(path, CommonBasicTest.DATABASE_NAME)

sqllin-dsl/src/nativeTest/kotlin/com/ctrip/sqllin/dsl/NativeTest.kt

+3
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ class NativeTest {
6565
@Test
6666
fun testConcurrency() = commonTest.testConcurrency()
6767

68+
@Test
69+
fun testPrimitiveTypeForKSP() = commonTest.testPrimitiveTypeForKSP()
70+
6871
@BeforeTest
6972
fun setUp() {
7073
deleteDatabase(path, CommonBasicTest.DATABASE_NAME)

sqllin-processor/src/main/kotlin/com/ctrip/sqllin/processor/ClauseProcessor.kt

+8-8
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ class ClauseProcessor(
129129
property.typeName
130130
) {
131131
Int::class.qualifiedName -> "0"
132-
Long::class.qualifiedName -> "0l"
133-
Short::class.qualifiedName -> "0s"
134-
Byte::class.qualifiedName -> "0b"
135-
Float::class.qualifiedName -> "0f"
132+
Long::class.qualifiedName -> "0L"
133+
Short::class.qualifiedName -> "0"
134+
Byte::class.qualifiedName -> "0"
135+
Float::class.qualifiedName -> "0F"
136136
Double::class.qualifiedName -> "0.0"
137-
UInt::class.qualifiedName -> "0u"
138-
ULong::class.qualifiedName -> "0ul"
139-
UShort::class.qualifiedName -> "0us"
140-
UByte::class.qualifiedName -> "0ub"
137+
UInt::class.qualifiedName -> "0U"
138+
ULong::class.qualifiedName -> "0UL"
139+
UShort::class.qualifiedName -> "0U"
140+
UByte::class.qualifiedName -> "0U"
141141
Boolean::class.qualifiedName -> "false"
142142

143143
Char::class.qualifiedName -> "'0'"

0 commit comments

Comments
 (0)