Skip to content

Commit

Permalink
Prep for 0.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Reline committed Nov 11, 2020
1 parent 6770bd8 commit c024228
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# SQLiteCopyOpenHelper
An open helper for Android that will copy & open a pre-populated database

## Room

If you are using Room, utilize the built in methods for prepopulating a database.
https://developer.android.com/training/data-storage/room/prepopulate

License
--------

Expand Down
5 changes: 3 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.0"
ext.kotlin_version = "1.4.10"
ext.sqlite_version = "2.1.0"
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath "com.android.tools.build:gradle:4.1.1"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

// NOTE: Do not place your application dependencies here; they belong
Expand Down
4 changes: 2 additions & 2 deletions example/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation project(':library')
implementation "net.zetetic:android-database-sqlcipher:4.4.0"
implementation "androidx.sqlite:sqlite-framework:2.1.0"
implementation "androidx.sqlite:sqlite-ktx:2.1.0"
implementation "androidx.sqlite:sqlite-framework:$sqlite_version"
implementation "androidx.sqlite:sqlite-ktx:$sqlite_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Aug 19 17:11:46 MST 2020
#Wed Nov 11 13:53:36 MST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
15 changes: 7 additions & 8 deletions library/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
compileSdkVersion 30
buildToolsVersion "30.0.2"

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionName "0.1.0"

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

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.sqlite:sqlite-framework:2.1.0"
implementation "androidx.sqlite:sqlite-ktx:2.1.0"
implementation "com.squareup.okio:okio:2.6.0"
implementation "androidx.sqlite:sqlite-ktx:$sqlite_version"

testImplementation "androidx.test.ext:junit-ktx:1.1.2"
testImplementation "androidx.test:core-ktx:1.3.0"
testImplementation 'org.robolectric:robolectric:4.3'
testImplementation "androidx.sqlite:sqlite-framework:$sqlite_version"
testImplementation 'junit:junit:4.12'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ import androidx.sqlite.db.framework.FrameworkSQLiteOpenHelperFactory
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Assert.assertEquals
import org.junit.Before
import org.junit.Test

import org.junit.runner.RunWith

@RunWith(AndroidJUnit4::class)
class SQLiteCopyOpenHelperTest {

private lateinit var context: Context

@Before
fun setup() {
context = ApplicationProvider.getApplicationContext()
}

@Test
fun copyEmptyDatabaseFileFromAssetPath() {
val context = ApplicationProvider.getApplicationContext<Context>()
val config = SupportSQLiteOpenHelper.Configuration.builder(context)
.callback(TestCallback())
.name("empty.db")
Expand All @@ -28,7 +36,6 @@ class SQLiteCopyOpenHelperTest {

@Test
fun destructivelyMigrate() {
val context = ApplicationProvider.getApplicationContext<Context>()
val configBuilder = SupportSQLiteOpenHelper.Configuration.builder(context)
.name("1.db")

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

0 comments on commit c024228

Please sign in to comment.