Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure Java 11 in GitHub actions #116

Closed
wants to merge 17 commits into from
18 changes: 15 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,26 @@ jobs:
build:
strategy:
matrix:
os: [ macOS-latest ]
# os: [ macOS-latest, ubuntu-18.04 ] GitHub actions removed ubuntu-18.04
# os: [ macOS-latest, windows-latest, ubuntu-18.04 ]
os: [ ubuntu-22.04 ]
# os: [ macOS-latest, windows-latest, ubuntu-22.04 ]
runs-on: ${{matrix.os}}
container: ubuntu:trusty
steps:
- name: Run script file
run: |
ls -l /usr/lib/x86_64-linux-gnu/libsqlite3*
sudo apt install libsqlite3-dev -y
sqlite3 --version || echo "not found"
shell: bash

- name: Checkout the repo
uses: actions/checkout@v2

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11

- name: Install msys2
if: matrix.os == 'windows-latest'
uses: msys2/setup-msys2@v2
Expand Down
31 changes: 8 additions & 23 deletions sqliter-driver/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,18 @@ fun configInterop(target: org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTar
// extraOpts = listOf("-mode", "sourcecode")
}

target.compilations.forEach { kotlinNativeCompilation ->
kotlinNativeCompilation.kotlinOptions.freeCompilerArgs += when {
HostManager.hostIsLinux -> listOf(
"-linker-options",
"-lsqlite3 -L/usr/lib/x86_64-linux-gnu -L/usr/lib"
)

HostManager.hostIsMingw -> listOf("-linker-options", "-lsqlite3 -Lc:\\msys64\\mingw64\\lib")
else -> listOf("-linker-options", "-lsqlite3")
target.binaries.all {
linkerOpts += when {
HostManager.hostIsLinux -> listOf("-lsqlite3", "-L$rootDir/libs/linux", "-L/usr/lib/x86_64-linux-gnu", "-L/usr/lib", "-L/usr/lib64")
HostManager.hostIsMingw -> listOf("-Lc:\\msys64\\mingw64\\lib", "-L$rootDir\\libs\\windows", "-lsqlite3")
else -> listOf("-lsqlite3")
}
}
}

kotlin {
jvmToolchain(11)
}

kotlin {
val knTargets = listOf(
macosX64(),
iosX64(),
Expand Down Expand Up @@ -122,15 +116,6 @@ kotlin {
}
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
}

listOf(
"linuxX64Test",
"linuxArm64Test",
"linkDebugTestLinuxX64",
"linkDebugTestLinuxArm64",
"mingwX64Test",
"linkDebugTestMingwX64",
).forEach { tasks.findByName(it)?.enabled = false }
//tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile> {
// kotlinOptions.freeCompilerArgs += "-Xexpect-actual-classes"
//}
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
package co.touchlab.sqliter.interop

open class SQLiteException internal constructor(message: String, private val config: SqliteDatabaseConfig) : Exception(message)
open class SQLiteException internal constructor(message: String, internal val config: SqliteDatabaseConfig) : Exception(message)

class SQLiteExceptionErrorCode internal constructor(message: String, config: SqliteDatabaseConfig, private val errorCode: Int) : SQLiteException(message, config) {
val errorType: SqliteErrorType by lazy {
val checkErrorCode = errorCode and 0xff
SqliteErrorType.values().find { it.code == checkErrorCode }
?: throw IllegalArgumentException("Unknown errorCode $errorCode, checkErrorCode $checkErrorCode")
}
override fun toString(): String {
return "SQLiteExceptionErrorCode(message=$message, errorCode=$errorCode, config=$config)"
}
}

internal inline fun sqlException(logging: Logger, config: SqliteDatabaseConfig, message: String, errorCode: Int = -1): SQLiteException {
Expand Down
Loading