From 2942a8bd65ccc0b2af872b1467f276778c019d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 15:04:49 +0300 Subject: [PATCH 1/9] Gradle upgraded Gradle upgraded to version 7.4.2 and Android Gradle Plugin Upgraded to version 7.2.2 --- build.gradle.kts | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 36385efed9..84873f8cb4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,8 +7,8 @@ import org.jetbrains.dokka.gradle.DokkaTaskPartial plugins { - id("com.android.application") apply false - id("com.android.library") apply false + id("com.android.application") apply false version "7.2.2" + id("com.android.library") apply false version "7.2.2" id("org.jetbrains.kotlin.android") apply false id("org.jetbrains.dokka") apply true } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ffed3a254e..be08841210 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,6 @@ +#Mon Aug 22 14:58:22 TRT 2022 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME From d0ddfc1bab9433014968aa71ff8ea8a7aa305f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 15:36:18 +0300 Subject: [PATCH 2/9] test-app version, targetSdk, compileSdk upgraded test-app version, targetSdk, compileSdk upgraded --- readium/lcp/build.gradle.kts | 12 +++---- readium/navigator-media2/build.gradle.kts | 4 +-- readium/navigator/build.gradle.kts | 4 +-- readium/opds/build.gradle.kts | 4 +-- readium/shared/build.gradle.kts | 4 +-- readium/streamer/build.gradle.kts | 4 +-- test-app/build.gradle.kts | 38 +++++++++++------------ 7 files changed, 35 insertions(+), 35 deletions(-) diff --git a/readium/lcp/build.gradle.kts b/readium/lcp/build.gradle.kts index 9e129f175a..ebd46e22f7 100644 --- a/readium/lcp/build.gradle.kts +++ b/readium/lcp/build.gradle.kts @@ -15,10 +15,10 @@ plugins { android { - compileSdk = 31 + compileSdk = 32 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 32 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { @@ -55,13 +55,13 @@ afterEvaluate { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") api(project(":readium:shared")) - implementation("androidx.constraintlayout:constraintlayout:2.1.3") - implementation("androidx.core:core-ktx:1.7.0") - implementation("com.google.android.material:material:1.5.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + implementation("androidx.core:core-ktx:1.8.0") + implementation("com.google.android.material:material:1.6.1") implementation("com.jakewharton.timber:timber:5.0.1") implementation("com.mcxiaoke.koi:async:0.5.5") { exclude(module = "support-v4") diff --git a/readium/navigator-media2/build.gradle.kts b/readium/navigator-media2/build.gradle.kts index bb00fa18d7..e9878bd002 100644 --- a/readium/navigator-media2/build.gradle.kts +++ b/readium/navigator-media2/build.gradle.kts @@ -15,11 +15,11 @@ plugins { android { resourcePrefix = "readium_" - compileSdk = 31 + compileSdk = 32 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 32 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { diff --git a/readium/navigator/build.gradle.kts b/readium/navigator/build.gradle.kts index 27ca2bbdc3..806e205784 100644 --- a/readium/navigator/build.gradle.kts +++ b/readium/navigator/build.gradle.kts @@ -16,11 +16,11 @@ android { // FIXME: This doesn't pass the lint because some resources don"t start with r2_ yet. We need to rename all resources for the next major version. // resourcePrefix "r2_" - compileSdk = 31 + compileSdk = 32 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 32 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { diff --git a/readium/opds/build.gradle.kts b/readium/opds/build.gradle.kts index 7d24433244..587cf2fba5 100644 --- a/readium/opds/build.gradle.kts +++ b/readium/opds/build.gradle.kts @@ -13,10 +13,10 @@ plugins { } android { - compileSdk = 31 + compileSdk = 32 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 32 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { diff --git a/readium/shared/build.gradle.kts b/readium/shared/build.gradle.kts index 5058c61d6d..f1faed5f14 100644 --- a/readium/shared/build.gradle.kts +++ b/readium/shared/build.gradle.kts @@ -13,10 +13,10 @@ plugins { } android { - compileSdk = 31 + compileSdk = 32 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 32 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { diff --git a/readium/streamer/build.gradle.kts b/readium/streamer/build.gradle.kts index 059b1090ab..3abe7b2ec5 100644 --- a/readium/streamer/build.gradle.kts +++ b/readium/streamer/build.gradle.kts @@ -13,10 +13,10 @@ plugins { } android { - compileSdk = 31 + compileSdk = 32 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 32 testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } compileOptions { diff --git a/test-app/build.gradle.kts b/test-app/build.gradle.kts index 8668c53e61..88b433e968 100644 --- a/test-app/build.gradle.kts +++ b/test-app/build.gradle.kts @@ -13,10 +13,10 @@ plugins { android { - compileSdk = 31 + compileSdk = 32 defaultConfig { minSdk = 21 - targetSdk = 31 + targetSdk = 32 applicationId = "org.readium.r2reader" @@ -60,7 +60,7 @@ android { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10") + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10") implementation("androidx.legacy:legacy-support-v4:1.0.0") implementation(project(":readium:shared")) @@ -71,19 +71,19 @@ dependencies { implementation(project(":readium:opds")) implementation(project(":readium:lcp")) - implementation("androidx.core:core-ktx:1.7.0") - implementation("androidx.activity:activity-ktx:1.4.0") - implementation("androidx.appcompat:appcompat:1.4.1") + implementation("androidx.core:core-ktx:1.8.0") + implementation("androidx.activity:activity-ktx:1.5.1") + implementation("androidx.appcompat:appcompat:1.5.0") implementation("androidx.browser:browser:1.4.0") implementation("androidx.cardview:cardview:1.0.0") - implementation("androidx.constraintlayout:constraintlayout:2.1.3") - implementation("androidx.fragment:fragment-ktx:1.4.0") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.4.0") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") - implementation("androidx.navigation:navigation-fragment-ktx:2.3.5") - implementation("androidx.navigation:navigation-ui-ktx:2.3.5") - implementation("androidx.paging:paging-runtime-ktx:3.1.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.4") + implementation("androidx.fragment:fragment-ktx:1.5.2") + implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1") + implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1") + implementation("androidx.navigation:navigation-fragment-ktx:2.5.1") + implementation("androidx.navigation:navigation-ui-ktx:2.5.1") + implementation("androidx.paging:paging-runtime-ktx:3.1.1") implementation("androidx.recyclerview:recyclerview:1.2.1") implementation("androidx.viewpager2:viewpager2:1.0.0") implementation("androidx.webkit:webkit:1.4.0") @@ -93,17 +93,17 @@ dependencies { implementation("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { exclude(group = "org.parboiled") } - implementation("com.google.android.material:material:1.5.0") + implementation("com.google.android.material:material:1.6.1") implementation("com.jakewharton.timber:timber:5.0.1") // AM NOTE: needs to stay this version for now (June 24,2020) implementation("com.squareup.picasso:picasso:2.71828") implementation("joda-time:joda-time:2.10.13") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") // AM NOTE: needs to stay this version for now (June 24,2020) implementation("org.jsoup:jsoup:1.14.3") - implementation("androidx.media2:media2-session:1.2.0") - implementation("androidx.media2:media2-player:1.2.0") + implementation("androidx.media2:media2-session:1.2.1") + implementation("androidx.media2:media2-player:1.2.1") // Room database val roomVersion = "2.4.1" @@ -112,7 +112,7 @@ dependencies { kapt("androidx.room:room-compiler:$roomVersion") implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") - kapt("androidx.lifecycle:lifecycle-compiler:2.4.0") + kapt("androidx.lifecycle:lifecycle-compiler:2.5.1") // Tests testImplementation("junit:junit:4.13.2") From 4939b7909ab9af083ede6fafbbf912abc03bd9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 15:46:07 +0300 Subject: [PATCH 3/9] streamer library dependencies upgrade streamer library dependencies upgrade --- readium/streamer/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readium/streamer/build.gradle.kts b/readium/streamer/build.gradle.kts index 3abe7b2ec5..6ab159c676 100644 --- a/readium/streamer/build.gradle.kts +++ b/readium/streamer/build.gradle.kts @@ -57,7 +57,7 @@ dependencies { api(project(":readium:shared")) - implementation("androidx.appcompat:appcompat:1.4.1") + implementation("androidx.appcompat:appcompat:1.5.0") @Suppress("GradleDependency") implementation("com.github.barteksc:pdfium-android:1.8.2") implementation("com.jakewharton.timber:timber:5.0.1") @@ -76,7 +76,7 @@ dependencies { exclude(module = "support-v4") } implementation("joda-time:joda-time:2.10.13") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") // Tests testImplementation("junit:junit:4.13.2") From 6443b75cb46debdda0044443eaf10a9b223abe33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 15:51:20 +0300 Subject: [PATCH 4/9] opds library dependencies upgraded opds library dependencies upgraded --- readium/opds/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/readium/opds/build.gradle.kts b/readium/opds/build.gradle.kts index 587cf2fba5..f4738b174d 100644 --- a/readium/opds/build.gradle.kts +++ b/readium/opds/build.gradle.kts @@ -53,11 +53,11 @@ dependencies { api(project(":readium:shared")) - implementation("androidx.appcompat:appcompat:1.4.1") + implementation("androidx.appcompat:appcompat:1.5.0") implementation("com.jakewharton.timber:timber:5.0.1") implementation("joda-time:joda-time:2.10.13") implementation("nl.komponents.kovenant:kovenant:3.3.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") // Tests testImplementation("junit:junit:4.13.2") From f50289d5f4cfb371ce802346af5de765ab9b4ece Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 16:02:10 +0300 Subject: [PATCH 5/9] navigator-media2 library dependencies upgraded. navigator-media2 library dependencies upgraded. --- readium/navigator-media2/build.gradle.kts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/readium/navigator-media2/build.gradle.kts b/readium/navigator-media2/build.gradle.kts index e9878bd002..2da2f9fe44 100644 --- a/readium/navigator-media2/build.gradle.kts +++ b/readium/navigator-media2/build.gradle.kts @@ -61,16 +61,16 @@ dependencies { api(project(":readium:shared")) api(project(":readium:navigator")) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") implementation("com.jakewharton.timber:timber:5.0.1") - implementation("androidx.media2:media2-session:1.2.0") - implementation("androidx.media2:media2-player:1.2.0") + implementation("androidx.media2:media2-session:1.2.1") + implementation("androidx.media2:media2-player:1.2.1") - implementation("com.google.android.exoplayer:exoplayer-core:2.16.1") - implementation("com.google.android.exoplayer:extension-media2:2.16.1") + implementation("com.google.android.exoplayer:exoplayer-core:2.18.1") + implementation("com.google.android.exoplayer:extension-media2:2.18.1") testImplementation("junit:junit:4.13.2") From 177c3b897bbc5ea7d5d15d145fe30c49ef07f4ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 16:34:09 +0300 Subject: [PATCH 6/9] libraries upgraded libraries upgraded --- readium/navigator/build.gradle.kts | 22 +++++++++++----------- readium/shared/build.gradle.kts | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/readium/navigator/build.gradle.kts b/readium/navigator/build.gradle.kts index 806e205784..104e409460 100644 --- a/readium/navigator/build.gradle.kts +++ b/readium/navigator/build.gradle.kts @@ -74,7 +74,7 @@ dependencies { implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0") implementation("androidx.recyclerview:recyclerview:1.2.1") - implementation("androidx.media:media:1.4.3") + implementation("androidx.media:media:1.6.0") implementation("androidx.viewpager2:viewpager2:1.0.0") implementation("androidx.webkit:webkit:1.4.0") // Needed to avoid a crash with API 31, see https://stackoverflow.com/a/69152986/1474476 @@ -84,20 +84,20 @@ dependencies { // ChrisBane/PhotoView ( for the Zoom handling ) implementation("com.github.chrisbanes:PhotoView:2.3.0") - implementation("androidx.media2:media2-session:1.2.0") - implementation("androidx.media2:media2-player:1.2.0") + implementation("androidx.media2:media2-session:1.2.1") + implementation("androidx.media2:media2-player:1.2.1") // ExoPlayer is used by the Audio Navigator. - api("com.google.android.exoplayer:exoplayer-core:2.16.1") - api("com.google.android.exoplayer:exoplayer-ui:2.16.1") - api("com.google.android.exoplayer:extension-mediasession:2.16.1") - api("com.google.android.exoplayer:extension-media2:2.16.1") - api("com.google.android.exoplayer:extension-workmanager:2.16.1") - implementation("com.google.android.material:material:1.5.0") + api("com.google.android.exoplayer:exoplayer-core:2.18.1") + api("com.google.android.exoplayer:exoplayer-ui:2.18.1") + api("com.google.android.exoplayer:extension-mediasession:2.18.1") + api("com.google.android.exoplayer:extension-media2:2.18.1") + api("com.google.android.exoplayer:extension-workmanager:2.18.1") + implementation("com.google.android.material:material:1.6.1") implementation("com.jakewharton.timber:timber:5.0.1") implementation("com.shopgun.android:utils:1.0.9") implementation("joda-time:joda-time:2.10.13") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") + implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") // AM NOTE: needs to stay this version for now (June 24,2020) //noinspection GradleDependency implementation("org.jsoup:jsoup:1.14.3") diff --git a/readium/shared/build.gradle.kts b/readium/shared/build.gradle.kts index f1faed5f14..cad596779d 100644 --- a/readium/shared/build.gradle.kts +++ b/readium/shared/build.gradle.kts @@ -75,7 +75,7 @@ dependencies { testImplementation("junit:junit:4.13.2") testImplementation("org.assertj:assertj-core:3.22.0") testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.6.10") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.0") + testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") testImplementation("org.robolectric:robolectric:4.7.3") androidTestImplementation("androidx.test.ext:junit:1.1.3") From 21b3f8e08bcf5355922b53514c04cccc057b9021 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 19:18:53 +0300 Subject: [PATCH 7/9] Added buildSrc to manage Android Configs from one place and implemented TOML Version Catalogs. Added buildSrc to manage Android Configs from one place and implemented TOML Version Catalogs. --- buildSrc/build.gradle.kts | 9 ++++ buildSrc/src/main/kotlin/AndroidConfig.kt | 47 +++++++++++++++++++ buildSrc/src/main/kotlin/Fields.kt | 7 +++ buildSrc/src/main/kotlin/ModuleDependency.kt | 47 +++++++++++++++++++ buildSrc/src/main/kotlin/Plugins.kt | 14 ++++++ gradle.properties | 2 + ...libs.versions.toml2 => libs.versions.toml} | 4 +- readium/lcp/build.gradle.kts | 12 +++-- readium/navigator-media2/build.gradle.kts | 15 +++--- readium/navigator/build.gradle.kts | 12 +++-- readium/opds/build.gradle.kts | 42 +++++++++-------- readium/shared/build.gradle.kts | 8 ++-- readium/streamer/build.gradle.kts | 12 +++-- settings.gradle.kts | 3 +- test-app/build.gradle.kts | 32 ++++++++----- 15 files changed, 205 insertions(+), 61 deletions(-) create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/kotlin/AndroidConfig.kt create mode 100644 buildSrc/src/main/kotlin/Fields.kt create mode 100644 buildSrc/src/main/kotlin/ModuleDependency.kt create mode 100644 buildSrc/src/main/kotlin/Plugins.kt rename gradle/{libs.versions.toml2 => libs.versions.toml} (97%) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 0000000000..8e88a958d7 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,9 @@ +import org.gradle.kotlin.dsl.`kotlin-dsl` + +plugins { + `kotlin-dsl` +} + +repositories { + mavenCentral() +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/AndroidConfig.kt b/buildSrc/src/main/kotlin/AndroidConfig.kt new file mode 100644 index 0000000000..2e3212a8cf --- /dev/null +++ b/buildSrc/src/main/kotlin/AndroidConfig.kt @@ -0,0 +1,47 @@ +import java.util.* + +object AndroidConfig { + const val APP_NAME = "R2 Reader" + const val APP_ID = "org.readium.r2reader" + const val MIN_SDK_VERSION = 21 + const val TARGET_SDK_VERSION = 32 + const val BUILD_TOOLS_VERSION = "30.0.3" + const val COMPILE_SDK_VERSION = 32 + const val NDK_VERSION = "23.0.7599858" + const val TEST_INSTRUMENTATION_RUNNER = "androidx.test.runner.AndroidJUnitRunner" + + const val VERSION_CODE = 1 + val VERSION_NAME = calculateVersionName() + private const val versionMajor = 2 + private const val versionMinor = 2 + private const val versionPatch = 0 + + private fun calculateVersionName(): String = "v$versionMajor.$versionMinor.$versionPatch" +} + +object Flavors { + object ProductFlavors { + const val DEV = "dev" + const val UAT = "uat" + const val PILOT = "pilot" + const val STORE = "store" + } + + object FlavorDimensions { + const val ENVIRONMENT = "environment" + } + + object BuildTypes { + const val DEBUG = "debug" + const val RELEASE = "release" + } + + object Default { + const val MAIN = "main" + private const val BUILD_TYPE = BuildTypes.DEBUG + private const val BUILD_FLAVOR = ProductFlavors.DEV + + val BUILD_VARIANT = + "${BUILD_FLAVOR.capitalize(Locale.ROOT)}${BUILD_TYPE.capitalize(Locale.ROOT)}" + } +} diff --git a/buildSrc/src/main/kotlin/Fields.kt b/buildSrc/src/main/kotlin/Fields.kt new file mode 100644 index 0000000000..6911927cbb --- /dev/null +++ b/buildSrc/src/main/kotlin/Fields.kt @@ -0,0 +1,7 @@ +object Fields { + const val SERVICE_URL = "SERVICE_URL" + const val SERVICE_API_KEY = "SERVICE_API_KEY" // optional + const val SERVICE_CERTIFICATE_PATH = "SERVICE_CERTIFICATE_PATH" // optional + + const val FIREBASE_APP_INTEGRATION_KEY = "FIREBASE_APP_INTEGRATION_KEY" +} diff --git a/buildSrc/src/main/kotlin/ModuleDependency.kt b/buildSrc/src/main/kotlin/ModuleDependency.kt new file mode 100644 index 0000000000..182d06121c --- /dev/null +++ b/buildSrc/src/main/kotlin/ModuleDependency.kt @@ -0,0 +1,47 @@ +import org.gradle.api.artifacts.Dependency +import org.gradle.api.artifacts.dsl.DependencyHandler +import kotlin.reflect.full.memberProperties + +// "Module" means "subproject" in terminology of Gradle API. +// To be specific each "Android module" is a Gradle "subproject" +@Suppress("unused") +object ModuleDependency { + // All consts are accessed via reflection + const val APP = ":app" + const val FEATURE_DATA = ":data" + + // False positive" function can be private" + // See: https://youtrack.jetbrains.com/issue/KT-33610 + /* + Return list of all modules in the project + */ + private fun getAllModules() = ModuleDependency::class.memberProperties + .filter { it.isConst } + .map { it.getter.call().toString() } + .toSet() + + /* + Return list of feature modules in the project + */ + fun getFeatureModules(): Set { + val featurePrefix = "" + + return getAllModules() + .filter { it.startsWith(featurePrefix) } + .toSet() + } + + object Project { + fun DependencyHandler.streamer(): Dependency = project(mapOf("path" to ":readium:streamer")) + fun DependencyHandler.navigator(): Dependency = + project(mapOf("path" to ":readium:navigator")) + + fun DependencyHandler.navigatorMedia2(): Dependency = + project(mapOf("path" to ":readium:navigator-media2")) + + fun DependencyHandler.opds(): Dependency = project(mapOf("path" to ":readium:opds")) + fun DependencyHandler.lcp(): Dependency = project(mapOf("path" to ":readium:lcp")) + fun DependencyHandler.shared(): Dependency = project(mapOf("path" to ":readium:shared")) + fun DependencyHandler.app(): Dependency = project(mapOf("path" to ":test-app")) + } +} diff --git a/buildSrc/src/main/kotlin/Plugins.kt b/buildSrc/src/main/kotlin/Plugins.kt new file mode 100644 index 0000000000..db2131e339 --- /dev/null +++ b/buildSrc/src/main/kotlin/Plugins.kt @@ -0,0 +1,14 @@ +object Plugins { + const val ANDROID_LIBRARY = "com.android.library" + const val ANDROID_APPLICATION = "com.android.application" + const val ANDROID = "android" + const val KOTLIN_PARCELIZE = "kotlin-parcelize" + const val MAVEN_PUBLISH = "maven-publish" + const val DOKKA = "org.jetbrains.dokka" + const val KAPT = "kapt" + const val SAFE_ARGS = "androidx.navigation.safeargs.kotlin" + const val DETEKT = "io.gitlab.arturbosch.detekt" + const val KTLINT_GRADLE = "org.jlleitschuh.gradle.ktlint" + const val ANDROID_JUNIT_5 = "de.mannodermaus.android-junit5" + const val DAGGER_HILT = "dagger.hilt.android.plugin" +} diff --git a/gradle.properties b/gradle.properties index cac7c68c14..c064741c76 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,3 +19,5 @@ android.useAndroidX=true android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official + +android.disableAutomaticComponentCreation=true diff --git a/gradle/libs.versions.toml2 b/gradle/libs.versions.toml similarity index 97% rename from gradle/libs.versions.toml2 rename to gradle/libs.versions.toml index a862ab6d98..30fee2d686 100644 --- a/gradle/libs.versions.toml2 +++ b/gradle/libs.versions.toml @@ -1,5 +1,3 @@ -# Eventually want to use this for dependencies, but Android Studio is not ready - [versions] kotlin = "1.6.10" dokka = "1.5.30" @@ -28,6 +26,7 @@ robolectric = "4.7.3" kotlin-junit = "1.6.10" assertj = "3.21.0" coroutines-test = "1.5.2" +kovenant = "3.3.0" [libraries] kotlin-gradle = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } @@ -68,6 +67,7 @@ robolectric = { group = "org.robolectric", name = "robolectric", version.ref = " kotlin-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin-junit" } assertj = { group = "org.assertj", name = "assertj-core", version.ref = "assertj" } coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines-test" } +kovenant = { group = "nl.komponents.kovenant", name = "kovenant", version.ref = "kovenant" } [bundles] room = ["room-runtime", "room-compiler"] diff --git a/readium/lcp/build.gradle.kts b/readium/lcp/build.gradle.kts index ebd46e22f7..5a926f5fb1 100644 --- a/readium/lcp/build.gradle.kts +++ b/readium/lcp/build.gradle.kts @@ -1,3 +1,5 @@ +import ModuleDependency.Project.shared + /* * Copyright 2018 Readium Foundation. All rights reserved. * Use of this source code is governed by the BSD-style license @@ -15,11 +17,11 @@ plugins { android { - compileSdk = 32 + compileSdk = AndroidConfig.COMPILE_SDK_VERSION defaultConfig { - minSdk = 21 - targetSdk = 32 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -57,7 +59,7 @@ dependencies { implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") - api(project(":readium:shared")) + api(shared()) implementation("androidx.constraintlayout:constraintlayout:2.1.4") implementation("androidx.core:core-ktx:1.8.0") diff --git a/readium/navigator-media2/build.gradle.kts b/readium/navigator-media2/build.gradle.kts index 2da2f9fe44..cbdc31499b 100644 --- a/readium/navigator-media2/build.gradle.kts +++ b/readium/navigator-media2/build.gradle.kts @@ -1,3 +1,6 @@ +import ModuleDependency.Project.navigator +import ModuleDependency.Project.shared + /* * Copyright 2022 Readium Foundation. All rights reserved. * Use of this source code is governed by the BSD-style license @@ -15,12 +18,12 @@ plugins { android { resourcePrefix = "readium_" - compileSdk = 32 + compileSdk = AndroidConfig.COMPILE_SDK_VERSION defaultConfig { - minSdk = 21 - targetSdk = 32 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -58,8 +61,8 @@ afterEvaluate { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - api(project(":readium:shared")) - api(project(":readium:navigator")) + api(shared()) + api(navigator()) implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") diff --git a/readium/navigator/build.gradle.kts b/readium/navigator/build.gradle.kts index 104e409460..1df2cc78de 100644 --- a/readium/navigator/build.gradle.kts +++ b/readium/navigator/build.gradle.kts @@ -1,3 +1,5 @@ +import ModuleDependency.Project.shared + /* * Copyright 2018 Readium Foundation. All rights reserved. * Use of this source code is governed by the BSD-style license @@ -16,12 +18,12 @@ android { // FIXME: This doesn't pass the lint because some resources don"t start with r2_ yet. We need to rename all resources for the next major version. // resourcePrefix "r2_" - compileSdk = 32 + compileSdk = AndroidConfig.COMPILE_SDK_VERSION defaultConfig { - minSdk = 21 - targetSdk = 32 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -59,7 +61,7 @@ afterEvaluate { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - api(project(":readium:shared")) + api(shared()) implementation("androidx.activity:activity-ktx:1.4.0") implementation("androidx.appcompat:appcompat:1.4.1") diff --git a/readium/opds/build.gradle.kts b/readium/opds/build.gradle.kts index f4738b174d..2e3db7133b 100644 --- a/readium/opds/build.gradle.kts +++ b/readium/opds/build.gradle.kts @@ -1,3 +1,5 @@ +import ModuleDependency.Project.shared + /* * Copyright 2018 Readium Foundation. All rights reserved. * Use of this source code is governed by the BSD-style license @@ -5,19 +7,19 @@ */ plugins { - id("com.android.library") - id("kotlin-android") - id("kotlin-parcelize") - id("maven-publish") - id("org.jetbrains.dokka") + id(Plugins.ANDROID_LIBRARY) + kotlin(Plugins.ANDROID) + id(Plugins.KOTLIN_PARCELIZE) + id(Plugins.MAVEN_PUBLISH) + id(Plugins.DOKKA) } android { - compileSdk = 32 + compileSdk = AndroidConfig.COMPILE_SDK_VERSION defaultConfig { - minSdk = 21 - targetSdk = 32 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -27,7 +29,7 @@ android { unitTests.isIncludeAndroidResources = true } buildTypes { - getByName("release") { + getByName(Flavors.BuildTypes.RELEASE) { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android.txt")) } @@ -51,17 +53,17 @@ afterEvaluate { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - api(project(":readium:shared")) + api(shared()) - implementation("androidx.appcompat:appcompat:1.5.0") - implementation("com.jakewharton.timber:timber:5.0.1") - implementation("joda-time:joda-time:2.10.13") - implementation("nl.komponents.kovenant:kovenant:3.3.0") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation(libs.appcompat) + implementation(libs.timber) + implementation(libs.joda.time) + implementation(libs.kovenant) + implementation(libs.coroutines.core) // Tests - testImplementation("junit:junit:4.13.2") - testImplementation("org.robolectric:robolectric:4.7.3") - androidTestImplementation("androidx.test.ext:junit:1.1.3") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + testImplementation(libs.junit) + testImplementation(libs.robolectric) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.expresso.core) } diff --git a/readium/shared/build.gradle.kts b/readium/shared/build.gradle.kts index cad596779d..acdb8c6e35 100644 --- a/readium/shared/build.gradle.kts +++ b/readium/shared/build.gradle.kts @@ -13,11 +13,11 @@ plugins { } android { - compileSdk = 32 + compileSdk = AndroidConfig.COMPILE_SDK_VERSION defaultConfig { - minSdk = 21 - targetSdk = 32 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 diff --git a/readium/streamer/build.gradle.kts b/readium/streamer/build.gradle.kts index 6ab159c676..bd16fc0e6d 100644 --- a/readium/streamer/build.gradle.kts +++ b/readium/streamer/build.gradle.kts @@ -1,3 +1,5 @@ +import ModuleDependency.Project.shared + /* * Copyright 2018 Readium Foundation. All rights reserved. * Use of this source code is governed by the BSD-style license @@ -13,11 +15,11 @@ plugins { } android { - compileSdk = 32 + compileSdk = AndroidConfig.COMPILE_SDK_VERSION defaultConfig { - minSdk = 21 - targetSdk = 32 - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER } compileOptions { sourceCompatibility = JavaVersion.VERSION_1_8 @@ -55,7 +57,7 @@ afterEvaluate { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - api(project(":readium:shared")) + api(shared()) implementation("androidx.appcompat:appcompat:1.5.0") @Suppress("GradleDependency") diff --git a/settings.gradle.kts b/settings.gradle.kts index cbc6e1d962..4dac5a3438 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,8 +4,7 @@ * available in the top-level LICENSE file of the project. */ -// FIXME: Android Studio doesn't support the gradle/libs.versions.toml2 well yet. -//enableFeaturePreview("VERSION_CATALOGS") +enableFeaturePreview("VERSION_CATALOGS") pluginManagement { repositories { diff --git a/test-app/build.gradle.kts b/test-app/build.gradle.kts index 88b433e968..4f2c14055c 100644 --- a/test-app/build.gradle.kts +++ b/test-app/build.gradle.kts @@ -1,3 +1,10 @@ +import ModuleDependency.Project.lcp +import ModuleDependency.Project.navigator +import ModuleDependency.Project.navigatorMedia2 +import ModuleDependency.Project.opds +import ModuleDependency.Project.shared +import ModuleDependency.Project.streamer + /* * Copyright 2021 Readium Foundation. All rights reserved. * Use of this source code is governed by the BSD-style license @@ -13,16 +20,17 @@ plugins { android { - compileSdk = 32 + compileSdk = AndroidConfig.COMPILE_SDK_VERSION defaultConfig { - minSdk = 21 - targetSdk = 32 - applicationId = "org.readium.r2reader" + minSdk = AndroidConfig.MIN_SDK_VERSION + targetSdk = AndroidConfig.TARGET_SDK_VERSION + + applicationId = AndroidConfig.APP_ID - versionName = "2.2.0" + versionName = AndroidConfig.VERSION_NAME - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + testInstrumentationRunner = AndroidConfig.TEST_INSTRUMENTATION_RUNNER ndk.abiFilters.add("armeabi-v7a") ndk.abiFilters.add("arm64-v8a") ndk.abiFilters.add("x86") @@ -63,13 +71,13 @@ dependencies { implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10") implementation("androidx.legacy:legacy-support-v4:1.0.0") - implementation(project(":readium:shared")) - implementation(project(":readium:streamer")) - implementation(project(":readium:navigator")) - implementation(project(":readium:navigator-media2")) + implementation(shared()) + implementation(streamer()) + implementation(navigator()) + implementation(navigatorMedia2()) - implementation(project(":readium:opds")) - implementation(project(":readium:lcp")) + implementation(opds()) + implementation(lcp()) implementation("androidx.core:core-ktx:1.8.0") implementation("androidx.activity:activity-ktx:1.5.1") From 8bf32ede4c20c94d613e36ebe412732f76b5bc48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 21:10:12 +0300 Subject: [PATCH 8/9] TOML library implementation TOML library implementation --- build.gradle.kts | 8 +-- buildSrc/src/main/kotlin/Plugins.kt | 3 +- gradle/libs.versions.toml | 32 +++++++++--- readium/lcp/build.gradle.kts | 45 ++++++++--------- readium/navigator-media2/build.gradle.kts | 28 +++++------ readium/navigator/build.gradle.kts | 61 ++++++++++------------- readium/opds/build.gradle.kts | 4 +- readium/shared/build.gradle.kts | 41 +++++++-------- readium/streamer/build.gradle.kts | 33 ++++++------ test-app/build.gradle.kts | 56 ++++++++++----------- 10 files changed, 151 insertions(+), 160 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 84873f8cb4..174d0adb3f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,10 +7,10 @@ import org.jetbrains.dokka.gradle.DokkaTaskPartial plugins { - id("com.android.application") apply false version "7.2.2" - id("com.android.library") apply false version "7.2.2" - id("org.jetbrains.kotlin.android") apply false - id("org.jetbrains.dokka") apply true + id(Plugins.ANDROID_APPLICATION) apply false version "7.2.2" + id(Plugins.ANDROID_LIBRARY) apply false version "7.2.2" + kotlin(Plugins.ANDROID) apply false + id(Plugins.DOKKA) apply true } subprojects { diff --git a/buildSrc/src/main/kotlin/Plugins.kt b/buildSrc/src/main/kotlin/Plugins.kt index db2131e339..3bb16df057 100644 --- a/buildSrc/src/main/kotlin/Plugins.kt +++ b/buildSrc/src/main/kotlin/Plugins.kt @@ -3,9 +3,10 @@ object Plugins { const val ANDROID_APPLICATION = "com.android.application" const val ANDROID = "android" const val KOTLIN_PARCELIZE = "kotlin-parcelize" + const val KOTLIN_ANDROID = "kotlin-android" const val MAVEN_PUBLISH = "maven-publish" const val DOKKA = "org.jetbrains.dokka" - const val KAPT = "kapt" + const val KAPT = "kotlin-kapt" const val SAFE_ARGS = "androidx.navigation.safeargs.kotlin" const val DETEKT = "io.gitlab.arturbosch.detekt" const val KTLINT_GRADLE = "org.jlleitschuh.gradle.ktlint" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 30fee2d686..2bcc2fd01b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,17 +1,17 @@ [versions] kotlin = "1.6.10" dokka = "1.5.30" -room = "2.4.0" +room = "2.4.1" coroutines = "1.6.0" exoplayer = "2.16.1" lifecycle = "2.4.0" navigation = "2.3.5" -constraint = "2.1.2" +constraint = "2.1.3" androidx-core = "1.7.0" -material = "1.4.0" +material = "1.5.0" androidx-browser = "1.4.0" activity-ktx = "1.4.0" -appcompat = "1.4.0" +appcompat = "1.4.1" fragment-ktx = "1.4.0" legacy = "1.0.0" recyclerview = "1.2.1" @@ -27,6 +27,9 @@ kotlin-junit = "1.6.10" assertj = "3.21.0" coroutines-test = "1.5.2" kovenant = "3.3.0" +mcxiaoke = "0.5.5" +zeroturnaround = "1.14" +media2 = "1.2.1" [libraries] kotlin-gradle = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } @@ -39,6 +42,7 @@ coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutin exoplayer-core = { group = "com.google.android.exoplayer", name = "exoplayer-core", version.ref = "exoplayer" } exoplayer-ui = { group = "com.google.android.exoplayer", name = "exoplayer-ui", version.ref = "exoplayer" } exoplayer-mediasession = { group = "com.google.android.exoplayer", name = "extension-mediasession", version.ref = "exoplayer" } +exoplayer-extension-media2 = { group = "com.google.android.exoplayer", name = "extension-media2", version.ref = "exoplayer" } exoplayer-workmanager = { group = "com.google.android.exoplayer", name = "extension-workmanager", version.ref = "exoplayer" } lifecycle-livedata = { group = "androidx.lifecycle", name = "lifecycle-livedata-ktx", version.ref = "lifecycle" } lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } @@ -67,14 +71,28 @@ robolectric = { group = "org.robolectric", name = "robolectric", version.ref = " kotlin-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin-junit" } assertj = { group = "org.assertj", name = "assertj-core", version.ref = "assertj" } coroutines-test = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-test", version.ref = "coroutines-test" } -kovenant = { group = "nl.komponents.kovenant", name = "kovenant", version.ref = "kovenant" } +kovenant-base = { group = "nl.komponents.kovenant", name = "kovenant", version.ref = "kovenant" } +kovenant-android = { group = "nl.komponents.kovenant", name = "kovenant-android", version.ref = "kovenant" } +kovenant-combine = { group = "nl.komponents.kovenant", name = "kovenant-combine", version.ref = "kovenant" } +kovenant-core = { group = "nl.komponents.kovenant", name = "kovenant-core", version.ref = "kovenant" } +kovenant-functional = { group = "nl.komponents.kovenant", name = "kovenant-functional", version.ref = "kovenant" } +kovenant-jvm = { group = "nl.komponents.kovenant", name = "kovenant-jvm", version.ref = "kovenant" } + +mcxiaoke-async = { group = "com.mcxiaoke.koi", name = "async", version.ref = "mcxiaoke" } +mcxiaoke-core = { group = "com.mcxiaoke.koi", name = "core", version.ref = "mcxiaoke" } +zeroturnaround = { group = "org.zeroturnaround", name = "zt-zip", version.ref = "zeroturnaround" } +media2-session = { group = "androidx.media2", name = "media2-session", version.ref = "media2" } +media2-player = { group = "androidx.media2", name = "media2-player", version.ref = "media2" } [bundles] -room = ["room-runtime", "room-compiler"] -exoplayer = ["exoplayer-core", "exoplayer-ui", "exoplayer-mediasession", "exoplayer-workmanager"] +room = ["room-runtime", "room-ktx"] +exoplayer = ["exoplayer-core", "exoplayer-ui", "exoplayer-mediasession", "exoplayer-extension-media2", "exoplayer-workmanager"] coroutines = ["coroutines-core", "coroutines-android"] lifecycle = ["lifecycle-livedata", "lifecycle-runtime", "lifecycle-viewmodel", "lifecycle-vmsavedstate"] navigation = ["navigation-fragment", "navigation-ui"] +mcxiaoke = ["mcxiaoke-async", "mcxiaoke-core"] +media2 = ["media2-session", "media2-player"] +kovenant = ["kovenant-base", "kovenant-android", "kovenant-combine", "kovenant-core", "kovenant-functional", "kovenant-jvm"] test-frameworks = ["junit", "ext-junit", "expresso-core", "robolectric", "kotlin-junit", "assertj", "coroutines-test"] [plugins] \ No newline at end of file diff --git a/readium/lcp/build.gradle.kts b/readium/lcp/build.gradle.kts index 5a926f5fb1..60b5e7b702 100644 --- a/readium/lcp/build.gradle.kts +++ b/readium/lcp/build.gradle.kts @@ -7,12 +7,12 @@ import ModuleDependency.Project.shared */ plugins { - id("com.android.library") - id("kotlin-android") - id("kotlin-parcelize") - id("kotlin-kapt") - id("maven-publish") - id("org.jetbrains.dokka") + id(Plugins.ANDROID_LIBRARY) + id(Plugins.KOTLIN_ANDROID) + id(Plugins.KOTLIN_PARCELIZE) + id(Plugins.KAPT) + id(Plugins.MAVEN_PUBLISH) + id(Plugins.DOKKA) } android { @@ -57,32 +57,27 @@ afterEvaluate { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation(libs.coroutines.core) api(shared()) - implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.core:core-ktx:1.8.0") - implementation("com.google.android.material:material:1.6.1") - implementation("com.jakewharton.timber:timber:5.0.1") - implementation("com.mcxiaoke.koi:async:0.5.5") { + implementation(libs.constraint.layout) + implementation(libs.androidx.core) + implementation(libs.material) + implementation(libs.timber) + implementation(libs.bundles.mcxiaoke) { exclude(module = "support-v4") } - implementation("com.mcxiaoke.koi:core:0.5.5") { - exclude(module = "support-v4") - } - implementation("joda-time:joda-time:2.10.13") - implementation("org.zeroturnaround:zt-zip:1.14") - implementation("androidx.browser:browser:1.4.0") + implementation(libs.joda.time) + implementation(libs.zeroturnaround) + implementation(libs.androidx.browser) // Room database - val roomVersion = "2.4.1" - implementation("androidx.room:room-runtime:$roomVersion") - implementation("androidx.room:room-ktx:$roomVersion") - kapt("androidx.room:room-compiler:$roomVersion") + implementation(libs.bundles.room) + kapt(libs.room.compiler) // Tests - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.3") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.expresso.core) } diff --git a/readium/navigator-media2/build.gradle.kts b/readium/navigator-media2/build.gradle.kts index cbdc31499b..3c62bfdf9c 100644 --- a/readium/navigator-media2/build.gradle.kts +++ b/readium/navigator-media2/build.gradle.kts @@ -8,11 +8,11 @@ import ModuleDependency.Project.shared */ plugins { - id("com.android.library") - id("kotlin-android") - id("kotlin-parcelize") - id("maven-publish") - id("org.jetbrains.dokka") + id(Plugins.ANDROID_LIBRARY) + id(Plugins.KOTLIN_ANDROID) + id(Plugins.KOTLIN_PARCELIZE) + id(Plugins.MAVEN_PUBLISH) + id(Plugins.DOKKA) } android { @@ -64,19 +64,17 @@ dependencies { api(shared()) api(navigator()) - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation(libs.bundles.coroutines) - implementation("com.jakewharton.timber:timber:5.0.1") + implementation(libs.timber) - implementation("androidx.media2:media2-session:1.2.1") - implementation("androidx.media2:media2-player:1.2.1") + implementation(libs.bundles.media2) - implementation("com.google.android.exoplayer:exoplayer-core:2.18.1") - implementation("com.google.android.exoplayer:extension-media2:2.18.1") + implementation(libs.exoplayer.core) + implementation(libs.exoplayer.extension.media2) - testImplementation("junit:junit:4.13.2") + testImplementation(libs.junit) - androidTestImplementation("androidx.test.ext:junit:1.1.3") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.expresso.core) } diff --git a/readium/navigator/build.gradle.kts b/readium/navigator/build.gradle.kts index 1df2cc78de..fda2ca4277 100644 --- a/readium/navigator/build.gradle.kts +++ b/readium/navigator/build.gradle.kts @@ -7,11 +7,11 @@ import ModuleDependency.Project.shared */ plugins { - id("com.android.library") - id("kotlin-android") - id("kotlin-parcelize") - id("maven-publish") - id("org.jetbrains.dokka") + id(Plugins.ANDROID_LIBRARY) + id(Plugins.KOTLIN_ANDROID) + id(Plugins.KOTLIN_PARCELIZE) + id(Plugins.MAVEN_PUBLISH) + id(Plugins.DOKKA) } android { @@ -63,22 +63,19 @@ dependencies { api(shared()) - implementation("androidx.activity:activity-ktx:1.4.0") - implementation("androidx.appcompat:appcompat:1.4.1") - implementation("androidx.browser:browser:1.4.0") - implementation("androidx.constraintlayout:constraintlayout:2.1.3") - implementation("androidx.core:core-ktx:1.7.0") - implementation("androidx.fragment:fragment-ktx:1.4.0") - implementation("androidx.legacy:legacy-support-core-ui:1.0.0") - implementation("androidx.legacy:legacy-support-v4:1.0.0") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.4.0") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.4.0") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0") - implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.4.0") - implementation("androidx.recyclerview:recyclerview:1.2.1") + implementation(libs.activity.ktx) + implementation(libs.appcompat) + implementation(libs.androidx.browser) + implementation(libs.constraint.layout) + implementation(libs.androidx.core) + implementation(libs.fragment.ktx) + implementation(libs.legacy.ui) + implementation(libs.legacy.v4) + implementation(libs.bundles.lifecycle) + implementation(libs.recyclerview) implementation("androidx.media:media:1.6.0") implementation("androidx.viewpager2:viewpager2:1.0.0") - implementation("androidx.webkit:webkit:1.4.0") + implementation(libs.webkit) // Needed to avoid a crash with API 31, see https://stackoverflow.com/a/69152986/1474476 implementation("androidx.work:work-runtime-ktx:2.7.1") implementation("com.duolingo.open:rtl-viewpager:1.0.3") @@ -86,26 +83,20 @@ dependencies { // ChrisBane/PhotoView ( for the Zoom handling ) implementation("com.github.chrisbanes:PhotoView:2.3.0") - implementation("androidx.media2:media2-session:1.2.1") - implementation("androidx.media2:media2-player:1.2.1") + implementation(libs.bundles.media2) // ExoPlayer is used by the Audio Navigator. - api("com.google.android.exoplayer:exoplayer-core:2.18.1") - api("com.google.android.exoplayer:exoplayer-ui:2.18.1") - api("com.google.android.exoplayer:extension-mediasession:2.18.1") - api("com.google.android.exoplayer:extension-media2:2.18.1") - api("com.google.android.exoplayer:extension-workmanager:2.18.1") - implementation("com.google.android.material:material:1.6.1") - implementation("com.jakewharton.timber:timber:5.0.1") + api(libs.bundles.exoplayer) + implementation(libs.material) + implementation(libs.timber) implementation("com.shopgun.android:utils:1.0.9") - implementation("joda-time:joda-time:2.10.13") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation(libs.joda.time) + implementation(libs.bundles.coroutines) // AM NOTE: needs to stay this version for now (June 24,2020) //noinspection GradleDependency - implementation("org.jsoup:jsoup:1.14.3") + implementation(libs.jsoup) // Tests - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.3") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.expresso.core) } diff --git a/readium/opds/build.gradle.kts b/readium/opds/build.gradle.kts index 2e3db7133b..672cd24793 100644 --- a/readium/opds/build.gradle.kts +++ b/readium/opds/build.gradle.kts @@ -8,7 +8,7 @@ import ModuleDependency.Project.shared plugins { id(Plugins.ANDROID_LIBRARY) - kotlin(Plugins.ANDROID) + id(Plugins.KOTLIN_ANDROID) id(Plugins.KOTLIN_PARCELIZE) id(Plugins.MAVEN_PUBLISH) id(Plugins.DOKKA) @@ -58,7 +58,7 @@ dependencies { implementation(libs.appcompat) implementation(libs.timber) implementation(libs.joda.time) - implementation(libs.kovenant) + implementation(libs.kovenant.base) implementation(libs.coroutines.core) // Tests diff --git a/readium/shared/build.gradle.kts b/readium/shared/build.gradle.kts index acdb8c6e35..d81539efa1 100644 --- a/readium/shared/build.gradle.kts +++ b/readium/shared/build.gradle.kts @@ -5,11 +5,11 @@ */ plugins { - id("com.android.library") - id("kotlin-android") - id("kotlin-parcelize") - id("maven-publish") - id("org.jetbrains.dokka") + id(Plugins.ANDROID_LIBRARY) + id(Plugins.KOTLIN_ANDROID) + id(Plugins.KOTLIN_PARCELIZE) + id(Plugins.MAVEN_PUBLISH) + id(Plugins.DOKKA) } android { @@ -55,29 +55,24 @@ afterEvaluate { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("androidx.appcompat:appcompat:1.4.1") - implementation("androidx.browser:browser:1.4.0") + implementation(libs.appcompat) + implementation(libs.androidx.browser) implementation("com.github.kittinunf.fuel:fuel-android:2.3.1") implementation("com.github.kittinunf.fuel:fuel:2.3.1") - implementation("com.jakewharton.timber:timber:5.0.1") - implementation("joda-time:joda-time:2.10.13") - implementation("nl.komponents.kovenant:kovenant-android:3.3.0") - implementation("nl.komponents.kovenant:kovenant-combine:3.3.0") - implementation("nl.komponents.kovenant:kovenant-core:3.3.0") - implementation("nl.komponents.kovenant:kovenant-functional:3.3.0") - implementation("nl.komponents.kovenant:kovenant-jvm:3.3.0") - implementation("nl.komponents.kovenant:kovenant:3.3.0") + implementation(libs.timber) + implementation(libs.joda.time) + implementation(libs.bundles.kovenant) implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") - implementation("org.jsoup:jsoup:1.14.3") + implementation(libs.jsoup) // Tests - testImplementation("junit:junit:4.13.2") - testImplementation("org.assertj:assertj-core:3.22.0") - testImplementation("org.jetbrains.kotlin:kotlin-test-junit:1.6.10") - testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4") - testImplementation("org.robolectric:robolectric:4.7.3") + testImplementation(libs.junit) + testImplementation(libs.assertj) + testImplementation(libs.kotlin.junit) + testImplementation(libs.coroutines.test) + testImplementation(libs.robolectric) - androidTestImplementation("androidx.test.ext:junit:1.1.3") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.expresso.core) } diff --git a/readium/streamer/build.gradle.kts b/readium/streamer/build.gradle.kts index bd16fc0e6d..faa7f424a4 100644 --- a/readium/streamer/build.gradle.kts +++ b/readium/streamer/build.gradle.kts @@ -7,11 +7,11 @@ import ModuleDependency.Project.shared */ plugins { - id("com.android.library") - id("kotlin-android") - id("kotlin-parcelize") - id("maven-publish") - id("org.jetbrains.dokka") + id(Plugins.ANDROID_LIBRARY) + id(Plugins.KOTLIN_ANDROID) + id(Plugins.KOTLIN_PARCELIZE) + id(Plugins.MAVEN_PUBLISH) + id(Plugins.DOKKA) } android { @@ -59,10 +59,10 @@ dependencies { api(shared()) - implementation("androidx.appcompat:appcompat:1.5.0") + implementation(libs.appcompat) @Suppress("GradleDependency") implementation("com.github.barteksc:pdfium-android:1.8.2") - implementation("com.jakewharton.timber:timber:5.0.1") + implementation(libs.timber) implementation("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { exclude(group = "org.parboiled") } @@ -70,20 +70,17 @@ dependencies { exclude(group = "org.parboiled") } //AM NOTE: conflicting support libraries, excluding these - implementation("com.mcxiaoke.koi:core:0.5.5") { - exclude(module = "support-v4") - } // useful extensions (only ~100k) - implementation("com.mcxiaoke.koi:async:0.5.5") { + implementation(libs.bundles.mcxiaoke) { exclude(module = "support-v4") } - implementation("joda-time:joda-time:2.10.13") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation(libs.joda.time) + implementation(libs.coroutines.core) // Tests - testImplementation("junit:junit:4.13.2") - testImplementation("org.assertj:assertj-core:3.22.0") - testImplementation("org.robolectric:robolectric:4.7.3") - androidTestImplementation("androidx.test.ext:junit:1.1.3") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + testImplementation(libs.junit) + testImplementation(libs.assertj) + testImplementation(libs.robolectric) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.expresso.core) } diff --git a/test-app/build.gradle.kts b/test-app/build.gradle.kts index 4f2c14055c..bc5a144dd5 100644 --- a/test-app/build.gradle.kts +++ b/test-app/build.gradle.kts @@ -12,10 +12,10 @@ import ModuleDependency.Project.streamer */ plugins { - id("com.android.application") - id("kotlin-android") - id("kotlin-kapt") - id("kotlin-parcelize") + id(Plugins.ANDROID_APPLICATION) + id(Plugins.KOTLIN_ANDROID) + id(Plugins.KAPT) + id(Plugins.KOTLIN_PARCELIZE) } android { @@ -79,51 +79,47 @@ dependencies { implementation(opds()) implementation(lcp()) - implementation("androidx.core:core-ktx:1.8.0") + implementation(libs.androidx.core) implementation("androidx.activity:activity-ktx:1.5.1") - implementation("androidx.appcompat:appcompat:1.5.0") - implementation("androidx.browser:browser:1.4.0") + implementation(libs.appcompat) + implementation(libs.androidx.browser) implementation("androidx.cardview:cardview:1.0.0") - implementation("androidx.constraintlayout:constraintlayout:2.1.4") - implementation("androidx.fragment:fragment-ktx:1.5.2") - implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.5.1") - implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1") - implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1") - implementation("androidx.navigation:navigation-fragment-ktx:2.5.1") - implementation("androidx.navigation:navigation-ui-ktx:2.5.1") + implementation(libs.constraint.layout) + implementation(libs.fragment.ktx) + implementation(libs.lifecycle.livedata) + implementation(libs.lifecycle.runtime) + implementation(libs.lifecycle.viewmodel) + implementation(libs.bundles.navigation) implementation("androidx.paging:paging-runtime-ktx:3.1.1") - implementation("androidx.recyclerview:recyclerview:1.2.1") + implementation(libs.recyclerview) implementation("androidx.viewpager2:viewpager2:1.0.0") - implementation("androidx.webkit:webkit:1.4.0") + implementation(libs.webkit) implementation("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { exclude(group = "org.parboiled") } implementation("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { exclude(group = "org.parboiled") } - implementation("com.google.android.material:material:1.6.1") - implementation("com.jakewharton.timber:timber:5.0.1") + implementation(libs.material) + implementation(libs.timber) // AM NOTE: needs to stay this version for now (June 24,2020) implementation("com.squareup.picasso:picasso:2.71828") - implementation("joda-time:joda-time:2.10.13") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4") + implementation(libs.joda.time) + implementation(libs.coroutines.core) // AM NOTE: needs to stay this version for now (June 24,2020) - implementation("org.jsoup:jsoup:1.14.3") + implementation(libs.jsoup) - implementation("androidx.media2:media2-session:1.2.1") - implementation("androidx.media2:media2-player:1.2.1") + implementation(libs.bundles.media2) // Room database - val roomVersion = "2.4.1" - implementation("androidx.room:room-runtime:$roomVersion") - implementation("androidx.room:room-ktx:$roomVersion") - kapt("androidx.room:room-compiler:$roomVersion") + implementation(libs.bundles.room) + kapt(libs.room.compiler) implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") kapt("androidx.lifecycle:lifecycle-compiler:2.5.1") // Tests - testImplementation("junit:junit:4.13.2") - androidTestImplementation("androidx.test.ext:junit:1.1.3") - androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0") + testImplementation(libs.junit) + androidTestImplementation(libs.ext.junit) + androidTestImplementation(libs.expresso.core) } From 2271ffd49dc3c264736aef9c63c0ca98a6d0bcd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0lyas=20=C5=9EAVL=C4=B0?= <52604585+svlilyas@users.noreply.github.com> Date: Mon, 22 Aug 2022 23:25:28 +0300 Subject: [PATCH 9/9] AndroidConfig variables used in gradles AndroidConfig variables used in gradles --- buildSrc/src/main/kotlin/AndroidConfig.kt | 2 +- buildSrc/src/main/kotlin/Fields.kt | 2 -- gradle/libs.versions.toml | 29 ++++++++++++++++++++++- readium/lcp/build.gradle.kts | 8 +++---- readium/navigator-media2/build.gradle.kts | 8 +++---- readium/navigator/build.gradle.kts | 22 ++++++++--------- readium/opds/build.gradle.kts | 6 ++--- readium/shared/build.gradle.kts | 15 ++++++------ readium/streamer/build.gradle.kts | 15 +++++------- test-app/build.gradle.kts | 27 ++++++++++----------- 10 files changed, 76 insertions(+), 58 deletions(-) diff --git a/buildSrc/src/main/kotlin/AndroidConfig.kt b/buildSrc/src/main/kotlin/AndroidConfig.kt index 2e3212a8cf..1228b2f60c 100644 --- a/buildSrc/src/main/kotlin/AndroidConfig.kt +++ b/buildSrc/src/main/kotlin/AndroidConfig.kt @@ -9,7 +9,7 @@ object AndroidConfig { const val COMPILE_SDK_VERSION = 32 const val NDK_VERSION = "23.0.7599858" const val TEST_INSTRUMENTATION_RUNNER = "androidx.test.runner.AndroidJUnitRunner" - + const val GROUP_ID = "com.github.readium" const val VERSION_CODE = 1 val VERSION_NAME = calculateVersionName() private const val versionMajor = 2 diff --git a/buildSrc/src/main/kotlin/Fields.kt b/buildSrc/src/main/kotlin/Fields.kt index 6911927cbb..fa8d828326 100644 --- a/buildSrc/src/main/kotlin/Fields.kt +++ b/buildSrc/src/main/kotlin/Fields.kt @@ -2,6 +2,4 @@ object Fields { const val SERVICE_URL = "SERVICE_URL" const val SERVICE_API_KEY = "SERVICE_API_KEY" // optional const val SERVICE_CERTIFICATE_PATH = "SERVICE_CERTIFICATE_PATH" // optional - - const val FIREBASE_APP_INTEGRATION_KEY = "FIREBASE_APP_INTEGRATION_KEY" } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2bcc2fd01b..4a6306205b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -30,6 +30,11 @@ kovenant = "3.3.0" mcxiaoke = "0.5.5" zeroturnaround = "1.14" media2 = "1.2.1" +media = "1.6.0" +viewpager2 = "1.0.0" +work-runtime = "2.7.1" +fuel = "2.3.1" +nanohttpd = "master-SNAPSHOT" [libraries] kotlin-gradle = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } @@ -48,6 +53,8 @@ lifecycle-livedata = { group = "androidx.lifecycle", name = "lifecycle-livedata- lifecycle-runtime = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } lifecycle-viewmodel = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-ktx", version.ref = "lifecycle" } lifecycle-vmsavedstate = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-savedstate", version.ref = "lifecycle" } +lifecycle-extensions = { group = "androidx.lifecycle", name = "lifecycle-extensions", version = "2.2.0" } +lifecycle-compiler = { group = "androidx.lifecycle", name = "lifecycle-compiler", version.ref = "lifecycle" } navigation-fragment = { group = "androidx.navigation", name = "navigation-fragment-ktx", version.ref = "navigation" } navigation-ui = { group = "androidx.navigation", name = "navigation-ui-ktx", version.ref = "navigation" } activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activity-ktx" } @@ -77,12 +84,30 @@ kovenant-combine = { group = "nl.komponents.kovenant", name = "kovenant-combine" kovenant-core = { group = "nl.komponents.kovenant", name = "kovenant-core", version.ref = "kovenant" } kovenant-functional = { group = "nl.komponents.kovenant", name = "kovenant-functional", version.ref = "kovenant" } kovenant-jvm = { group = "nl.komponents.kovenant", name = "kovenant-jvm", version.ref = "kovenant" } - mcxiaoke-async = { group = "com.mcxiaoke.koi", name = "async", version.ref = "mcxiaoke" } mcxiaoke-core = { group = "com.mcxiaoke.koi", name = "core", version.ref = "mcxiaoke" } zeroturnaround = { group = "org.zeroturnaround", name = "zt-zip", version.ref = "zeroturnaround" } media2-session = { group = "androidx.media2", name = "media2-session", version.ref = "media2" } media2-player = { group = "androidx.media2", name = "media2-player", version.ref = "media2" } +androidx-media = { group = "androidx.media", name = "media", version.ref = "media" } +androidx-viewpager2 = { group = "androidx.viewpager2", name = "viewpager2", version.ref = "viewpager2" } +androidx-work-runtime = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "work-runtime" } +rtl-viewpager = { group = "com.duolingo.open", name = "rtl-viewpager", version = "1.0.3" } +pdf-viewer = { group = "com.github.barteksc", name = "android-pdf-viewer", version = "2.8.2" } +photoview = { group = "com.github.chrisbanes", name = "PhotoView", version = "2.3.0" } +shopgun-utils = { group = "com.shopgun.android", name = "utils", version = "1.0.9" } +fuel-android = { group = "com.github.kittinunf.fuel", name = "fuel-android", version.ref = "fuel" } +fuel-core = { group = "com.github.kittinunf.fuel", name = "fuel", version.ref = "fuel" } +kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version = "1.6.10" } +nanohttpd-core = { group = "com.github.edrlab.nanohttpd", name = "nanohttpd", version.ref = "nanohttpd" } +nanohttpd-nanolets = { group = "com.github.edrlab.nanohttpd", name = "nanohttpd-nanolets", version.ref = "nanohttpd" } +pdfium-android = { group = "com.github.barteksc", name = "pdfium-android", version = "1.8.2" } +androidx-cardview = { group = "androidx.cardview", name = "cardview", version = "1.0.0" } +androidx-paging = { group = "androidx.paging", name = "paging-runtime-ktx", version = "3.1.1" } +picasso = { group = "com.squareup.picasso", name = "picasso", version = "2.71828" } + +kotlin-stdlib-jdk8 = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = "1.7.10" } + [bundles] room = ["room-runtime", "room-ktx"] @@ -92,6 +117,8 @@ lifecycle = ["lifecycle-livedata", "lifecycle-runtime", "lifecycle-viewmodel", " navigation = ["navigation-fragment", "navigation-ui"] mcxiaoke = ["mcxiaoke-async", "mcxiaoke-core"] media2 = ["media2-session", "media2-player"] +fuel = ["fuel-android", "fuel-core"] +nanohttpd = ["nanohttpd-core", "nanohttpd-nanolets"] kovenant = ["kovenant-base", "kovenant-android", "kovenant-combine", "kovenant-core", "kovenant-functional", "kovenant-jvm"] test-frameworks = ["junit", "ext-junit", "expresso-core", "robolectric", "kotlin-junit", "assertj", "coroutines-test"] diff --git a/readium/lcp/build.gradle.kts b/readium/lcp/build.gradle.kts index 60b5e7b702..0371c09b83 100644 --- a/readium/lcp/build.gradle.kts +++ b/readium/lcp/build.gradle.kts @@ -33,7 +33,7 @@ android { allWarningsAsErrors = true } buildTypes { - getByName("release") { + getByName(Flavors.BuildTypes.RELEASE) { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android.txt")) } @@ -43,9 +43,9 @@ android { afterEvaluate { publishing { publications { - create("release") { - from(components.getByName("release")) - groupId = "com.github.readium" + create(Flavors.BuildTypes.RELEASE) { + from(components.getByName(Flavors.BuildTypes.RELEASE)) + groupId = AndroidConfig.GROUP_ID artifactId = "readium-lcp" artifact(tasks.findByName("sourcesJar")) artifact(tasks.findByName("javadocsJar")) diff --git a/readium/navigator-media2/build.gradle.kts b/readium/navigator-media2/build.gradle.kts index 3c62bfdf9c..03ab7155ae 100644 --- a/readium/navigator-media2/build.gradle.kts +++ b/readium/navigator-media2/build.gradle.kts @@ -34,7 +34,7 @@ android { freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" } buildTypes { - getByName("release") { + getByName(Flavors.BuildTypes.RELEASE) { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android.txt")) } @@ -47,9 +47,9 @@ android { afterEvaluate { publishing { publications { - create("release") { - from(components.getByName("release")) - groupId = "com.github.readium" + create(Flavors.BuildTypes.RELEASE) { + from(components.getByName(Flavors.BuildTypes.RELEASE)) + groupId = AndroidConfig.GROUP_ID artifactId = "readium-navigator-media2" artifact(tasks.findByName("sourcesJar")) artifact(tasks.findByName("javadocsJar")) diff --git a/readium/navigator/build.gradle.kts b/readium/navigator/build.gradle.kts index fda2ca4277..0d29364093 100644 --- a/readium/navigator/build.gradle.kts +++ b/readium/navigator/build.gradle.kts @@ -34,7 +34,7 @@ android { freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn" } buildTypes { - getByName("release") { + getByName(Flavors.BuildTypes.RELEASE) { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android.txt")) } @@ -47,9 +47,9 @@ android { afterEvaluate { publishing { publications { - create("release") { - from(components.getByName("release")) - groupId = "com.github.readium" + create(Flavors.BuildTypes.RELEASE) { + from(components.getByName(Flavors.BuildTypes.RELEASE)) + groupId = AndroidConfig.GROUP_ID artifactId = "readium-navigator" artifact(tasks.findByName("sourcesJar")) artifact(tasks.findByName("javadocsJar")) @@ -73,22 +73,22 @@ dependencies { implementation(libs.legacy.v4) implementation(libs.bundles.lifecycle) implementation(libs.recyclerview) - implementation("androidx.media:media:1.6.0") - implementation("androidx.viewpager2:viewpager2:1.0.0") + implementation(libs.androidx.media) + implementation(libs.androidx.viewpager2) implementation(libs.webkit) // Needed to avoid a crash with API 31, see https://stackoverflow.com/a/69152986/1474476 - implementation("androidx.work:work-runtime-ktx:2.7.1") - implementation("com.duolingo.open:rtl-viewpager:1.0.3") - api("com.github.barteksc:android-pdf-viewer:2.8.2") + implementation(libs.androidx.work.runtime) + implementation(libs.rtl.viewpager) + api(libs.pdf.viewer) // ChrisBane/PhotoView ( for the Zoom handling ) - implementation("com.github.chrisbanes:PhotoView:2.3.0") + implementation(libs.photoview) implementation(libs.bundles.media2) // ExoPlayer is used by the Audio Navigator. api(libs.bundles.exoplayer) implementation(libs.material) implementation(libs.timber) - implementation("com.shopgun.android:utils:1.0.9") + implementation(libs.shopgun.utils) implementation(libs.joda.time) implementation(libs.bundles.coroutines) // AM NOTE: needs to stay this version for now (June 24,2020) diff --git a/readium/opds/build.gradle.kts b/readium/opds/build.gradle.kts index 672cd24793..2735858903 100644 --- a/readium/opds/build.gradle.kts +++ b/readium/opds/build.gradle.kts @@ -39,9 +39,9 @@ android { afterEvaluate { publishing { publications { - create("release") { - from(components.getByName("release")) - groupId = "com.github.readium" + create(Flavors.BuildTypes.RELEASE) { + from(components.getByName(Flavors.BuildTypes.RELEASE)) + groupId = AndroidConfig.GROUP_ID artifactId = "readium-opds" artifact(tasks.findByName("sourcesJar")) artifact(tasks.findByName("javadocsJar")) diff --git a/readium/shared/build.gradle.kts b/readium/shared/build.gradle.kts index d81539efa1..371ca28bd0 100644 --- a/readium/shared/build.gradle.kts +++ b/readium/shared/build.gradle.kts @@ -31,7 +31,7 @@ android { unitTests.isIncludeAndroidResources = true } buildTypes { - getByName("release") { + getByName(Flavors.BuildTypes.RELEASE) { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android.txt")) } @@ -41,9 +41,9 @@ android { afterEvaluate { publishing { publications { - create("release") { - from(components.getByName("release")) - groupId = "com.github.readium" + create(Flavors.BuildTypes.RELEASE) { + from(components.getByName(Flavors.BuildTypes.RELEASE)) + groupId = AndroidConfig.GROUP_ID artifactId = "readium-shared" artifact(tasks.findByName("sourcesJar")) artifact(tasks.findByName("javadocsJar")) @@ -57,13 +57,12 @@ dependencies { implementation(libs.appcompat) implementation(libs.androidx.browser) - implementation("com.github.kittinunf.fuel:fuel-android:2.3.1") - implementation("com.github.kittinunf.fuel:fuel:2.3.1") + implementation(libs.bundles.fuel) implementation(libs.timber) implementation(libs.joda.time) implementation(libs.bundles.kovenant) - implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10") - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.0") + implementation(libs.kotlin.reflect) + implementation(libs.coroutines.core) implementation(libs.jsoup) // Tests diff --git a/readium/streamer/build.gradle.kts b/readium/streamer/build.gradle.kts index faa7f424a4..a3eedd2b1e 100644 --- a/readium/streamer/build.gradle.kts +++ b/readium/streamer/build.gradle.kts @@ -33,7 +33,7 @@ android { allWarningsAsErrors = true } buildTypes { - getByName("release") { + getByName(Flavors.BuildTypes.RELEASE) { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android.txt")) } @@ -43,9 +43,9 @@ android { afterEvaluate { publishing { publications { - create("release") { - from(components.getByName("release")) - groupId = "com.github.readium" + create(Flavors.BuildTypes.RELEASE) { + from(components.getByName(Flavors.BuildTypes.RELEASE)) + groupId = AndroidConfig.GROUP_ID artifactId = "readium-streamer" artifact(tasks.findByName("sourcesJar")) artifact(tasks.findByName("javadocsJar")) @@ -61,12 +61,9 @@ dependencies { implementation(libs.appcompat) @Suppress("GradleDependency") - implementation("com.github.barteksc:pdfium-android:1.8.2") + implementation(libs.pdfium.android) implementation(libs.timber) - implementation("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { - exclude(group = "org.parboiled") - } - implementation("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { + implementation(libs.bundles.nanohttpd) { exclude(group = "org.parboiled") } //AM NOTE: conflicting support libraries, excluding these diff --git a/test-app/build.gradle.kts b/test-app/build.gradle.kts index bc5a144dd5..186e9bc6c9 100644 --- a/test-app/build.gradle.kts +++ b/test-app/build.gradle.kts @@ -48,7 +48,7 @@ android { viewBinding = true } buildTypes { - getByName("release") { + getByName(Flavors.BuildTypes.RELEASE) { isMinifyEnabled = false proguardFiles(getDefaultProguardFile("proguard-android.txt")) } @@ -58,7 +58,7 @@ android { } sourceSets { - getByName("main") { + getByName(Flavors.Default.MAIN) { java.srcDirs("src/main/java") res.srcDirs("src/main/res") assets.srcDirs("src/main/assets") @@ -68,8 +68,8 @@ android { dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10") - implementation("androidx.legacy:legacy-support-v4:1.0.0") + implementation(libs.kotlin.stdlib.jdk8) + implementation(libs.legacy.v4) implementation(shared()) implementation(streamer()) @@ -80,30 +80,27 @@ dependencies { implementation(lcp()) implementation(libs.androidx.core) - implementation("androidx.activity:activity-ktx:1.5.1") + implementation(libs.activity.ktx) implementation(libs.appcompat) implementation(libs.androidx.browser) - implementation("androidx.cardview:cardview:1.0.0") + implementation(libs.androidx.cardview) implementation(libs.constraint.layout) implementation(libs.fragment.ktx) implementation(libs.lifecycle.livedata) implementation(libs.lifecycle.runtime) implementation(libs.lifecycle.viewmodel) implementation(libs.bundles.navigation) - implementation("androidx.paging:paging-runtime-ktx:3.1.1") + implementation(libs.androidx.paging) implementation(libs.recyclerview) - implementation("androidx.viewpager2:viewpager2:1.0.0") + implementation(libs.androidx.viewpager2) implementation(libs.webkit) - implementation("com.github.edrlab.nanohttpd:nanohttpd:master-SNAPSHOT") { - exclude(group = "org.parboiled") - } - implementation("com.github.edrlab.nanohttpd:nanohttpd-nanolets:master-SNAPSHOT") { + implementation(libs.bundles.nanohttpd) { exclude(group = "org.parboiled") } implementation(libs.material) implementation(libs.timber) // AM NOTE: needs to stay this version for now (June 24,2020) - implementation("com.squareup.picasso:picasso:2.71828") + implementation(libs.picasso) implementation(libs.joda.time) implementation(libs.coroutines.core) // AM NOTE: needs to stay this version for now (June 24,2020) @@ -115,8 +112,8 @@ dependencies { implementation(libs.bundles.room) kapt(libs.room.compiler) - implementation("androidx.lifecycle:lifecycle-extensions:2.2.0") - kapt("androidx.lifecycle:lifecycle-compiler:2.5.1") + implementation(libs.lifecycle.extensions) + kapt(libs.lifecycle.compiler) // Tests testImplementation(libs.junit)