From 2d1db48d21bc284da09006d1444e1092a4476078 Mon Sep 17 00:00:00 2001 From: Jake Wharton Date: Tue, 21 Nov 2017 15:12:31 -0500 Subject: [PATCH] Update to architecture components 1.0. --- build.gradle | 23 +++++++++---------- sample/build.gradle | 1 - .../example/sqlbrite/todo/db/DbCallback.java | 6 ++++- .../example/sqlbrite/todo/db/DbModule.java | 1 - sqlbrite-kotlin/build.gradle | 1 - sqlbrite/build.gradle | 1 - .../squareup/sqlbrite3/BriteDatabaseTest.java | 1 - .../com/squareup/sqlbrite3/QueryTest.java | 2 -- .../java/com/squareup/sqlbrite3/TestDb.java | 4 ++++ 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/build.gradle b/build.gradle index ca5148a5..9ca9e64e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,8 @@ buildscript { ext.versions = [ 'minSdk': 14, - 'compileSdk': 26, - 'buildTools': '26.0.1', - 'kotlin': '1.1.4-3', + 'compileSdk': 27, + 'kotlin': '1.1.60', ] repositories { @@ -13,7 +12,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-beta5' + classpath 'com.android.tools.build:gradle:3.0.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}" } } @@ -30,27 +29,27 @@ allprojects { ext { // Android dependencies. - supportV4 = 'com.android.support:support-v4:26.1.0' - supportAnnotations = 'com.android.support:support-annotations:26.1.0' + supportV4 = 'com.android.support:support-v4:27.0.0' + supportAnnotations = 'com.android.support:support-annotations:27.0.0' supportTestRunner = 'com.android.support.test:runner:0.5' - supportSqlite = 'android.arch.persistence.room:db:1.0.0-alpha9-1' - supportSqliteFramework = 'android.arch.persistence.room:db-impl:1.0.0-alpha9-1' + supportSqlite = 'android.arch.persistence:db:1.0.0' + supportSqliteFramework = 'android.arch.persistence:db-framework:1.0.0' // Third-party dependencies. kotlinStdLib = "org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}" - dagger = 'com.google.dagger:dagger:2.11' - daggerCompiler = 'com.google.dagger:dagger-compiler:2.11' + dagger = 'com.google.dagger:dagger:2.13' + daggerCompiler = 'com.google.dagger:dagger-compiler:2.13' butterKnifeRuntime = 'com.jakewharton:butterknife:8.8.1' butterKnifeCompiler = 'com.jakewharton:butterknife-compiler:8.8.1' - timber = 'com.jakewharton.timber:timber:4.5.1' + timber = 'com.jakewharton.timber:timber:4.6.0' autoValue = 'com.google.auto.value:auto-value:1.5' autoValueParcel = 'com.ryanharter.auto.value:auto-value-parcel:0.2.5' rxJava = 'io.reactivex.rxjava2:rxjava:2.1.3' rxAndroid = 'io.reactivex.rxjava2:rxandroid:2.0.1' rxBinding = 'com.jakewharton.rxbinding2:rxbinding:2.0.0' junit = 'junit:junit:4.12' - truth = 'com.google.truth:truth:0.35' + truth = 'com.google.truth:truth:0.36' } configurations { diff --git a/sample/build.gradle b/sample/build.gradle index 9d576659..02bb0e7e 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -24,7 +24,6 @@ dependencies { android { compileSdkVersion versions.compileSdk - buildToolsVersion versions.buildTools compileOptions { sourceCompatibility JavaVersion.VERSION_1_7 diff --git a/sample/src/main/java/com/example/sqlbrite/todo/db/DbCallback.java b/sample/src/main/java/com/example/sqlbrite/todo/db/DbCallback.java index e3d32295..a69d920a 100644 --- a/sample/src/main/java/com/example/sqlbrite/todo/db/DbCallback.java +++ b/sample/src/main/java/com/example/sqlbrite/todo/db/DbCallback.java @@ -24,7 +24,7 @@ import static android.database.sqlite.SQLiteDatabase.CONFLICT_FAIL; final class DbCallback extends SupportSQLiteOpenHelper.Callback { - static final int VERSION = 1; + private static final int VERSION = 1; private static final String CREATE_LIST = "" + "CREATE TABLE " + TodoList.TABLE + "(" @@ -42,6 +42,10 @@ final class DbCallback extends SupportSQLiteOpenHelper.Callback { private static final String CREATE_ITEM_LIST_ID_INDEX = "CREATE INDEX item_list_id ON " + TodoItem.TABLE + " (" + TodoItem.LIST_ID + ")"; + DbCallback() { + super(VERSION); + } + @Override public void onCreate(SupportSQLiteDatabase db) { db.execSQL(CREATE_LIST); db.execSQL(CREATE_ITEM); diff --git a/sample/src/main/java/com/example/sqlbrite/todo/db/DbModule.java b/sample/src/main/java/com/example/sqlbrite/todo/db/DbModule.java index 8d5c97e6..c2701fec 100644 --- a/sample/src/main/java/com/example/sqlbrite/todo/db/DbModule.java +++ b/sample/src/main/java/com/example/sqlbrite/todo/db/DbModule.java @@ -44,7 +44,6 @@ public final class DbModule { Configuration configuration = Configuration.builder(application) .name("todo.db") .callback(new DbCallback()) - .version(DbCallback.VERSION) .build(); Factory factory = new FrameworkSQLiteOpenHelperFactory(); SupportSQLiteOpenHelper helper = factory.create(configuration); diff --git a/sqlbrite-kotlin/build.gradle b/sqlbrite-kotlin/build.gradle index 59a67a2d..1e113549 100644 --- a/sqlbrite-kotlin/build.gradle +++ b/sqlbrite-kotlin/build.gradle @@ -8,7 +8,6 @@ dependencies { android { compileSdkVersion versions.compileSdk - buildToolsVersion versions.buildTools defaultConfig { minSdkVersion versions.minSdk diff --git a/sqlbrite/build.gradle b/sqlbrite/build.gradle index f5972f11..87b23f41 100644 --- a/sqlbrite/build.gradle +++ b/sqlbrite/build.gradle @@ -12,7 +12,6 @@ dependencies { android { compileSdkVersion versions.compileSdk - buildToolsVersion versions.buildTools defaultConfig { minSdkVersion versions.minSdk diff --git a/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/BriteDatabaseTest.java b/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/BriteDatabaseTest.java index 7502423f..26c41b94 100644 --- a/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/BriteDatabaseTest.java +++ b/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/BriteDatabaseTest.java @@ -88,7 +88,6 @@ public final class BriteDatabaseTest { @Before public void setUp() throws IOException { Configuration configuration = Configuration.builder(InstrumentationRegistry.getContext()) .callback(testDb) - .version(1) .name(dbFolder.newFile().getPath()) .build(); diff --git a/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/QueryTest.java b/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/QueryTest.java index 5181ee0b..dacecb8d 100644 --- a/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/QueryTest.java +++ b/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/QueryTest.java @@ -15,7 +15,6 @@ */ package com.squareup.sqlbrite3; -import android.annotation.TargetApi; import android.arch.persistence.db.SupportSQLiteOpenHelper; import android.arch.persistence.db.SupportSQLiteOpenHelper.Configuration; import android.arch.persistence.db.SupportSQLiteOpenHelper.Factory; @@ -48,7 +47,6 @@ public final class QueryTest { @Before public void setUp() { Configuration configuration = Configuration.builder(InstrumentationRegistry.getContext()) .callback(new TestDb()) - .version(1) .build(); Factory factory = new FrameworkSQLiteOpenHelperFactory(); diff --git a/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/TestDb.java b/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/TestDb.java index 71926e6b..df91280f 100644 --- a/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/TestDb.java +++ b/sqlbrite/src/androidTest/java/com/squareup/sqlbrite3/TestDb.java @@ -105,6 +105,10 @@ interface ManagerTable { long bobId; long eveId; + TestDb() { + super(1); + } + @Override public void onCreate(@NonNull SupportSQLiteDatabase db) { db.execSQL("PRAGMA foreign_keys=ON");