diff --git a/androidApp/build.gradle.kts b/androidApp/build.gradle.kts index 1d3be8c..ace0b01 100644 --- a/androidApp/build.gradle.kts +++ b/androidApp/build.gradle.kts @@ -9,6 +9,7 @@ plugins { kotlin("kapt") id("com.mikepenz.aboutlibraries.plugin") id("org.jetbrains.kotlinx.kover") + id("app.cash.sqldelight") version "2.0.2" } fun Project.execWithOutput(cmd: String, ignore: Boolean = false): String { @@ -183,7 +184,7 @@ dependencies { implementation("com.github.ln-12:multiplatform-connectivity-status:1.3.0") // SQLDELIGHT - implementation("com.squareup.sqldelight:android-driver:1.5.4") + implementation("app.cash.sqldelight:android-driver:2.0.2") //test testImplementation("junit:junit:4.13.2") diff --git a/build.gradle.kts b/build.gradle.kts index 96db5b8..52e706b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,3 @@ -buildscript { - dependencies { - // SqlDelight - classpath("com.squareup.sqldelight:gradle-plugin:1.5.5") - } -} - plugins { //trick: for the same plugin versions in all sub-modules id("com.android.application").version("8.7.3").apply(false) diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 5403cbf..3e20988 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -1,18 +1,18 @@ val ktorVersion = "3.0.3" object SqlDelight { - const val runtime = "com.squareup.sqldelight:runtime:1.5.4" - const val android = "com.squareup.sqldelight:android-driver:1.5.4" - const val native = "com.squareup.sqldelight:native-driver:1.5.4" + const val runtime = "app.cash.sqldelight:runtime:2.0.2" + const val android = "app.cash.sqldelight:android-driver:2.0.2" + const val native = "app.cash.sqldelight:native-driver:2.0.2" } plugins { kotlin("multiplatform") id("com.android.library") - id("com.squareup.sqldelight") kotlin("plugin.serialization") version "1.9.0" id("org.jetbrains.kotlinx.kover") + id("app.cash.sqldelight") version "2.0.2" } kotlin { @@ -108,11 +108,10 @@ android { namespace = "bou.amine.apps.readerforselfossv2" } - - sqldelight { - database("ReaderForSelfossDB") { - packageName = "bou.amine.apps.readerforselfossv2.dao" - sourceFolders = listOf("sqldelight") + databases { + create("ReaderForSelfossDB") { + packageName.set("bou.amine.apps.readerforselfossv2.dao") + } } } \ No newline at end of file diff --git a/shared/src/androidMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt b/shared/src/androidMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt index cf4d39f..628c09f 100644 --- a/shared/src/androidMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt +++ b/shared/src/androidMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt @@ -1,10 +1,15 @@ package bou.amine.apps.readerforselfossv2.dao + import android.content.Context -import com.squareup.sqldelight.android.AndroidSqliteDriver -import com.squareup.sqldelight.db.SqlDriver +import app.cash.sqldelight.db.SqlDriver +import app.cash.sqldelight.driver.android.AndroidSqliteDriver actual class DriverFactory(private val context: Context) { actual fun createDriver(): SqlDriver { - return AndroidSqliteDriver(ReaderForSelfossDB.Schema, context, "ReaderForSelfossV2-android.db") + return AndroidSqliteDriver( + ReaderForSelfossDB.Schema, + context, + "ReaderForSelfossV2-android.db" + ) } -} +} \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt index eb28bb8..ab41017 100644 --- a/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt +++ b/shared/src/commonMain/kotlin/bou/amine/apps/readerforselfossv2/dao/DeviceDatabase.kt @@ -1,7 +1,7 @@ package bou.amine.apps.readerforselfossv2.dao -import com.squareup.sqldelight.db.SqlDriver +import app.cash.sqldelight.db.SqlDriver expect class DriverFactory { fun createDriver(): SqlDriver -} +} \ No newline at end of file diff --git a/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Actions.sq b/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Actions.sq index 8831df4..6b0d6dd 100644 --- a/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Actions.sq +++ b/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Actions.sq @@ -1,3 +1,5 @@ +import kotlin.Boolean; + CREATE TABLE `ACTION` ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `articleid` TEXT NOT NULL, diff --git a/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Items.sq b/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Items.sq index fd5f34e..0756158 100644 --- a/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Items.sq +++ b/shared/src/commonMain/sqldelight/bou/amine/apps/readerforselfossv2/dao/Items.sq @@ -1,3 +1,5 @@ +import kotlin.Boolean; + CREATE TABLE ITEM ( `id` TEXT NOT NULL, `datetime` TEXT NOT NULL, diff --git a/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt b/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt index 06d7b59..17e359d 100644 --- a/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt +++ b/shared/src/iosArm64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt @@ -1,10 +1,10 @@ package bou.amine.apps.readerforselfossv2.dao -import com.squareup.sqldelight.db.SqlDriver -import com.squareup.sqldelight.drivers.native.NativeSqliteDriver +import app.cash.sqldelight.db.SqlDriver +import app.cash.sqldelight.driver.native.NativeSqliteDriver actual class DriverFactory { actual fun createDriver(): SqlDriver { return NativeSqliteDriver(ReaderForSelfossDB.Schema, "ReaderForSelfossV2-IOS.db") } -} +} \ No newline at end of file diff --git a/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt b/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt index 06d7b59..17e359d 100644 --- a/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt +++ b/shared/src/iosX64Main/kotlin/bou/amine/apps/readerforselfossv2/dao/DriverFactory.kt @@ -1,10 +1,10 @@ package bou.amine.apps.readerforselfossv2.dao -import com.squareup.sqldelight.db.SqlDriver -import com.squareup.sqldelight.drivers.native.NativeSqliteDriver +import app.cash.sqldelight.db.SqlDriver +import app.cash.sqldelight.driver.native.NativeSqliteDriver actual class DriverFactory { actual fun createDriver(): SqlDriver { return NativeSqliteDriver(ReaderForSelfossDB.Schema, "ReaderForSelfossV2-IOS.db") } -} +} \ No newline at end of file