Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Update all dependencies (end_codelab_3) #309

Open
wants to merge 3 commits into
base: end_codelab_3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-kapt' // For DataBinding
apply plugin: 'com.google.devtools.ksp'
apply plugin: "androidx.navigation.safeargs.kotlin"

android {
compileSdkVersion rootProject.compileSdkVersion
compileSdk rootProject.compileSdkVersion
namespace "com.example.android.architecture.blueprints.todoapp"

defaultConfig {
applicationId "com.example.android.architecture.blueprints.reactive"
Expand All @@ -21,8 +23,11 @@ android {
}
}

buildFeatures {
buildConfig = true
dataBinding = true
}
dataBinding {
enabled = true
enabledForTests = true
}

Expand All @@ -31,7 +36,13 @@ android {
includeAndroidResources = true
returnDefaultValues = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
packagingOptions {
exclude 'META-INF/AL2.0'
exclude 'META-INF/LGPL2.1'
Expand All @@ -50,15 +61,15 @@ dependencies {
implementation "com.jakewharton.timber:timber:$timberVersion"
implementation "androidx.test.espresso:espresso-idling-resource:$espressoVersion"
implementation "androidx.room:room-runtime:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"
ksp "androidx.room:room-compiler:$roomVersion"

// Architecture Components
implementation "androidx.room:room-runtime:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"
ksp "androidx.room:room-compiler:$roomVersion"
implementation "androidx.room:room-ktx:$roomVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$archLifecycleVersion"
kapt "androidx.lifecycle:lifecycle-compiler:$archLifecycleVersion"
ksp "androidx.lifecycle:lifecycle-compiler:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$archLifecycleVersion"
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.example.android.architecture.blueprints.todoapp.data.Task
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runTest
import org.hamcrest.CoreMatchers.`is`
import org.hamcrest.CoreMatchers.notNullValue
import org.hamcrest.MatcherAssert.assertThat
Expand Down Expand Up @@ -58,7 +58,7 @@ class TasksDaoTest {
fun closeDb() = database.close()

@Test
fun insertTaskAndGetById() = runBlockingTest {
fun insertTaskAndGetById() = runTest {
// GIVEN - insert a task
val task = Task("title", "description")
database.taskDao().insertTask(task)
Expand All @@ -75,7 +75,7 @@ class TasksDaoTest {
}

@Test
fun updateTaskAndGetById() = runBlockingTest {
fun updateTaskAndGetById() = runTest {
// When inserting a task
val originalTask = Task("title", "description")
database.taskDao().insertTask(originalTask)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class TasksLocalDataSourceTest {
}

// runBlocking used here because of https://github.com/Kotlin/kotlinx.coroutines/issues/1204
// TODO replace with runBlockingTest once issue is resolved
// TODO replace with runTest once issue is resolved
@Test
fun saveTask_retrievesTask() = runBlocking {
// GIVEN - a new task saved in the database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import com.example.android.architecture.blueprints.todoapp.data.Task
import com.example.android.architecture.blueprints.todoapp.data.source.FakeAndroidTestRepository
import com.example.android.architecture.blueprints.todoapp.data.source.TasksRepository
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runTest
import org.hamcrest.core.IsNot.not
import org.junit.After
import org.junit.Before
Expand All @@ -54,12 +54,12 @@ class TaskDetailFragmentTest {
}

@After
fun cleanupDb() = runBlockingTest {
fun cleanupDb() = runTest {
ServiceLocator.resetRepository()
}

@Test
fun activeTaskDetails_DisplayedInUi() = runBlockingTest{
fun activeTaskDetails_DisplayedInUi() = runTest{
// GIVEN - Add active (incomplete) task to the DB
val activeTask = Task("Active Task", "AndroidX Rocks", false)
repository.saveTask(activeTask)
Expand All @@ -80,7 +80,7 @@ class TaskDetailFragmentTest {
}

@Test
fun completedTaskDetails_DisplayedInUi() = runBlockingTest{
fun completedTaskDetails_DisplayedInUi() = runTest{
// GIVEN - Add completed task to the DB
val completedTask = Task("Completed Task", "AndroidX Rocks", true)
repository.saveTask(completedTask)
Expand All @@ -99,4 +99,4 @@ class TaskDetailFragmentTest {
onView(withId(R.id.task_detail_complete_checkbox)).check(matches(isDisplayed()))
onView(withId(R.id.task_detail_complete_checkbox)).check(matches(isChecked()))
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import com.example.android.architecture.blueprints.todoapp.data.Task
import com.example.android.architecture.blueprints.todoapp.data.source.FakeAndroidTestRepository
import com.example.android.architecture.blueprints.todoapp.data.source.TasksRepository
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runTest
import org.junit.After
import org.junit.Before
import org.junit.Test
Expand All @@ -61,7 +61,7 @@ class TasksFragmentTest {
}

@After
fun cleanupDb() = runBlockingTest {
fun cleanupDb() = runTest {
ServiceLocator.resetRepository()
}

Expand All @@ -86,7 +86,7 @@ class TasksFragmentTest {
}

@Test
fun clickTask_navigateToDetailFragmentOne() = runBlockingTest {
fun clickTask_navigateToDetailFragmentOne() = runTest {
repository.saveTask(Task("TITLE1", "DESCRIPTION1", false, "id1"))
repository.saveTask(Task("TITLE2", "DESCRIPTION2", true, "id2"))

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
~ limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.architecture.blueprints.todoapp">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" >

<application
android:allowBackup="false"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ open class Event<out T>(private val content: T) {
* [onEventUnhandledContent] is *only* called if the [Event]'s contents has not been handled.
*/
class EventObserver<T>(private val onEventUnhandledContent: (T) -> Unit) : Observer<Event<T>> {
override fun onChanged(event: Event<T>?) {
event?.getContentIfNotHandled()?.let {
override fun onChanged(event: Event<T>) {
event.getContentIfNotHandled()?.let {
onEventUnhandledContent(it)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class TasksViewModel(
private var resultMessageShown: Boolean = false

// This LiveData depends on another so we can use a transformation.
val empty: LiveData<Boolean> = Transformations.map(_items) {
val empty: LiveData<Boolean> = _items.map {
it.isEmpty()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import org.junit.runner.Description
* ...
* mainCoroutineRule.resumeDispatcher()
* ...
* mainCoroutineRule.runBlockingTest { }
* mainCoroutineRule.runTest { }
* ...
*
* ```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import com.example.android.architecture.blueprints.todoapp.data.Result.Success
import com.example.android.architecture.blueprints.todoapp.data.Task
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.runTest
import org.hamcrest.core.IsEqual
import org.junit.Assert.*
import org.junit.Before
Expand Down Expand Up @@ -62,7 +62,7 @@ class DefaultTasksRepositoryTest {
}

@Test
fun getTasks_requestsAllTasksFromRemoteDataSource() = mainCoroutineRule.runBlockingTest {
fun getTasks_requestsAllTasksFromRemoteDataSource() = mainCoroutineRule.runTest {
// When tasks are requested from the tasks repository
val tasks = tasksRepository.getTasks(true) as Success

Expand Down
43 changes: 22 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
buildscript {
ext.kotlinVersion = '1.5.31'
ext.navigationVersion = '2.3.5'
ext.kotlinVersion = '2.1.0'
ext.navigationVersion = '2.8.4'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:8.7.3'
classpath 'com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:2.1.0-1.0.29'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigationVersion"

Expand All @@ -26,34 +27,34 @@ allprojects {
ext {
// Sdk and tools
minSdkVersion = 21
targetSdkVersion = 31
compileSdkVersion = 31
targetSdkVersion = 35
compileSdkVersion = 35

// App dependencies
androidXVersion = '1.0.0'
androidXTestCoreVersion = '1.4.0'
androidXTestExtKotlinRunnerVersion = '1.1.3'
androidXTestCoreVersion = '1.6.1'
androidXTestExtKotlinRunnerVersion = '1.2.1'
androidXTestRulesVersion = '1.2.0'
androidXAnnotations = '1.3.0'
appCompatVersion = '1.4.0'
archLifecycleVersion = '2.4.0'
archTestingVersion = '2.1.0'
androidXAnnotations = '1.9.1'
appCompatVersion = '1.7.0'
archLifecycleVersion = '2.8.7'
archTestingVersion = '2.2.0'
coroutinesVersion = '1.5.2'
cardVersion = '1.0.0'
coroutinesVersion = '1.5.0'
dexMakerVersion = '2.28.1'
espressoVersion = '3.4.0'
fragmentVersion = '1.4.0'
coroutinesVersion = '1.9.0'
dexMakerVersion = '2.28.4'
espressoVersion = '3.6.1'
fragmentVersion = '1.8.5'
hamcrestVersion = '1.3'
junitVersion = '4.13.2'
materialVersion = '1.4.0'
mockitoVersion = '3.4.6'
materialVersion = '1.12.0'
mockitoVersion = '5.14.2'
multiDexVersion = '2.0.1'
recyclerViewVersion = '1.2.1'
robolectricVersion = '4.5.1'
roomVersion = '2.3.0'
recyclerViewVersion = '1.3.2'
robolectricVersion = '4.14.1'
roomVersion = '2.6.1'
rulesVersion = '1.0.1'
swipeRefreshLayoutVersion = '1.1.0'
timberVersion = '4.7.1'
timberVersion = '5.0.1'
truthVersion = '1.1.2'
}
4 changes: 4 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@
# org.gradle.parallel=true
android.enableJetifier=true
android.useAndroidX=true

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 4 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Mon Jun 14 12:47:31 UTC 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading