From 5a2e8a838c17e39b6cf7cf6822664771e49785bb Mon Sep 17 00:00:00 2001 From: Samuel Bronson Date: Wed, 18 Sep 2019 01:31:15 -0400 Subject: [PATCH 1/7] Update to kotlinx.coroutines 0.23.4 --- app/build.gradle | 2 +- .../java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 141e7ec695..cd36ad7c68 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -228,7 +228,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - final coroutines_version = '0.22.2' + final coroutines_version = '0.23.4' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" } diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt index a5313ac1f7..04d55ecdbf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt @@ -7,7 +7,7 @@ import kotlinx.coroutines.experimental.android.UI import kotlinx.coroutines.experimental.launch fun launchUI(block: suspend CoroutineScope.() -> Unit): Job = - launch(UI, CoroutineStart.DEFAULT, null, block) + launch(UI, CoroutineStart.DEFAULT, null, null, block) fun launchNow(block: suspend CoroutineScope.() -> Unit): Job = - launch(UI, CoroutineStart.UNDISPATCHED, null, block) + launch(UI, CoroutineStart.UNDISPATCHED, null, null, block) From ccd360687ec56cc7f4f69c5207257a8a641c3ff9 Mon Sep 17 00:00:00 2001 From: Samuel Bronson Date: Wed, 18 Sep 2019 13:20:39 -0400 Subject: [PATCH 2/7] Update to kotlinx.coroutines 0.26.0 --- app/build.gradle | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index cd36ad7c68..ee5f75ddac 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -228,8 +228,9 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - final coroutines_version = '0.23.4' + final coroutines_version = '0.26.0' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" + implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version" // TODO: hack! implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" } From 5362f62078532e47a5400304553c46731dd64cee Mon Sep 17 00:00:00 2001 From: Samuel Bronson Date: Wed, 18 Sep 2019 13:32:42 -0400 Subject: [PATCH 3/7] Update deprecated coroutines code --- .../extension/util/ExtensionInstallReceiver.kt | 5 ++++- .../eu/kanade/tachiyomi/util/CoroutinesExtensions.kt | 11 ++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt index 5067aa9362..12df620f14 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt @@ -7,6 +7,9 @@ import android.content.IntentFilter import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.LoadResult import eu.kanade.tachiyomi.util.launchNow +import kotlinx.coroutines.experimental.CoroutineStart +import kotlinx.coroutines.experimental.Dispatchers +import kotlinx.coroutines.experimental.GlobalScope import kotlinx.coroutines.experimental.async /** @@ -91,7 +94,7 @@ internal class ExtensionInstallReceiver(private val listener: Listener) : private suspend fun getExtensionFromIntent(context: Context, intent: Intent?): LoadResult { val pkgName = getPackageNameFromIntent(intent) ?: return LoadResult.Error("Package name not found") - return async { ExtensionLoader.loadExtensionFromPkgName(context, pkgName) }.await() + return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT, null, { ExtensionLoader.loadExtensionFromPkgName(context, pkgName) }).await() } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt index 04d55ecdbf..dda2051c17 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt @@ -1,13 +1,10 @@ package eu.kanade.tachiyomi.util -import kotlinx.coroutines.experimental.CoroutineScope -import kotlinx.coroutines.experimental.CoroutineStart -import kotlinx.coroutines.experimental.Job -import kotlinx.coroutines.experimental.android.UI -import kotlinx.coroutines.experimental.launch +import kotlinx.coroutines.experimental.* +import kotlinx.coroutines.experimental.android.Main fun launchUI(block: suspend CoroutineScope.() -> Unit): Job = - launch(UI, CoroutineStart.DEFAULT, null, null, block) + GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, null, block) fun launchNow(block: suspend CoroutineScope.() -> Unit): Job = - launch(UI, CoroutineStart.UNDISPATCHED, null, null, block) + GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, null, block) From 934a37c36bf45fb72cf7a10a123389bd4a4a8e82 Mon Sep 17 00:00:00 2001 From: Samuel Bronson Date: Wed, 18 Sep 2019 13:37:57 -0400 Subject: [PATCH 4/7] Update to kotlinx.coroutines 0.30.2 Almost done, honest! --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index ee5f75ddac..f7945d9d46 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -228,7 +228,7 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - final coroutines_version = '0.26.0' + final coroutines_version = '0.30.2' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version" // TODO: hack! implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" From fa59b4f8a7d10b30c69c7444048f219e160352e0 Mon Sep 17 00:00:00 2001 From: Samuel Bronson Date: Wed, 18 Sep 2019 17:41:09 -0400 Subject: [PATCH 5/7] Fix coroutine deprecations again --- .../tachiyomi/extension/util/ExtensionInstallReceiver.kt | 2 +- .../java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt index 12df620f14..6f08d8bc9b 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt @@ -94,7 +94,7 @@ internal class ExtensionInstallReceiver(private val listener: Listener) : private suspend fun getExtensionFromIntent(context: Context, intent: Intent?): LoadResult { val pkgName = getPackageNameFromIntent(intent) ?: return LoadResult.Error("Package name not found") - return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT, null, { ExtensionLoader.loadExtensionFromPkgName(context, pkgName) }).await() + return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT, { ExtensionLoader.loadExtensionFromPkgName(context, pkgName) }).await() } /** diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt index dda2051c17..2c77a7eb8a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt @@ -4,7 +4,7 @@ import kotlinx.coroutines.experimental.* import kotlinx.coroutines.experimental.android.Main fun launchUI(block: suspend CoroutineScope.() -> Unit): Job = - GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, null, block) + GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, block) fun launchNow(block: suspend CoroutineScope.() -> Unit): Job = - GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, null, block) + GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block) From 9276c491bc053226f734dce153276e560583c734 Mon Sep 17 00:00:00 2001 From: Samuel Bronson Date: Wed, 18 Sep 2019 22:45:54 -0400 Subject: [PATCH 6/7] Upgrade Kotlin (to 1.3), Coroutines, Gradle and Android gradle plugin. Kotlin: 1.2.71 -> 1.3.50 Coroutines: 0.30.2 -> 1.3.1 Gradle: 4.6 -> 5.4.1 Android gradle plugin: 3.2.1 -> 3.5.0 This brings us down to *one* experimental coroutine API, and we've opted in to using it in just *one* place. (The fact that the API to opt-in to using an experimental API in a specific place is *also* experimental surely will not come back to bite us later.) --- app/build.gradle | 13 +++++-------- .../eu/kanade/tachiyomi/data/download/Downloader.kt | 2 +- .../kanade/tachiyomi/extension/ExtensionManager.kt | 2 +- .../extension/util/ExtensionInstallReceiver.kt | 8 ++++---- .../tachiyomi/extension/util/ExtensionLoader.kt | 4 ++-- .../kanade/tachiyomi/util/CoroutinesExtensions.kt | 4 ++-- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.properties | 4 ++-- 8 files changed, 18 insertions(+), 21 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index f7945d9d46..da328ac366 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -228,14 +228,12 @@ dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - final coroutines_version = '0.30.2' - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version" - implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version" // TODO: hack! + final coroutines_version = '1.3.1' implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version" } buildscript { - ext.kotlin_version = '1.2.71' + ext.kotlin_version = '1.3.50' repositories { mavenCentral() } @@ -248,10 +246,9 @@ repositories { mavenCentral() } -kotlin { - experimental { - coroutines 'enable' - } +// See https://kotlinlang.org/docs/reference/experimental.html#experimental-status-of-experimental-api-markers +tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { + kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlin.Experimental"] } androidExtensions { diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 0ca5449361..f49585bc2e 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt @@ -14,7 +14,7 @@ import eu.kanade.tachiyomi.source.model.Page import eu.kanade.tachiyomi.source.online.HttpSource import eu.kanade.tachiyomi.source.online.fetchAllImageUrlsFromPageList import eu.kanade.tachiyomi.util.* -import kotlinx.coroutines.experimental.async +import kotlinx.coroutines.async import okhttp3.Response import rx.Observable import rx.android.schedulers.AndroidSchedulers diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt index a625c06e74..8dfcb27a40 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/ExtensionManager.kt @@ -13,7 +13,7 @@ import eu.kanade.tachiyomi.extension.util.ExtensionInstaller import eu.kanade.tachiyomi.extension.util.ExtensionLoader import eu.kanade.tachiyomi.source.SourceManager import eu.kanade.tachiyomi.util.launchNow -import kotlinx.coroutines.experimental.async +import kotlinx.coroutines.async import rx.Observable import rx.android.schedulers.AndroidSchedulers import rx.schedulers.Schedulers diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt index 6f08d8bc9b..2a55ccd7d9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionInstallReceiver.kt @@ -7,10 +7,10 @@ import android.content.IntentFilter import eu.kanade.tachiyomi.extension.model.Extension import eu.kanade.tachiyomi.extension.model.LoadResult import eu.kanade.tachiyomi.util.launchNow -import kotlinx.coroutines.experimental.CoroutineStart -import kotlinx.coroutines.experimental.Dispatchers -import kotlinx.coroutines.experimental.GlobalScope -import kotlinx.coroutines.experimental.async +import kotlinx.coroutines.CoroutineStart +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.GlobalScope +import kotlinx.coroutines.async /** * Broadcast receiver that listens for the system's packages installed, updated or removed, and only diff --git a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt index 805effe064..f211d7d95d 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/extension/util/ExtensionLoader.kt @@ -13,8 +13,8 @@ import eu.kanade.tachiyomi.source.CatalogueSource import eu.kanade.tachiyomi.source.Source import eu.kanade.tachiyomi.source.SourceFactory import eu.kanade.tachiyomi.util.Hash -import kotlinx.coroutines.experimental.async -import kotlinx.coroutines.experimental.runBlocking +import kotlinx.coroutines.async +import kotlinx.coroutines.runBlocking import timber.log.Timber import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt index 2c77a7eb8a..93665ffbed 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/CoroutinesExtensions.kt @@ -1,10 +1,10 @@ package eu.kanade.tachiyomi.util -import kotlinx.coroutines.experimental.* -import kotlinx.coroutines.experimental.android.Main +import kotlinx.coroutines.* fun launchUI(block: suspend CoroutineScope.() -> Unit): Job = GlobalScope.launch(Dispatchers.Main, CoroutineStart.DEFAULT, block) +@UseExperimental(ExperimentalCoroutinesApi::class) fun launchNow(block: suspend CoroutineScope.() -> Unit): Job = GlobalScope.launch(Dispatchers.Main, CoroutineStart.UNDISPATCHED, block) diff --git a/build.gradle b/build.gradle index 2885a88fc1..3381b34e4b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.5.0' classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' classpath 'com.github.zellius:android-shortcut-gradle-plugin:0.1.2' classpath 'com.google.gms:google-services:3.2.0' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index bccb59f891..a35c3abf01 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Sep 25 08:47:56 CEST 2018 +#Wed Sep 18 21:00:59 EDT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip From 76645bce6edc8b45403b6ab9291a3ecc385c2a47 Mon Sep 17 00:00:00 2001 From: Samuel Bronson Date: Fri, 20 Sep 2019 12:42:41 -0400 Subject: [PATCH 7/7] Remove redundant "publishNonDefault" setting I think I've seen the following message from just about every single gradle run throughout the upgrade process: publishNonDefault is deprecated and has no effect anymore. All variants are now published. --- app/build.gradle | 1 - 1 file changed, 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index da328ac366..9435d32a4c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -31,7 +31,6 @@ ext { android { compileSdkVersion 27 buildToolsVersion '28.0.3' - publishNonDefault true defaultConfig { applicationId "eu.kanade.tachiyomi"