Skip to content

Commit

Permalink
Merge pull request #59 from qiaoyuang/main
Browse files Browse the repository at this point in the history
Update the version to 1.2.2
  • Loading branch information
qiaoyuang authored Nov 8, 2023
2 parents ee2b759 + bfbc5e3 commit d85c713
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 35 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Date format: YYYY-MM-dd

## v1.2.2 / 2023-xx-xx
## v1.2.2 / 2023-11-08

### All

Expand All @@ -22,6 +22,7 @@
### sqllin-processor

* Update `KSP`'s version to `1.9.20-1.0.13`
* 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))

## v1.2.1 / 2023-10-18

Expand Down
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
dependencies {
val kotlinVersion: String by project
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.android.tools.build:gradle:7.4.2")
classpath("com.android.tools.build:gradle:8.1.2")
}
}

Expand All @@ -16,8 +16,4 @@ allprojects {
google()
mavenCentral()
}
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
}
5 changes: 2 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.2.1
VERSION=1.2.2
GROUP=com.ctrip.kotlin

kotlinVersion=1.9.20
Expand All @@ -25,11 +25,10 @@ org.gradle.caching=true
#Android
android.useAndroidX=true
android.enableJetifier=true
android.disableAutomaticComponentCreation=true

#Kotlin
kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.natvie.increment=true
#kotlin.compiler.execution.strategy=out-of-process
#kotlin.compiler.execution.strategy=out-of-process
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 08 15:11:46 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStoreBase=GRADLE_USER_HOME
13 changes: 8 additions & 5 deletions sqllin-driver/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.konan.target.HostManager

plugins {
Expand Down Expand Up @@ -58,6 +57,14 @@ kotlin {
).forEach {
it.setupNativeConfig()
}

targets.configureEach {
compilations.configureEach {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}

sourceSets {
all {
Expand Down Expand Up @@ -181,8 +188,4 @@ publishing {
useInMemoryPgpKeys(SIGNING_KEY_ID, SIGNING_KEY, SIGNING_PASSWORD)
sign(publishing.publications)
}
}

tasks.withType<KotlinCompile> {
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
}
16 changes: 8 additions & 8 deletions sqllin-dsl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.konan.target.HostManager

plugins {
Expand Down Expand Up @@ -60,6 +59,14 @@ kotlin {
).forEach {
it.setupNativeConfig()
}

targets.configureEach {
compilations.configureEach {
compilerOptions.configure {
freeCompilerArgs.add("-Xexpect-actual-classes")
}
}
}

sourceSets {
all {
Expand Down Expand Up @@ -113,9 +120,6 @@ android {
}

fun KotlinNativeTarget.setupNativeConfig() {
val compileArgs = listOf("-Xruntime-logs=gc=info")
compilations["main"].kotlinOptions.freeCompilerArgs += compileArgs
compilations["test"].kotlinOptions.freeCompilerArgs += compileArgs
binaries {
all {
linkerOpts += when {
Expand Down Expand Up @@ -215,8 +219,4 @@ publishing {
useInMemoryPgpKeys(SIGNING_KEY_ID, SIGNING_KEY, SIGNING_PASSWORD)
sign(publishing.publications)
}
}

tasks.withType<KotlinCompile> {
compilerOptions.freeCompilerArgs.add("-Xexpect-actual-classes")
}
2 changes: 1 addition & 1 deletion sqllin-dsl/doc/getting-start-cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {
id("com.google.devtools.ksp")
}

val sqllinVersion = "1.2.1"
val sqllinVersion = "1.2.2"

kotlin {
// ......
Expand Down
2 changes: 1 addition & 1 deletion sqllin-dsl/doc/getting-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ plugins {
id("com.google.devtools.ksp")
}

val sqllinVersion = "1.2.1"
val sqllinVersion = "1.2.2"

kotlin {
// ......
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ class AndroidTest {
@Test
fun testConcurrency() = commonTest.testConcurrency()

@Test
fun testPrimitiveTypeForKSP() = commonTest.testPrimitiveTypeForKSP()

@Before
fun setUp() {
val context = InstrumentationRegistry.getInstrumentation().targetContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public sealed class JoinClause<R>(vararg tables: Table<*>) : BaseJoinClause<R>(*
public infix fun <R> JoinStatementWithoutCondition<R>.ON(condition: SelectCondition): JoinSelectStatement<R> =
convertToJoinSelectStatement(condition)

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal class InnerJoinClause<R>(

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

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

internal class NaturalInnerJoinClause<R>(
Expand All @@ -43,4 +44,5 @@ internal class NaturalInnerJoinClause<R>(

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

@Suppress("NOTHING_TO_INLINE")
public inline fun <R> NATURAL_INNER_JOIN(vararg tables: Table<*>): NaturalJoinClause<R> = NATURAL_JOIN(*tables)
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public enum class OrderByWay(internal val str: String) {
public fun <T> ORDER_BY(vararg column2Ways: Pair<ClauseElement, OrderByWay>): OrderByClause<T> =
OrderByClause(mapOf(*column2Ways))

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

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

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

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

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

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,26 @@ class CommonBasicTest(private val path: DatabasePath) {
Unit
}

fun testPrimitiveTypeForKSP() {
TestPrimitiveTypeForKSPTable {
SET<TestPrimitiveTypeForKSP> {
assertEquals(0, testInt)
assertEquals(0L, testLong)
assertEquals(0, testShort)
assertEquals(0, testByte)
assertEquals(0F, testFloat)
assertEquals(0.0, testDouble)
assertEquals(0U, testUInt)
assertEquals(0UL, testULong)
assertEquals(0U, testUShort)
assertEquals(0U, testUByte)
assertEquals(false, testBoolean)
assertEquals('0', testChar)
assertEquals("", testString)
}
}
}

private fun getDefaultDBConfig(): DatabaseConfiguration =
DatabaseConfiguration(
name = DATABASE_NAME,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.ctrip.sqllin.dsl

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

@DBRow
@Serializable
data class TestPrimitiveTypeForKSP(
val testInt: Int,
val testLong: Long,
val testShort: Short,
val testByte: Byte,
val testFloat: Float,
val testDouble: Double,
val testUInt: UInt,
val testULong: ULong,
val testUShort: UShort,
val testUByte: UByte,
val testBoolean: Boolean,
val testChar: Char,
val testString: String,
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2022 Ctrip.com.
* Copyright (C) 2023 Ctrip.com.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -62,6 +62,9 @@ class JvmTest {
@Test
fun testJoinClause() = commonTest.testJoinClause()

@Test
fun testPrimitiveTypeForKSP() = commonTest.testPrimitiveTypeForKSP()

@BeforeTest
fun setUp() {
deleteDatabase(path, CommonBasicTest.DATABASE_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ class NativeTest {
@Test
fun testConcurrency() = commonTest.testConcurrency()

@Test
fun testPrimitiveTypeForKSP() = commonTest.testPrimitiveTypeForKSP()

@BeforeTest
fun setUp() {
deleteDatabase(path, CommonBasicTest.DATABASE_NAME)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ class ClauseProcessor(
property.typeName
) {
Int::class.qualifiedName -> "0"
Long::class.qualifiedName -> "0l"
Short::class.qualifiedName -> "0s"
Byte::class.qualifiedName -> "0b"
Float::class.qualifiedName -> "0f"
Long::class.qualifiedName -> "0L"
Short::class.qualifiedName -> "0"
Byte::class.qualifiedName -> "0"
Float::class.qualifiedName -> "0F"
Double::class.qualifiedName -> "0.0"
UInt::class.qualifiedName -> "0u"
ULong::class.qualifiedName -> "0ul"
UShort::class.qualifiedName -> "0us"
UByte::class.qualifiedName -> "0ub"
UInt::class.qualifiedName -> "0U"
ULong::class.qualifiedName -> "0UL"
UShort::class.qualifiedName -> "0U"
UByte::class.qualifiedName -> "0U"
Boolean::class.qualifiedName -> "false"

Char::class.qualifiedName -> "'0'"
Expand Down

0 comments on commit d85c713

Please sign in to comment.