Skip to content

Commit c024228

Browse files
author
Nathan Reline
committed
Prep for 0.1.0 release
1 parent 6770bd8 commit c024228

File tree

6 files changed

+29
-17
lines changed

6 files changed

+29
-17
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# SQLiteCopyOpenHelper
22
An open helper for Android that will copy & open a pre-populated database
33

4+
## Room
5+
6+
If you are using Room, utilize the built in methods for prepopulating a database.
7+
https://developer.android.com/training/data-storage/room/prepopulate
8+
49
License
510
--------
611

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22
buildscript {
3-
ext.kotlin_version = "1.4.0"
3+
ext.kotlin_version = "1.4.10"
4+
ext.sqlite_version = "2.1.0"
45
repositories {
56
google()
67
jcenter()
78
}
89
dependencies {
9-
classpath "com.android.tools.build:gradle:4.0.1"
10+
classpath "com.android.tools.build:gradle:4.1.1"
1011
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1112

1213
// NOTE: Do not place your application dependencies here; they belong

example/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ dependencies {
2929
implementation fileTree(dir: "libs", include: ["*.jar"])
3030
implementation project(':library')
3131
implementation "net.zetetic:android-database-sqlcipher:4.4.0"
32-
implementation "androidx.sqlite:sqlite-framework:2.1.0"
33-
implementation "androidx.sqlite:sqlite-ktx:2.1.0"
32+
implementation "androidx.sqlite:sqlite-framework:$sqlite_version"
33+
implementation "androidx.sqlite:sqlite-ktx:$sqlite_version"
3434
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
3535
implementation 'androidx.core:core-ktx:1.3.1'
3636
implementation 'androidx.appcompat:appcompat:1.2.0'
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Wed Aug 19 17:11:46 MST 2020
1+
#Wed Nov 11 13:53:36 MST 2020
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

library/build.gradle

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
3-
apply plugin: 'kotlin-android-extensions'
43

54
android {
6-
compileSdkVersion 29
7-
buildToolsVersion "29.0.3"
5+
compileSdkVersion 30
6+
buildToolsVersion "30.0.2"
87

98
defaultConfig {
109
minSdkVersion 16
11-
targetSdkVersion 29
10+
targetSdkVersion 30
1211
versionCode 1
13-
versionName "1.0"
12+
versionName "0.1.0"
1413

1514
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1615
consumerProguardFiles "consumer-rules.pro"
@@ -32,12 +31,12 @@ android {
3231

3332
dependencies {
3433
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
35-
implementation "androidx.sqlite:sqlite-framework:2.1.0"
36-
implementation "androidx.sqlite:sqlite-ktx:2.1.0"
3734
implementation "com.squareup.okio:okio:2.6.0"
35+
implementation "androidx.sqlite:sqlite-ktx:$sqlite_version"
3836

3937
testImplementation "androidx.test.ext:junit-ktx:1.1.2"
4038
testImplementation "androidx.test:core-ktx:1.3.0"
4139
testImplementation 'org.robolectric:robolectric:4.3'
40+
testImplementation "androidx.sqlite:sqlite-framework:$sqlite_version"
4241
testImplementation 'junit:junit:4.12'
43-
}
42+
}

library/src/test/java/com/github/reline/sqlite/db/SQLiteCopyOpenHelperTest.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,23 @@ import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
77
import androidx.test.core.app.ApplicationProvider
88
import androidx.test.ext.junit.runners.AndroidJUnit4
99
import org.junit.Assert.assertEquals
10+
import org.junit.Before
1011
import org.junit.Test
1112

1213
import org.junit.runner.RunWith
1314

1415
@RunWith(AndroidJUnit4::class)
1516
class SQLiteCopyOpenHelperTest {
17+
18+
private lateinit var context: Context
19+
20+
@Before
21+
fun setup() {
22+
context = ApplicationProvider.getApplicationContext()
23+
}
24+
1625
@Test
1726
fun copyEmptyDatabaseFileFromAssetPath() {
18-
val context = ApplicationProvider.getApplicationContext<Context>()
1927
val config = SupportSQLiteOpenHelper.Configuration.builder(context)
2028
.callback(TestCallback())
2129
.name("empty.db")
@@ -28,7 +36,6 @@ class SQLiteCopyOpenHelperTest {
2836

2937
@Test
3038
fun destructivelyMigrate() {
31-
val context = ApplicationProvider.getApplicationContext<Context>()
3239
val configBuilder = SupportSQLiteOpenHelper.Configuration.builder(context)
3340
.name("1.db")
3441

@@ -66,4 +73,4 @@ private class TestCallback(version: Int = 1) : SupportSQLiteOpenHelper.Callback(
6673
override fun onUpgrade(db: SupportSQLiteDatabase, oldVersion: Int, newVersion: Int) {
6774
// TODO("Not yet implemented")
6875
}
69-
}
76+
}

0 commit comments

Comments
 (0)