Use BundledSQLiteDriver again

pull/3307/head
Alex Baker 10 months ago
parent 728029e949
commit 7c1ac86e33

@ -184,6 +184,7 @@ dependencies {
implementation(libs.androidx.lifecycle.runtime.compose)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.room)
implementation(libs.androidx.sqlite)
implementation(libs.androidx.appcompat)
implementation(libs.iconics)
implementation(libs.markwon)

@ -2,6 +2,7 @@ package org.tasks.injection
import android.content.Context
import androidx.room.Room
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@ -25,6 +26,7 @@ class TestModule {
@Singleton
fun getDatabase(@ApplicationContext context: Context): Database {
return Room.inMemoryDatabaseBuilder(context, Database::class.java)
.setDriver(BundledSQLiteDriver())
.fallbackToDestructiveMigration(dropAllTables = true)
.build()
}

@ -2,11 +2,16 @@ package org.tasks.injection
import android.content.Context
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.sqlite.SQLiteConnection
import androidx.sqlite.driver.bundled.BundledSQLiteDriver
import androidx.sqlite.execSQL
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import kotlinx.coroutines.Dispatchers
import org.tasks.BuildConfig
import org.tasks.R
import org.tasks.caldav.FileStorage
@ -36,6 +41,15 @@ internal class ProductionModule {
context = context,
name = databaseFile.absolutePath
)
.setDriver(BundledSQLiteDriver())
.setQueryCoroutineContext(Dispatchers.IO)
.addCallback(object : RoomDatabase.Callback() {
override fun onOpen(connection: SQLiteConnection) {
super.onOpen(connection)
connection.execSQL("PRAGMA busy_timeout = 30000")
}
})
.addMigrations(*Migrations.migrations(context, fileStorage))
if (!BuildConfig.DEBUG || !preferences.getBoolean(R.string.p_crash_main_queries, false)) {
builder.allowMainThreadQueries()

@ -247,6 +247,7 @@
+| | | +--- androidx.annotation:annotation:1.8.1 -> 1.9.1 (*)
+| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| | | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c)
+| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c)
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c)
+| | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13
+| | | \--- androidx.sqlite:sqlite-framework-android:2.5.0-alpha13
@ -254,6 +255,7 @@
+| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*)
+| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c)
+| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c)
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c)
+| | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 -> 1.9.0 (*)
@ -1172,6 +1174,13 @@
++--- androidx.lifecycle:lifecycle-runtime-compose:2.8.7 (*)
++--- androidx.lifecycle:lifecycle-viewmodel:2.8.7 (*)
++--- androidx.room:room-runtime:2.7.0-alpha13 (*)
++--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13
+| \--- androidx.sqlite:sqlite-bundled-android:2.5.0-alpha13
+| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c)
+| +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c)
+| \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c)
++--- androidx.appcompat:appcompat:1.7.0 (*)
++--- com.mikepenz:iconics-core:5.5.0-b01 (*)
++--- io.noties.markwon:core:4.6.2

@ -808,6 +808,7 @@
+| | | +--- androidx.annotation:annotation:1.8.1 -> 1.9.1 (*)
+| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| | | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c)
+| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c)
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c)
+| | +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13
+| | | \--- androidx.sqlite:sqlite-framework-android:2.5.0-alpha13
@ -815,6 +816,7 @@
+| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*)
+| | | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| | | +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c)
+| | | +--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13 (c)
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c)
+| | +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| | +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3 -> 1.9.0 (*)
@ -1521,6 +1523,13 @@
++--- androidx.lifecycle:lifecycle-runtime-compose:2.8.7 (*)
++--- androidx.lifecycle:lifecycle-viewmodel:2.8.7 (*)
++--- androidx.room:room-runtime:2.7.0-alpha13 (*)
++--- androidx.sqlite:sqlite-bundled:2.5.0-alpha13
+| \--- androidx.sqlite:sqlite-bundled-android:2.5.0-alpha13
+| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib -> 2.1.10 (*)
+| +--- androidx.sqlite:sqlite:2.5.0-alpha13 (c)
+| +--- androidx.sqlite:sqlite-framework:2.5.0-alpha13 (c)
+| \--- org.jetbrains.kotlin:kotlin-stdlib:2.1.0 -> 2.1.10 (c)
++--- androidx.appcompat:appcompat:1.7.0 (*)
++--- com.mikepenz:iconics-core:5.5.0-b01 (*)
++--- io.noties.markwon:core:4.6.2

@ -90,6 +90,7 @@ androidx-preference = { module = "androidx.preference:preference", version.ref =
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version.ref = "recyclerview" }
androidx-room = { module = "androidx.room:room-runtime", version.ref = "room" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "room"}
androidx-sqlite = { module = "androidx.sqlite:sqlite-bundled", version = "2.5.0-alpha13" }
androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "swiperefreshlayout" }
androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" }
androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" }

Loading…
Cancel
Save