Dependency upgrades, running on AS 4.1

This commit is contained in:
Melih
2020-03-31 11:45:25 +02:00
parent bd1bc9cab0
commit 927c5c02ca
19 changed files with 64 additions and 53 deletions

View File

@@ -1,10 +1,12 @@
package com.melih.rocketscience package com.melih.rocketscience
import com.melih.core.di.DaggerCoreComponent import com.melih.core.di.DaggerCoreComponent
import com.melih.launches.data.LaunchDetailItem
import com.melih.rocketscience.di.DaggerAppComponent import com.melih.rocketscience.di.DaggerAppComponent
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
import dagger.android.DaggerApplication import dagger.android.DaggerApplication
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject
class App : DaggerApplication() { class App : DaggerApplication() {
override fun applicationInjector(): AndroidInjector<out DaggerApplication> = override fun applicationInjector(): AndroidInjector<out DaggerApplication> =
@@ -14,6 +16,8 @@ class App : DaggerApplication() {
.create(this) .create(this)
) )
@Inject
lateinit var item: LaunchDetailItem
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()

View File

@@ -1,9 +1,11 @@
package com.melih.rocketscience.di package com.melih.rocketscience.di
import com.melih.detail.di.DetailContributor import com.melih.detail.di.DetailContributor
import com.melih.launches.data.LaunchDetailItem
import com.melih.launches.di.LaunchesContributor import com.melih.launches.di.LaunchesContributor
import com.melih.rocketscience.MainActivity import com.melih.rocketscience.MainActivity
import dagger.Module import dagger.Module
import dagger.Provides
import dagger.android.ContributesAndroidInjector import dagger.android.ContributesAndroidInjector
@Module @Module
@@ -16,4 +18,12 @@ abstract class AppModule {
DetailContributor::class] DetailContributor::class]
) )
abstract fun mainActivity(): MainActivity abstract fun mainActivity(): MainActivity
@Module
companion object {
@JvmStatic
@Provides
fun provdeSomeObject() = LaunchDetailItem(10, "", "Rocket", "Desc")
}
} }

View File

@@ -1,18 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
ext.kotlin_version = '1.3.60' ext.kotlin_version = '1.3.71'
ext.nav_version = '2.2.0-beta01' ext.nav_version = '2.3.0-alpha04'
repositories { repositories {
google() google()
jcenter() jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:4.0.0-alpha07' classpath 'com.android.tools.build:gradle:4.1.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18" classpath "de.mannodermaus.gradle.plugins:android-junit5:1.6.0.1-SNAPSHOT"
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.5.1.0"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version" classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // in the individual module build.gradle files
@@ -20,8 +20,8 @@ buildscript {
} }
plugins { plugins {
id 'io.gitlab.arturbosch.detekt' version '1.1.1' id 'io.gitlab.arturbosch.detekt' version '1.7.2'
id 'org.jetbrains.dokka' version '0.9.18' id 'org.jetbrains.dokka' version '0.10.1'
id 'jacoco' id 'jacoco'
} }

View File

@@ -8,6 +8,7 @@ import dagger.android.DispatchingAndroidInjector
import dagger.android.HasAndroidInjector import dagger.android.HasAndroidInjector
import dagger.android.support.AndroidSupportInjection import dagger.android.support.AndroidSupportInjection
import javax.inject.Inject import javax.inject.Inject
import kotlin.properties.Delegates
/** /**
@@ -24,11 +25,11 @@ abstract class BaseDaggerFragment<T : ViewDataBinding> : BaseFragment<T>(), HasA
//region Properties //region Properties
@get:Inject @Inject
internal var androidInjector: DispatchingAndroidInjector<Any>? = null protected lateinit var androidInjector: DispatchingAndroidInjector<Any>
@Inject @Inject
lateinit var viewModelFactory: ViewModelFactory protected lateinit var viewModelFactory: ViewModelFactory
//endregion //endregion
//region Functions //region Functions
@@ -38,6 +39,6 @@ abstract class BaseDaggerFragment<T : ViewDataBinding> : BaseFragment<T>(), HasA
super.onAttach(context) super.onAttach(context)
} }
override fun androidInjector(): AndroidInjector<Any>? = androidInjector override fun androidInjector(): AndroidInjector<Any> = androidInjector
//endregion //endregion
} }

View File

@@ -35,7 +35,7 @@ const val INITIAL_PAGE = 0
* It's cancelled automatically when source factory [invalidates][invalidate] the source. * It's cancelled automatically when source factory [invalidates][invalidate] the source.
*/ */
@UseExperimental(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
abstract class BasePagingDataSource<R : ViewEntity> : PageKeyedDataSource<Int, R>() { abstract class BasePagingDataSource<R : ViewEntity> : PageKeyedDataSource<Int, R>() {
//region Abstractions //region Abstractions

View File

@@ -13,7 +13,7 @@ import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
import kotlin.coroutines.suspendCoroutine import kotlin.coroutines.suspendCoroutine
@UseExperimental(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
abstract class BaseTestWithMainThread { abstract class BaseTestWithMainThread {
private val dispatcher = TestCoroutineDispatcher() private val dispatcher = TestCoroutineDispatcher()

View File

@@ -1,5 +1,3 @@
@file:UseExperimental(ExperimentalCoroutinesApi::class)
package com.melih.core.paging package com.melih.core.paging
import androidx.paging.PageKeyedDataSource import androidx.paging.PageKeyedDataSource

View File

@@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.flowOn
/** /**
* Base use case that wraps [suspending][suspend] [run] function with [flow][Flow] and returns it for later usage. * Base use case that wraps [suspending][suspend] [run] function with [flow][Flow] and returns it for later usage.
*/ */
@UseExperimental(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
abstract class BaseInteractor<T, in P : InteractorParameters> { abstract class BaseInteractor<T, in P : InteractorParameters> {
//region Abstractions //region Abstractions

View File

@@ -15,7 +15,6 @@ import org.amshove.kluent.shouldEqualTo
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import java.util.ArrayDeque import java.util.ArrayDeque
@UseExperimental(ExperimentalCoroutinesApi::class)
class BaseInteractorTest { class BaseInteractorTest {
val testInteractor = spyk(TestInteractor()) val testInteractor = spyk(TestInteractor())

View File

@@ -20,6 +20,10 @@ class DetailViewModel @Inject constructor(
val rocketName = map(successData) { val rocketName = map(successData) {
it.rocketName it.rocketName
} }
get() {
loadData()
return field
}
val description = map(successData) { val description = map(successData) {
it.missionDescription it.missionDescription
@@ -30,10 +34,6 @@ class DetailViewModel @Inject constructor(
} }
//endregion //endregion
init {
loadData()
}
//region Functions //region Functions
/** /**

View File

@@ -8,7 +8,7 @@ import kotlinx.coroutines.test.setMain
import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@UseExperimental(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
abstract class BaseTestWithMainThread { abstract class BaseTestWithMainThread {
protected val dispatcher = TestCoroutineDispatcher() protected val dispatcher = TestCoroutineDispatcher()

View File

@@ -22,7 +22,6 @@ import org.junit.jupiter.api.Test
* *
* See [testing documentation](http://d.android.com/tools/testing). * See [testing documentation](http://d.android.com/tools/testing).
*/ */
@UseExperimental(ExperimentalCoroutinesApi::class)
class DetailViewModelTest : BaseTestWithMainThread() { class DetailViewModelTest : BaseTestWithMainThread() {
private val getLaunchDetails: GetLaunchDetails<LaunchDetailItem> = mockk(relaxed = true) private val getLaunchDetails: GetLaunchDetails<LaunchDetailItem> = mockk(relaxed = true)

View File

@@ -14,6 +14,7 @@ import com.melih.launches.data.LaunchItem
import com.melih.launches.databinding.LaunchesBinding import com.melih.launches.databinding.LaunchesBinding
import com.melih.launches.ui.adapters.LaunchesAdapter import com.melih.launches.ui.adapters.LaunchesAdapter
import com.melih.launches.ui.vm.LaunchesViewModel import com.melih.launches.ui.vm.LaunchesViewModel
import javax.inject.Inject
class LaunchesFragment : BaseDaggerFragment<LaunchesBinding>(), SwipeRefreshLayout.OnRefreshListener { class LaunchesFragment : BaseDaggerFragment<LaunchesBinding>(), SwipeRefreshLayout.OnRefreshListener {

View File

@@ -16,7 +16,6 @@ class LaunchesPagingSource @Inject constructor(
//region Functions //region Functions
@UseExperimental(ExperimentalCoroutinesApi::class)
override fun loadDataForPage(page: Int) = override fun loadDataForPage(page: Int) =
getLaunches( getLaunches(
getLaunchesParams.copy( getLaunchesParams.copy(

View File

@@ -1,5 +1,3 @@
@file:UseExperimental(ExperimentalCoroutinesApi::class)
package com.melih.launches package com.melih.launches
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
@@ -10,7 +8,7 @@ import kotlinx.coroutines.test.setMain
import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.BeforeEach
@UseExperimental(ExperimentalCoroutinesApi::class) @OptIn(ExperimentalCoroutinesApi::class)
abstract class BaseTestWithMainThread { abstract class BaseTestWithMainThread {
protected val dispatcher = TestCoroutineDispatcher() protected val dispatcher = TestCoroutineDispatcher()

View File

@@ -1,6 +1,6 @@
#Wed Jan 01 15:32:57 CET 2020 #Tue Mar 31 10:39:09 CEST 2020
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-milestone-2-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-rc-1-bin.zip

View File

@@ -1,9 +1,8 @@
apply plugin: 'io.gitlab.arturbosch.detekt' apply plugin: 'io.gitlab.arturbosch.detekt'
detekt { detekt {
toolVersion = "1.0.0" failFast = true
config = files("$rootProject.projectDir/default-detekt-config.yml") config = files("$rootProject.projectDir/default-detekt-config.yml")
filters = ".*/resources/.*,.*/build/.*"
reports { reports {
html { html {

View File

@@ -1,10 +1,13 @@
apply plugin: 'org.jetbrains.dokka-android' apply plugin: 'org.jetbrains.dokka'
dokka { dokka {
outputFormat = "html" outputFormat = "html"
outputDirectory = "$rootProject.projectDir/reports/javadoc" outputDirectory = "$rootProject.projectDir/reports/javadoc"
jdkVersion = 8
reportUndocumented = true configuration {
skipEmptyPackages = true jdkVersion = 8
reportUndocumented = true
skipEmptyPackages = true
}
} }

View File

@@ -4,32 +4,32 @@ ext {
minSdkVersion : 21, minSdkVersion : 21,
compileSdkVersion : 29, compileSdkVersion : 29,
targetSdkVersion : 29, targetSdkVersion : 29,
buildToolsVersion : "29.0.2", buildToolsVersion : "29.0.3",
appCompatVersion : "1.1.0", appCompatVersion : "1.1.0",
lifecycleVersion : "2.2.0-alpha05", lifecycleVersion : "2.2.0",
fragmentVersion : "1.2.0-rc01", fragmentVersion : "1.3.0-alpha02",
workManagerVersion : "2.3.0-alpha03", workManagerVersion : "2.4.0-alpha01",
constraintLayoutVesion : "2.0.0-beta3", constraintLayoutVesion : "2.0.0-beta4",
cardViewVersion : "1.0.0", cardViewVersion : "1.0.0",
recyclerViewVersion : "1.1.0-rc01", recyclerViewVersion : "1.2.0-alpha01",
pagingVersion : "2.1.0", pagingVersion : "2.1.0",
viewPagerVersion : "1.0.0-rc01", viewPagerVersion : "1.0.0",
materialVersion : "1.1.0-alpha09", materialVersion : "1.2.0-alpha05",
swipeRefreshLayoutVersion: "1.1.0-alpha03", swipeRefreshLayoutVersion: "1.1.0-beta01",
collectionVersion : "1.1.0", collectionVersion : "1.1.0",
roomVersion : "2.2.0", roomVersion : "2.2.5",
daggerVersion : "2.25.2", daggerVersion : "2.27",
okHttpVersion : "4.2.1", okHttpVersion : "4.4.0",
retrofitVersion : "2.6.2", retrofitVersion : "2.8.1",
picassoVersion : "2.71828", picassoVersion : "2.71828",
moshiVersion : "1.8.0", moshiVersion : "1.9.2",
coroutinesVersion : "1.3.2", coroutinesVersion : "1.3.5",
leakCanaryVersion : "2.0-beta-3", leakCanaryVersion : "2.2",
timberVersion : "4.7.1", timberVersion : "4.7.1",
jUnitVersion : "5.5.2", jUnitVersion : "5.6.0",
espressoVersion : "3.2.0", espressoVersion : "3.2.0",
mockkVersion : "1.9.3", mockkVersion : "1.9.3",
kluentVersion : "1.53", kluentVersion : "1.60",
] ]
libraries = [ libraries = [