Skip to content

Commit 4fbb3e2

Browse files
committed
kotlin version bump
1 parent b7ef0d8 commit 4fbb3e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+179
-274
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
build:
1313
strategy:
1414
matrix:
15-
os: [ macOS-latest ]
15+
# os: [ macOS-latest ]
1616
# os: [ macOS-latest, ubuntu-18.04 ] GitHub actions removed ubuntu-18.04
17-
# os: [ macOS-latest, windows-latest, ubuntu-18.04 ]
17+
os: [ macOS-latest, windows-latest, ubuntu-latest ]
1818
runs-on: ${{matrix.os}}
1919
steps:
2020
- name: Checkout the repo
@@ -54,6 +54,6 @@ jobs:
5454
echo "c:\msys64\mingw64\bin" >> $GITHUB_PATH
5555
5656
- name: Build
57-
run: ./gradlew build --no-daemon --stacktrace
57+
run: ./gradlew build allTests --no-daemon --stacktrace
5858
env:
5959
GRADLE_OPTS: -Dorg.gradle.configureondemand=true -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx4g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:MaxMetaspaceSize=512m"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,4 @@ samples/**/*.kt.bc-build
5656
samples/androidNativeActivity/Polyhedron
5757

5858
.vscode
59+
.kotlin/

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kotlin.code.style=official
33
GROUP=co.touchlab
44

55
VERSION_NAME=1.3.3
6-
KOTLIN_VERSION=1.9.20
6+
KOTLIN_VERSION=2.2.10
77

88
kotlin.native.ignoreDisabledTargets=true
99

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

sqliter-driver/build.gradle.kts

Lines changed: 38 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import org.jetbrains.kotlin.konan.target.HostManager
22

33
plugins {
44
kotlin("multiplatform")
5-
id("com.vanniktech.maven.publish") version "0.27.0"
5+
id("com.vanniktech.maven.publish") version "0.34.0"
66
}
77

88
val GROUP: String by project
@@ -11,31 +11,13 @@ val VERSION_NAME: String by project
1111
group = GROUP
1212
version = VERSION_NAME
1313

14-
fun configInterop(target: org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget) {
15-
val main by target.compilations.getting
16-
val sqlite3 by main.cinterops.creating {
17-
includeDirs("$projectDir/src/include")
18-
// extraOpts = listOf("-mode", "sourcecode")
19-
}
20-
21-
target.compilations.forEach { kotlinNativeCompilation ->
22-
kotlinNativeCompilation.kotlinOptions.freeCompilerArgs += when {
23-
HostManager.hostIsLinux -> listOf(
24-
"-linker-options",
25-
"-lsqlite3 -L/usr/lib/x86_64-linux-gnu -L/usr/lib"
26-
)
27-
28-
HostManager.hostIsMingw -> listOf("-linker-options", "-lsqlite3 -Lc:\\msys64\\mingw64\\lib")
29-
else -> listOf("-linker-options", "-lsqlite3")
30-
}
31-
}
32-
}
33-
3414
kotlin {
35-
jvmToolchain(11)
15+
jvmToolchain(17)
3616
}
3717

3818
kotlin {
19+
applyDefaultHierarchyTemplate()
20+
3921
val knTargets = listOf(
4022
macosX64(),
4123
iosX64(),
@@ -55,82 +37,51 @@ kotlin {
5537
linuxArm64(),
5638
)
5739

58-
knTargets
59-
.forEach { target ->
60-
configInterop(target)
40+
knTargets.forEach { target ->
41+
target.compilations["main"].cinterops.create("sqlite3").apply {
42+
includeDirs("$projectDir/src/include")
43+
// extraOpts = listOf("-mode", "sourcecode")
44+
}
45+
46+
target.compilerOptions {
47+
freeCompilerArgs.addAll(
48+
when {
49+
HostManager.hostIsLinux -> listOf(
50+
"-linker-options",
51+
"-lsqlite3 -L/usr/lib/x86_64-linux-gnu -L/usr/lib"
52+
)
53+
54+
HostManager.hostIsMingw -> listOf("-linker-options", "-lsqlite3 -Lc:\\msys64\\mingw64\\lib")
55+
else -> listOf("-linker-options", "-lsqlite3")
56+
}
57+
)
6158
}
59+
}
6260

6361
sourceSets {
6462
all {
65-
languageSettings.apply {
63+
languageSettings {
6664
optIn("kotlin.experimental.ExperimentalNativeApi")
6765
optIn("kotlinx.cinterop.ExperimentalForeignApi")
6866
optIn("kotlinx.cinterop.BetaInteropApi")
69-
}
70-
}
71-
commonMain {
72-
dependencies {
73-
}
74-
}
75-
commonTest {
76-
dependencies {
77-
implementation(kotlin("test"))
78-
}
79-
}
80-
81-
val nativeCommonMain = sourceSets.maybeCreate("nativeCommonMain")
82-
val nativeCommonTest = sourceSets.maybeCreate("nativeCommonTest")
83-
84-
val appleMain = sourceSets.maybeCreate("appleMain").apply {
85-
dependsOn(nativeCommonMain)
86-
}
87-
val linuxMain = sourceSets.maybeCreate("linuxMain").apply {
88-
dependsOn(nativeCommonMain)
89-
}
90-
val linuxX64Main = sourceSets.maybeCreate("linuxX64Main").apply {
91-
dependsOn(linuxMain)
92-
}
93-
val linuxArm64Main = sourceSets.maybeCreate("linuxArm64Main").apply {
94-
dependsOn(linuxMain)
95-
}
9667

97-
val mingwMain = sourceSets.maybeCreate("mingwMain").apply {
98-
dependsOn(nativeCommonMain)
99-
}
100-
101-
val mingwX64Main = sourceSets.maybeCreate("mingwX64Main").apply {
102-
dependsOn(mingwMain)
103-
}
104-
105-
knTargets.forEach { target ->
106-
when {
107-
target.name.startsWith("mingw") -> {
108-
target.compilations.getByName("main").defaultSourceSet.dependsOn(mingwMain)
109-
target.compilations.getByName("test").defaultSourceSet.dependsOn(nativeCommonTest)
110-
}
111-
112-
target.name.startsWith("linux") -> {
113-
target.compilations.getByName("test").defaultSourceSet.dependsOn(nativeCommonTest)
114-
}
115-
116-
else -> {
117-
target.compilations.getByName("main").defaultSourceSet.dependsOn(appleMain)
118-
target.compilations.getByName("test").defaultSourceSet.dependsOn(nativeCommonTest)
68+
compilerOptions {
69+
freeCompilerArgs.add("-Xexpect-actual-classes")
11970
}
12071
}
12172
}
122-
}
123-
}
12473

125-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
126-
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
74+
commonTest.dependencies {
75+
implementation(kotlin("test"))
76+
}
77+
}
12778
}
12879

129-
listOf(
130-
"linuxX64Test",
131-
"linuxArm64Test",
132-
"linkDebugTestLinuxX64",
133-
"linkDebugTestLinuxArm64",
134-
"mingwX64Test",
135-
"linkDebugTestMingwX64",
136-
).forEach { tasks.findByName(it)?.enabled = false }
80+
//listOf(
81+
// "linuxX64Test",
82+
// "linuxArm64Test",
83+
// "linkDebugTestLinuxX64",
84+
// "linkDebugTestLinuxArm64",
85+
// "mingwX64Test",
86+
// "linkDebugTestMingwX64",
87+
//).forEach { tasks.findByName(it)?.enabled = false }

sqliter-driver/src/linuxMain/kotlin/co/touchlab/sqliter/concurrency/Lock.kt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
package co.touchlab.sqliter.concurrency
22

3-
import co.touchlab.sqliter.util.maybeFreeze
43
import kotlinx.cinterop.Arena
54
import kotlinx.cinterop.alloc
65
import kotlinx.cinterop.ptr
7-
import platform.posix.*
6+
import platform.posix.PTHREAD_MUTEX_RECURSIVE
7+
import platform.posix.pthread_mutex_destroy
8+
import platform.posix.pthread_mutex_init
9+
import platform.posix.pthread_mutex_lock
10+
import platform.posix.pthread_mutex_t
11+
import platform.posix.pthread_mutex_trylock
12+
import platform.posix.pthread_mutex_unlock
13+
import platform.posix.pthread_mutexattr_destroy
14+
import platform.posix.pthread_mutexattr_init
15+
import platform.posix.pthread_mutexattr_settype
16+
import platform.posix.pthread_mutexattr_t
817

918
/**
1019
* A simple lock.
@@ -19,7 +28,6 @@ internal actual class Lock actual constructor() {
1928
pthread_mutexattr_init(attr.ptr)
2029
pthread_mutexattr_settype(attr.ptr, PTHREAD_MUTEX_RECURSIVE.toInt())
2130
pthread_mutex_init(mutex.ptr, attr.ptr)
22-
maybeFreeze()
2331
}
2432

2533
actual fun lock() {

sqliter-driver/src/mingwX64Main/kotlin/co/touchlab/sqliter/concurrency/Lock.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package co.touchlab.sqliter.concurrency
22

3-
import co.touchlab.sqliter.util.maybeFreeze
43
import kotlinx.cinterop.Arena
54
import kotlinx.cinterop.alloc
65
import kotlinx.cinterop.ptr
@@ -29,7 +28,6 @@ internal actual class Lock actual constructor() {
2928
pthread_mutexattr_init(attr.ptr)
3029
pthread_mutexattr_settype(attr.ptr, PTHREAD_MUTEX_RECURSIVE.toInt())
3130
pthread_mutex_init(mutex.ptr, attr.ptr)
32-
maybeFreeze()
3331
}
3432

3533
actual fun lock() {

sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/concurrency/SingleThreadDatabaseConnection.kt

Lines changed: 0 additions & 27 deletions
This file was deleted.

sqliter-driver/src/nativeCommonMain/kotlin/co/touchlab/sqliter/util/Functions.kt

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)