Kotlin 1.3.70 and other dependencies updates. (#125)

* Update Kotlin, Gradle, binary-compatibility-validator, AGP, AndroidX, retrofit, okhttp, rx2.

* Replace deprecated @UseExperimental with @OptIn.

* Gradle 6.2.2.

* Update Coroutines to 1.3.4. Fix more compiler warnings.

* Update build-tools for travis.
This commit is contained in:
Yang 2020-03-08 01:38:02 +11:00 committed by GitHub
parent daa1c13ff7
commit 38baeb7c8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 130 additions and 117 deletions

View file

@ -5,7 +5,7 @@ android:
components:
- tools
- platform-tools
- build-tools-29.0.2
- build-tools-29.0.3
- android-29
- extra-android-m2repository
licenses:

View file

@ -37,7 +37,7 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += [
'-Xuse-experimental=kotlin.Experimental',
'-Xopt-in=kotlin.Experimental',
]
}
}
@ -47,12 +47,12 @@ dependencies {
testImplementation libraries.junit
testImplementation libraries.mockito
testImplementation libraries.coroutinesTest
implementation libraries.supportRecyclerView
implementation libraries.supportAppCompat
implementation libraries.supportFragments
implementation libraries.supportLifecycle
implementation libraries.supportCardView
implementation libraries.supportDesign
implementation libraries.recyclerView
implementation libraries.swipeRefreshLayout
implementation libraries.appCompat
implementation libraries.fragment
implementation libraries.lifecycle
implementation libraries.material
implementation libraries.retrofit
implementation libraries.roomRuntime
implementation libraries.coreKtx

View file

@ -30,7 +30,7 @@ import java.io.File
import java.io.IOException
import java.util.concurrent.TimeUnit
@UseExperimental(FlowPreview::class, ExperimentalCoroutinesApi::class)
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
object Graph {
private val moshi = Moshi.Builder().build()

View file

@ -13,7 +13,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.launch
@UseExperimental(FlowPreview::class, ExperimentalCoroutinesApi::class)
@OptIn(FlowPreview::class, ExperimentalCoroutinesApi::class)
class RedditViewModel(
app: Application
) : AndroidViewModel(app) {

View file

@ -29,6 +29,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:background="@color/white"
app:menu="@menu/bottom_navigation_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,47 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/post_horizontal_margin"
android:layout_marginTop="@dimen/post_horizontal_margin_half"
android:layout_marginRight="@dimen/post_horizontal_margin"
android:layout_marginBottom="@dimen/post_horizontal_margin_half"
card_view:cardCornerRadius="4dp"
card_view:cardElevation="7dp"
card_view:cardUseCompatPadding="false">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/post_horizontal_margin"
android:layout_marginRight="@dimen/post_horizontal_margin"
android:layout_marginTop="@dimen/post_horizontal_margin_half"
android:layout_marginBottom="@dimen/post_horizontal_margin_half"
android:orientation="vertical">
card_view:cardUseCompatPadding="false"
card_view:cardElevation="7dp"
card_view:cardCornerRadius="4dp">
<LinearLayout
android:orientation="vertical"
<View
android:id="@+id/topSpacer"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="@dimen/post_horizontal_margin" />
<View
android:id="@+id/topSpacer"
android:layout_width="match_parent"
android:layout_height="@dimen/post_horizontal_margin"/>
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:adjustViewBounds="true"
android:scaleType="fitStart" />
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/post_horizontal_margin_half"
android:layout_marginRight="@dimen/post_horizontal_margin_half"
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/post_horizontal_margin_half"
android:layout_marginRight="@dimen/post_horizontal_margin_half"
android:gravity="center"
android:padding="10dp"
android:textColor="@android:color/black"
android:textSize="18sp" />
</LinearLayout>
android:gravity="center"
android:padding="10dp"
android:textColor="@android:color/black"
android:textSize="18sp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.cardview.widget.CardView>

View file

@ -6,17 +6,16 @@ buildscript {
}
google()
jcenter()
maven { url "https://kotlin.bintray.com/kotlinx" }
}
ext.versions = [
androidGradlePlugin : '4.0.0-alpha09',
kotlin : '1.3.61',
androidGradlePlugin : '4.0.0-beta01',
kotlin : '1.3.70',
dokkaGradlePlugin : '0.10.0',
ktlintGradle : '9.1.1',
spotlessGradlePlugin : '3.26.1',
jacocoGradlePlugin : '0.8.5',
binaryCompatibilityValidator: '0.1.1',
binaryCompatibilityValidator: '0.2.1',
]
dependencies {

View file

@ -1,71 +1,76 @@
ext.versions = [
minSdk : 16,
targetSdk : 29,
compileSdk : 29,
buildTools : '29.0.2',
kotlin : '1.3.61',
ktlint : '0.36.0',
minSdk : 16,
targetSdk : 29,
compileSdk : 29,
buildTools : '29.0.3',
kotlin : '1.3.70',
ktlint : '0.36.0',
// UI libs.
picasso : '2.5.2',
picasso : '2.5.2',
// Others.
coroutines : '1.3.3',
retrofit : '2.7.1',
okHttp : '4.3.1',
okio : '2.4.3',
moshi : '1.9.2',
javax : '1',
room : '2.2.2',
coreKtx : '1.1.0',
lifecycle : '2.2.0',
navigation : '2.2.1',
constraintLayout : '1.1.3',
rx2 : '2.2.17',
coroutines : '1.3.4',
retrofit : '2.7.2',
okHttp : '4.4.0',
okio : '2.4.3',
moshi : '1.9.2',
javax : '1',
appCompat : '1.1.0',
fragment : '1.2.2',
recyclerView : '1.1.0',
swipeRefreshLayout: '1.0.0',
material : '1.1.0',
room : '2.2.4',
coreKtx : '1.2.0',
lifecycle : '2.2.0',
navigation : '2.2.1',
constraintLayout : '1.1.3',
rx2 : '2.2.18',
// Testing.
junit : '4.13',
truth : '1.0',
mockito : '2.24.0',
mockitoKotlin : '2.2.0',
junit : '4.13',
truth : '1.0',
mockito : '2.24.0',
mockitoKotlin : '2.2.0',
]
ext.libraries = [
// UI libs.
constraintLayout : "androidx.constraintlayout:constraintlayout:$versions.constraintLayout",
supportAppCompat : 'androidx.appcompat:appcompat:1.1.0',
supportLifecycle : "androidx.lifecycle:lifecycle-runtime-ktx:$versions.lifecycle",
lifecycleExtensions : "androidx.lifecycle:lifecycle-extensions:$versions.lifecycle",
navigationFragment : "androidx.navigation:navigation-fragment-ktx:$versions.navigation",
navigationUi : "androidx.navigation:navigation-ui-ktx:$versions.navigation",
supportCardView : 'androidx.cardview:cardview:1.0.0',
supportDesign : 'com.google.android.material:material:1.0.0',
supportRecyclerView : 'androidx.recyclerview:recyclerview:1.0.0',
supportFragments : 'androidx.fragment:fragment-ktx:1.1.0',
picasso : "com.squareup.picasso:picasso:$versions.picasso",
constraintLayout : "androidx.constraintlayout:constraintlayout:$versions.constraintLayout",
appCompat : "androidx.appcompat:appcompat:${versions.appCompat}",
lifecycle : "androidx.lifecycle:lifecycle-runtime-ktx:$versions.lifecycle",
lifecycleExtensions : "androidx.lifecycle:lifecycle-extensions:$versions.lifecycle",
navigationFragment : "androidx.navigation:navigation-fragment-ktx:$versions.navigation",
navigationUi : "androidx.navigation:navigation-ui-ktx:$versions.navigation",
material : "com.google.android.material:material:${versions.material}",
recyclerView : "androidx.recyclerview:recyclerview:${versions.recyclerView}",
swipeRefreshLayout : "androidx.swiperefreshlayout:swiperefreshlayout:${versions.swipeRefreshLayout}",
fragment : "androidx.fragment:fragment-ktx:${versions.fragment}",
picasso : "com.squareup.picasso:picasso:$versions.picasso",
// Others.
retrofit : "com.squareup.retrofit2:retrofit:$versions.retrofit",
retrofitMoshiConverter : "com.squareup.retrofit2:converter-moshi:$versions.retrofit",
okHttp : "com.squareup.okhttp:okhttp:$versions.okHttp",
okio : "com.squareup.okio:okio:$versions.okio",
moshi : "com.squareup.moshi:moshi:$versions.moshi",
moshiCodegen : "com.squareup.moshi:moshi-kotlin-codegen:$versions.moshi",
javax : "javax.inject:javax.inject:$versions.javax",
kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin",
roomCompiler : "androidx.room:room-compiler:$versions.room",
roomRuntime : "androidx.room:room-ktx:$versions.room",
coreKtx : "androidx.core:core-ktx:$versions.coreKtx",
rx2 : "io.reactivex.rxjava2:rxjava:$versions.rx2",
retrofit : "com.squareup.retrofit2:retrofit:$versions.retrofit",
retrofitMoshiConverter: "com.squareup.retrofit2:converter-moshi:$versions.retrofit",
okHttp : "com.squareup.okhttp:okhttp:$versions.okHttp",
okio : "com.squareup.okio:okio:$versions.okio",
moshi : "com.squareup.moshi:moshi:$versions.moshi",
moshiCodegen : "com.squareup.moshi:moshi-kotlin-codegen:$versions.moshi",
javax : "javax.inject:javax.inject:$versions.javax",
kotlinStdLib : "org.jetbrains.kotlin:kotlin-stdlib:$versions.kotlin",
roomCompiler : "androidx.room:room-compiler:$versions.room",
roomRuntime : "androidx.room:room-ktx:$versions.room",
coreKtx : "androidx.core:core-ktx:$versions.coreKtx",
rx2 : "io.reactivex.rxjava2:rxjava:$versions.rx2",
// Testing.
junit : "junit:junit:$versions.junit",
truth : "com.google.truth:truth:$versions.truth",
mockito : "org.mockito:mockito-core:$versions.mockito",
mockitoKotlin : "com.nhaarman.mockitokotlin2:mockito-kotlin:$versions.mockitoKotlin",
coroutinesCore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:$versions.coroutines",
junit : "junit:junit:$versions.junit",
truth : "com.google.truth:truth:$versions.truth",
mockito : "org.mockito:mockito-core:$versions.mockito",
mockitoKotlin : "com.nhaarman.mockitokotlin2:mockito-kotlin:$versions.mockitoKotlin",
coroutinesCore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:$versions.coroutines",
coroutinesRx : "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$versions.coroutines",
coroutinesReactive : "org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$versions.coroutines",
coroutinesAndroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.coroutines",
coroutinesTest : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$versions.coroutines"
coroutinesReactive : "org.jetbrains.kotlinx:kotlinx-coroutines-reactive:$versions.coroutines",
coroutinesAndroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:$versions.coroutines",
coroutinesTest : "org.jetbrains.kotlinx:kotlinx-coroutines-test:$versions.coroutines"
]

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip

View file

@ -25,5 +25,8 @@ compileKotlin {
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += [
'-Xopt-in=kotlin.RequiresOptIn',
]
}
}

View file

@ -22,7 +22,7 @@ import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestCoroutineScope
import org.junit.Test
@UseExperimental(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
class SharedFlowProducerTest {
private val scope = TestCoroutineScope()
private val upstreamMessages = mutableListOf<String>()

View file

@ -33,7 +33,7 @@ compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += [
'-Xuse-experimental=kotlin.Experimental',
'-Xopt-in=kotlin.RequiresOptIn',
]
}
}

View file

@ -25,12 +25,13 @@ import kotlinx.coroutines.cancelAndJoin
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.test.TestCoroutineScope
@UseExperimental(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
internal fun <T> TestCoroutineScope.assertThat(flow: Flow<T>): FlowSubject<T> {
return Truth.assertAbout(FlowSubject.Factory<T>(this)).that(flow)
}
@UseExperimental(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
internal class FlowSubject<T> constructor(
failureMetadata: FailureMetadata,
private val testCoroutineScope: TestCoroutineScope,

View file

@ -41,13 +41,16 @@ compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += [
'-Xuse-experimental=kotlin.Experimental',
'-Xopt-in=kotlin.Experimental',
]
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs += [
'-Xopt-in=kotlin.RequiresOptIn',
]
}
}

View file

@ -6,5 +6,5 @@ package com.dropbox.android.external.store4
*/
@MustBeDocumented
@Retention(value = AnnotationRetention.BINARY)
@Experimental(level = Experimental.Level.WARNING)
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
annotation class ExperimentalStoreApi

View file

@ -1,11 +1,13 @@
package com.dropbox.android.external.store4.impl.operators
import com.dropbox.android.external.store4.testutil.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.runBlockingTest
import org.junit.Test
@OptIn(ExperimentalCoroutinesApi::class)
class MapIndexedKtTest {
val scope = TestCoroutineScope()
@Test

View file

@ -29,7 +29,7 @@ import org.junit.runner.RunWith
import org.junit.runners.JUnit4
@RunWith(JUnit4::class)
@UseExperimental(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
class FlowSubjectTest {
// Can't use ExpectFailure in these tests because it is not a suspend function.
private val testScope = TestCoroutineScope()

View file

@ -26,12 +26,12 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.test.TestCoroutineScope
@UseExperimental(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
internal fun <T> TestCoroutineScope.assertThat(flow: Flow<T>): FlowSubject<T> {
return Truth.assertAbout(FlowSubject.Factory<T>(this)).that(flow)
}
@UseExperimental(ExperimentalCoroutinesApi::class)
@OptIn(ExperimentalCoroutinesApi::class)
internal class FlowSubject<T> constructor(
failureMetadata: FailureMetadata,
private val testCoroutineScope: TestCoroutineScope,