Skip to content

Commit

Permalink
Update to Kotlin 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
qiaoyuang committed Dec 4, 2024
1 parent f06e97d commit 01abf5f
Show file tree
Hide file tree
Showing 15 changed files with 119 additions and 68 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down Expand Up @@ -124,11 +124,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down Expand Up @@ -184,11 +184,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down Expand Up @@ -60,11 +60,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down Expand Up @@ -97,11 +97,11 @@ jobs:
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v3

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 17
java-version: 21

- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
Expand Down
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

- Date format: YYYY-MM-dd

## v1.4.0 / 2024-09-02
## v1.4.0 / 2024-12-04

### All

* Update `Kotlin`'s version to `2.0.20`
* Update `Kotlin`'s version to `2.1.00`

### sqllin-dsl

* Update `kotlinx.coroutines`'s version to `1.8.1`
* Update `kotlinx.serialization`'s version to `1.7.2`
* Update `kotlinx.coroutines`'s version to `1.9.0`
* Update `kotlinx.serialization`'s version to `1.7.3`

### sqllin-driver

* Update the `sqlite-jdbc`'s version to `3.46.1.0`
* Update the `sqlite-jdbc`'s version to `3.47.1.0`

### sqllin-processor

* Update `KSP`'s version to `2.0.20-1.0.24`
* Update `KSP`'s version to `2.1.0-1.0.29`

## v1.3.2 / 2024-06-18

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ kotlin.code.style=official
kotlin.mpp.stability.nowarn=true
kotlin.mpp.enableCInteropCommonization=true
kotlin.natvie.increment=true
ksp.useKSP2=true
#kotlin.compiler.execution.strategy=out-of-process
14 changes: 7 additions & 7 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[versions]

kotlin = "2.0.20"
agp = "8.5.2"
ksp = "2.0.20-1.0.24"
serialization = "1.7.2"
coroutines = "1.8.1"
androidx-annotation = "1.8.2"
kotlin = "2.1.0"
agp = "8.7.3"
ksp = "2.1.0-1.0.29"
serialization = "1.7.3"
coroutines = "1.9.0"
androidx-annotation = "1.9.1"
androidx-test = "1.6.1"
androidx-test-runner = "1.6.2"
sqlite-jdbc = "3.46.1.0"
sqlite-jdbc = "3.47.1.0"

[libraries]

Expand Down
8 changes: 3 additions & 5 deletions sample/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

Expand All @@ -11,7 +10,6 @@ plugins {

version = "1.0"

@OptIn(ExperimentalKotlinGradlePluginApi::class)
kotlin {
androidTarget {
publishLibraryVariants("release")
Expand All @@ -31,7 +29,7 @@ kotlin {
all {
languageSettings.optIn("kotlin.RequiresOptIn")
}
val commonMain by getting {
commonMain {
kotlin.srcDir("build/generated/ksp/metadata/commonMain/kotlin")
dependencies {
implementation(project(":sqllin-dsl"))
Expand All @@ -44,13 +42,13 @@ kotlin {

android {
namespace = "com.ctrip.sqllin.sample"
compileSdk = 34
compileSdk = 35
defaultConfig {
minSdk = 23
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_21
}
}

Expand Down
35 changes: 13 additions & 22 deletions sqllin-driver/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,20 @@ kotlin {
optIn("kotlin.RequiresOptIn")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(libs.kotlinx.coroutines)
}
commonTest.dependencies {
implementation(kotlin("test"))
implementation(libs.kotlinx.coroutines)
}
val androidMain by getting {
dependencies {
implementation(libs.androidx.annotation)
}
androidMain.dependencies {
implementation(libs.androidx.annotation)
}
val androidInstrumentedTest by getting {
dependencies {
implementation(libs.androidx.test.core)
implementation(libs.androidx.test.runner)
implementation(libs.androidx.test.rules)
}
androidInstrumentedTest.dependencies {
implementation(libs.androidx.test.core)
implementation(libs.androidx.test.runner)
implementation(libs.androidx.test.rules)
}

val jvmMain by getting {
dependencies {
implementation(libs.sqlite.jdbc)
}
jvmMain.dependencies {
implementation(libs.sqlite.jdbc)
}
}
}
Expand All @@ -109,14 +100,14 @@ gradle.taskGraph.whenReady {

android {
namespace = "com.ctrip.sqllin.driver"
compileSdk = 34
compileSdk = 35
defaultConfig {
minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_21
}
}

Expand Down
87 changes: 74 additions & 13 deletions sqllin-dsl/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSetTree
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.konan.target.HostManager
Expand Down Expand Up @@ -67,28 +68,86 @@ kotlin {
optIn("kotlin.RequiresOptIn")
}
}
val commonMain by getting {
dependencies {
api(project(":sqllin-driver"))
implementation(libs.kotlinx.serialization)
implementation(libs.kotlinx.coroutines)
}
commonMain.dependencies {
api(project(":sqllin-driver"))
implementation(libs.kotlinx.serialization)
implementation(libs.kotlinx.coroutines)
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
commonTest.dependencies {
implementation(kotlin("test"))
}
val androidInstrumentedTest by getting {
androidInstrumentedTest {
setCommonTestDir()
dependencies {
implementation(libs.androidx.test.core)
implementation(libs.androidx.test.runner)
implementation(libs.androidx.test.rules)
}
}
jvmTest {
setCommonTestDir()
}

iosX64Test {
setNativeTestDir()
}
iosArm64Test {
setNativeTestDir()
}
iosSimulatorArm64Test {
setNativeTestDir()
}


macosX64Test {
setNativeTestDir()
}
macosArm64Test {
setNativeTestDir()
}

watchosX64Test {
setNativeTestDir()
}
watchosArm32Test {
setNativeTestDir()
}
watchosArm64Test {
setNativeTestDir()
}
watchosDeviceArm64Test {
setNativeTestDir()
}
watchosSimulatorArm64Test {
setNativeTestDir()
}

tvosX64Test {
setNativeTestDir()
}
tvosArm64Test {
setNativeTestDir()
}
tvosSimulatorArm64Test {
setNativeTestDir()
}

linuxX64Test {
setNativeTestDir()
}
linuxArm64Test {
setNativeTestDir()
}

mingwX64Test {
setNativeTestDir()
}
}
}

fun KotlinSourceSet.setCommonTestDir(vararg path: String) = kotlin.srcDirs("src/commonTestCode/kotlin", path)
fun KotlinSourceSet.setNativeTestDir() = setCommonTestDir("src/nativeTestCode/kotlin")

gradle.taskGraph.whenReady {
if (!project.hasProperty("onCICD"))
return@whenReady
Expand All @@ -106,14 +165,14 @@ gradle.taskGraph.whenReady {

android {
namespace = "com.ctrip.sqllin.dsl"
compileSdk = 34
compileSdk = 35
defaultConfig {
minSdk = 23
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_21
}
}

Expand Down Expand Up @@ -145,13 +204,15 @@ dependencies {
"kspWatchosX64Test",
"kspWatchosArm32Test",
"kspWatchosArm64Test",
"kspWatchosDeviceArm64Test",
"kspWatchosSimulatorArm64Test",

"kspTvosX64Test",
"kspTvosArm64Test",
"kspTvosSimulatorArm64Test",

"kspLinuxX64Test",
"kspLinuxArm64Test",

"kspMingwX64Test",
)
Expand Down
4 changes: 2 additions & 2 deletions sqllin-processor/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ repositories {
}

java {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ClauseProcessor(
for (classDeclaration in validateDBRowClasses) {

if (classDeclaration.annotations.all { !it.annotationType.resolve().isAssignableFrom(serializableType) })
continue // Don't handle the class that don't annotated 'Serializable'
continue // Don't handle the classes that didn't be annotated 'Serializable'

val className = classDeclaration.simpleName.asString()
val packageName = classDeclaration.packageName.asString()
Expand Down

0 comments on commit 01abf5f

Please sign in to comment.