diff --git a/.github/workflows/android-dependency-updates.yaml b/.github/workflows/android-dependency-updates.yaml index 4fff5c6d5..bdaa556a3 100644 --- a/.github/workflows/android-dependency-updates.yaml +++ b/.github/workflows/android-dependency-updates.yaml @@ -12,16 +12,16 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: 11 distribution: 'adopt' - name: Gradle check for updates run: ./gradlew dependencyUpdates --stacktrace - name: Upload dependency updates report - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: dependency-report path: build/dependencyUpdates/report.json diff --git a/.github/workflows/android-spotless.yml b/.github/workflows/android-spotless.yml index 44b68e0ea..97e8a230d 100644 --- a/.github/workflows/android-spotless.yml +++ b/.github/workflows/android-spotless.yml @@ -13,9 +13,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: '11' distribution: 'adopt' diff --git a/.github/workflows/android-test.yml b/.github/workflows/android-test.yml index 74281d232..cea39b820 100644 --- a/.github/workflows/android-test.yml +++ b/.github/workflows/android-test.yml @@ -13,9 +13,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: '11' distribution: 'adopt' diff --git a/.github/workflows/gradle-dokka.yml b/.github/workflows/gradle-dokka.yml index c4f9ab2ed..34edfe48e 100644 --- a/.github/workflows/gradle-dokka.yml +++ b/.github/workflows/gradle-dokka.yml @@ -10,9 +10,9 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: java-version: '11' distribution: 'adopt' @@ -23,7 +23,7 @@ jobs: run: ./gradlew dokkaHtmlMultiModule - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@4.1.5 + uses: JamesIves/github-pages-deploy-action@v4.4.1 with: branch: docs # The branch the action should deploy to. folder: dokka-docs # The folder the action should deploy. diff --git a/.github/workflows/release-builder.yml b/.github/workflows/release-builder.yml index 747af95d4..49fb14a25 100644 --- a/.github/workflows/release-builder.yml +++ b/.github/workflows/release-builder.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Fetch tags run: git fetch --tags --force - uses: ericcornelissen/git-tag-annotation-action@v2 diff --git a/build.gradle.kts b/build.gradle.kts index 95ee6f774..ddd28a7d0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,8 +15,8 @@ buildscript { mavenCentral() } dependencies { - classpath(co.anitrend.arch.buildSrc.Libraries.Android.Tools.buildGradle) - classpath(co.anitrend.arch.buildSrc.Libraries.JetBrains.Kotlin.Gradle.plugin) + classpath(libs.android.gradle.plugin) + classpath(libs.jetbrains.kotlin.gradle) } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 32bb0833c..67059906e 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -4,6 +4,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile plugins { `kotlin-dsl` `maven-publish` + `version-catalog` } repositories { @@ -27,27 +28,27 @@ tasks.withType(KotlinJvmCompile::class) { } } -val buildToolsVersion = "7.2.1" -val kotlinVersion = "1.7.20" -val dokkaVersion = "1.6.21" -val manesVersion = "0.42.0" -val spotlessVersion = "6.11.0" +fun Project.library(alias: String) = + extensions.getByType() + .named("libs") + .findLibrary(alias) + .get() dependencies { /* Depend on the android gradle plugin, since we want to access it in our plugin */ - implementation("com.android.tools.build:gradle:$buildToolsVersion") + implementation(library("android-gradle-plugin")) /* Depend on the kotlin plugin, since we want to access it in our plugin */ - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") + implementation(library("jetbrains-kotlin-gradle")) /* Depend on the dokka plugin, since we want to access it in our plugin */ - implementation("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion") + implementation(library("jetbrains-dokka-gradle")) /** Dependency management */ - implementation("com.github.ben-manes:gradle-versions-plugin:$manesVersion") + implementation(library("gradle-versions")) /** Spotless */ - implementation("com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion") + implementation(library("spotless-gradle")) /* Depend on the default Gradle API's since we want to build a custom plugin */ implementation(gradleApi()) diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 000000000..4d2de53c4 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,9 @@ +@file:Suppress("UnstableApiUsage") + +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/Libraries.kt b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/Libraries.kt deleted file mode 100644 index 0c729abd8..000000000 --- a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/Libraries.kt +++ /dev/null @@ -1,137 +0,0 @@ -package co.anitrend.arch.buildSrc - -import co.anitrend.arch.buildSrc.common.Versions - -@Suppress("SpellCheckingInspection") -object Libraries { - - const val threeTenBp = "com.jakewharton.threetenabp:threetenabp:${Versions.threeTenBp}" - - const val junit = "junit:junit:${Versions.junit}" - - const val timber = "com.jakewharton.timber:timber:${Versions.timber}" - - object Android { - - object Tools { - private const val version = "7.2.1" - const val buildGradle = "com.android.tools.build:gradle:${version}" - } - } - - object AndroidX { - - object Core { - private const val version = "1.8.0" - const val core = "androidx.core:core:$version" - const val coreKtx = "androidx.core:core-ktx:$version" - } - - object Lifecycle { - private const val version = "2.5.1" - const val extensions = "androidx.lifecycle:lifecycle-extensions:2.2.0" - const val runTimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version" - const val liveDataKtx = "androidx.lifecycle:lifecycle-livedata-ktx:$version" - const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" - const val liveDataCoreKtx = "androidx.lifecycle:lifecycle-livedata-core-ktx:$version" - } - - object Paging { - private const val version = "2.1.2" - const val common = "androidx.paging:paging-common-ktx:$version" - const val runtime = "androidx.paging:paging-runtime:$version" - const val runtimeKtx = "androidx.paging:paging-runtime-ktx:$version" - } - - object Preference { - private const val version = "1.2.0" - const val preference = "androidx.preference:preference:$version" - const val preferenceKtx = "androidx.preference:preference-ktx:$version" - } - - object Recycler { - private const val version = "1.3.0-alpha02" - const val recyclerView = "androidx.recyclerview:recyclerview:$version" - const val recyclerViewSelection = "androidx.recyclerview:recyclerview-selection:$version" - } - - object StartUp { - private const val version = "1.1.1" - const val startUpRuntime = "androidx.startup:startup-runtime:$version" - } - - object SwipeRefresh { - private const val version = "1.2.0-alpha01" - const val swipeRefreshLayout = "androidx.swiperefreshlayout:swiperefreshlayout:$version" - } - - object Test { - private const val version = "1.4.0" - const val core = "androidx.test:core:$version" - const val coreKtx = "androidx.test:core-ktx:$version" - const val runner = "androidx.test:runner:$version" - const val rules = "androidx.test:rules:$version" - - object Extension { - private const val version = "1.1.2" - const val junit = "androidx.test.ext:junit:$version" - const val junitKtx = "androidx.test.ext:junit-ktx:$version" - } - } - - object Work { - private const val version = "2.7.1" - const val runtimeKtx = "androidx.work:work-runtime-ktx:$version" - const val runtime = "androidx.work:work-runtime:$version" - const val test = "androidx.work:work-test:$version" - } - } - - object CashApp { - object Turbine { - private const val version = "0.8.0" - const val turbine = "app.cash.turbine:turbine:$version" - } - } - - object Google { - private const val version = "1.6.1" - const val material = "com.google.android.material:material:$version" - } - - object JetBrains { - object Dokka { - private const val version = "1.7.20" - const val gradlePlugin = "org.jetbrains.dokka:dokka-gradle-plugin:$version" - } - - object Kotlin { - private const val version = "1.7.20" - const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version" - const val reflect = "org.jetbrains.kotlin:kotlin-reflect:$version" - - object Gradle { - const val plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version" - } - - object Android { - const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version" - } - } - - object KotlinX { - object Coroutines { - private const val version = "1.6.4" - const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version" - const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version" - const val test = "org.jetbrains.kotlinx:kotlinx-coroutines-test:$version" - } - } - } - - object Mockk { - private const val version = "1.13.2" - const val mockk = "io.mockk:mockk:$version" - const val mockkAndroid = "io.mockk:mockk-android:$version" - } -} \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/common/Configuration.kt b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/common/Configuration.kt index 7b7220938..26d79bdfa 100644 --- a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/common/Configuration.kt +++ b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/common/Configuration.kt @@ -13,8 +13,8 @@ object Configuration { private const val channel = "alpha" - const val compileSdk = 32 - const val targetSdk = 32 + const val compileSdk = 33 + const val targetSdk = 33 const val minSdk = 21 /** @@ -34,4 +34,4 @@ object Configuration { "$major.$minor.$patch-$channel$${revision.toVersion()}" else "$major.$minor.$patch" -} \ No newline at end of file +} diff --git a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/common/Versions.kt b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/common/Versions.kt deleted file mode 100644 index 142fbf690..000000000 --- a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/common/Versions.kt +++ /dev/null @@ -1,10 +0,0 @@ -package co.anitrend.arch.buildSrc.common - -internal object Versions { - - const val junit = "4.13.2" - - const val timber = "5.0.1" - const val threeTenBp = "1.4.0" - const val ktlint = "0.40.0" -} \ No newline at end of file diff --git a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/components/AndroidConfiguration.kt b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/components/AndroidConfiguration.kt index cc8ecbf71..ffaa69562 100644 --- a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/components/AndroidConfiguration.kt +++ b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/components/AndroidConfiguration.kt @@ -5,8 +5,8 @@ import co.anitrend.arch.buildSrc.plugin.extensions.baseExtension import co.anitrend.arch.buildSrc.plugin.extensions.libraryExtension import co.anitrend.arch.buildSrc.plugin.extensions.isDomainModule import co.anitrend.arch.buildSrc.plugin.extensions.isThemeModule +import co.anitrend.arch.buildSrc.plugin.extensions.version import co.anitrend.arch.buildSrc.common.Configuration -import co.anitrend.arch.buildSrc.common.Versions import org.gradle.api.JavaVersion import org.gradle.api.Project import org.jetbrains.kotlin.gradle.dsl.KotlinCompile @@ -30,7 +30,7 @@ internal fun Project.configureSpotless(): Unit = spotlessExtension().run { "**/test/**/*.kt", "bin/**/*.kt" ) - ktlint(Versions.ktlint).userData( + ktlint(version("ktlint").toString()).userData( mapOf("android" to "true") ) licenseHeaderFile(rootProject.file("spotless/copyright.kt")) diff --git a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/extensions/ProjectExtensions.kt b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/extensions/ProjectExtensions.kt index 841be807a..a279aff47 100644 --- a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/extensions/ProjectExtensions.kt +++ b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/extensions/ProjectExtensions.kt @@ -5,10 +5,15 @@ import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.diffplug.gradle.spotless.SpotlessExtension import org.gradle.api.Project +import org.gradle.api.artifacts.MinimalExternalModuleDependency +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.api.artifacts.VersionConstraint import org.gradle.api.internal.plugins.DefaultArtifactPublicationSet import org.gradle.api.plugins.BasePlugin import org.gradle.api.plugins.ExtraPropertiesExtension import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.api.provider.Provider import org.gradle.api.publish.PublishingExtension import org.gradle.api.reporting.ReportingExtension import org.gradle.api.tasks.SourceSetContainer @@ -45,6 +50,20 @@ fun Project.isThemeModule() = fun Project.isUiModule() = name == Modules.Support.Ui.id +fun Project.versionCatalog(): VersionCatalog = + versionCatalogExtension() + .named("libs") + +fun Project.library(alias: String): Provider = + versionCatalog() + .findLibrary(alias) + .get() + +fun Project.version(alias: String): VersionConstraint = + versionCatalog() + .findVersion(alias) + .get() + internal fun Project.baseExtension() = extensions.getByType() @@ -81,6 +100,9 @@ internal fun Project.publishingExtension() = internal fun Project.spotlessExtension() = extensions.getByType() +internal fun Project.versionCatalogExtension() = + extensions.getByType() + internal fun Project.containsBasePlugin(): Boolean { return project.plugins.toList().any { plugin -> plugin is BasePlugin diff --git a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/strategy/DependencyStrategy.kt b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/strategy/DependencyStrategy.kt index e960d6c91..a482bd466 100644 --- a/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/strategy/DependencyStrategy.kt +++ b/buildSrc/src/main/java/co/anitrend/arch/buildSrc/plugin/strategy/DependencyStrategy.kt @@ -1,6 +1,6 @@ package co.anitrend.arch.buildSrc.plugin.strategy -import co.anitrend.arch.buildSrc.Libraries +import co.anitrend.arch.buildSrc.plugin.extensions.library import co.anitrend.arch.buildSrc.plugin.extensions.hasDependencies import co.anitrend.arch.buildSrc.plugin.extensions.isUiModule import co.anitrend.arch.buildSrc.plugin.extensions.implementation @@ -9,43 +9,42 @@ import co.anitrend.arch.buildSrc.plugin.extensions.test import org.gradle.api.Project import org.gradle.api.artifacts.dsl.DependencyHandler -internal class DependencyStrategy( - private val project: Project -) { +internal class DependencyStrategy(private val project: Project) { private fun DependencyHandler.applyLoggingDependencies() { - implementation(Libraries.timber) + implementation(project.library("timber")) } private fun DependencyHandler.applyDefaultDependencies() { - implementation(Libraries.JetBrains.Kotlin.stdlib) - implementation(Libraries.JetBrains.Kotlin.reflect) + implementation(project.library("jetbrains-kotlin-stdlib-jdk8")) + implementation(project.library("jetbrains-kotlin-reflect")) // Testing libraries - test(Libraries.junit) - test(Libraries.Mockk.mockk) - androidTest(Libraries.Mockk.mockkAndroid) + test(project.library("junit")) + test(project.library("mockk")) + androidTest(project.library("mockk-android")) } private fun DependencyHandler.applyTestDependencies() { - androidTest(Libraries.AndroidX.Test.core) - androidTest(Libraries.AndroidX.Test.rules) - androidTest(Libraries.AndroidX.Test.runner) + androidTest(project.library("androidx-test-core")) + androidTest(project.library("androidx-test-coreKtx")) + androidTest(project.library("androidx-test-runner")) + androidTest(project.library("androidx-test-rules")) } private fun DependencyHandler.applyLifeCycleDependencies() { - implementation(Libraries.AndroidX.Lifecycle.liveDataCoreKtx) - implementation(Libraries.AndroidX.Lifecycle.runTimeKtx) - implementation(Libraries.AndroidX.Lifecycle.liveDataKtx) - implementation(Libraries.AndroidX.Lifecycle.extensions) + implementation(project.library("androidx-lifecycle-extensions")) + implementation(project.library("androidx-lifecycle-runTimeKtx")) + implementation(project.library("androidx-lifecycle-liveDataKtx")) + implementation(project.library("androidx-lifecycle-viewModelKtx")) } private fun DependencyHandler.applyCoroutinesDependencies() { if (project.isUiModule()) - implementation(Libraries.JetBrains.KotlinX.Coroutines.android) - implementation(Libraries.JetBrains.KotlinX.Coroutines.core) - test(Libraries.JetBrains.KotlinX.Coroutines.test) - androidTest(Libraries.CashApp.Turbine.turbine) + implementation(project.library("jetbrains-kotlinx-coroutines-android")) + implementation(project.library("jetbrains-kotlinx-coroutines-core")) + test(project.library("jetbrains-kotlinx-coroutines-test")) + androidTest(project.library("cash-turbine")) } fun applyDependenciesOn(handler: DependencyHandler) { diff --git a/core/build.gradle.kts b/core/build.gradle.kts index e972424fe..4699cbd87 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,5 +1,3 @@ -import co.anitrend.arch.buildSrc.Libraries - plugins { id("co.anitrend.arch") } @@ -9,6 +7,6 @@ dependencies { implementation(project(":data")) implementation(project(":domain")) - implementation(Libraries.Google.material) - implementation(Libraries.AndroidX.Work.runtimeKtx) + implementation(libs.google.android.material) + implementation(libs.androidx.work.runtimeKtx) } \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 5383c2680..4e9206e9a 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,5 +1,3 @@ -import co.anitrend.arch.buildSrc.Libraries - plugins { id("co.anitrend.arch") } @@ -8,7 +6,7 @@ dependencies { implementation(project(":domain")) implementation(project(":extension")) - implementation(Libraries.AndroidX.Paging.common) - implementation(Libraries.AndroidX.Paging.runtime) - implementation(Libraries.AndroidX.Paging.runtimeKtx) + implementation(libs.androidx.paging.common) + implementation(libs.androidx.paging.runtime) + implementation(libs.androidx.paging.runtimeKtx) } \ No newline at end of file diff --git a/extension/build.gradle.kts b/extension/build.gradle.kts index 2438b067e..684ce77cf 100644 --- a/extension/build.gradle.kts +++ b/extension/build.gradle.kts @@ -1,15 +1,13 @@ -import co.anitrend.arch.buildSrc.Libraries - plugins { id("co.anitrend.arch") } dependencies { - implementation(Libraries.Google.material) + implementation(libs.google.android.material) - implementation(Libraries.AndroidX.Core.coreKtx) - implementation(Libraries.AndroidX.StartUp.startUpRuntime) - implementation(Libraries.AndroidX.Preference.preferenceKtx) + implementation(libs.androidx.coreKtx) + implementation(libs.androidx.startupRuntime) + implementation(libs.androidx.preferenceKtx) - implementation(Libraries.threeTenBp) + implementation(libs.threeTenBp) } \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..4b8032356 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,84 @@ +[versions] +ktlint = "0.40.0" + +gradle-plugin = "7.3.1" + +androidx-core = "1.9.0" +androix-lifecycle = "2.5.1" +androidx-paging = "2.1.2" +androidx-preference = "1.2.0" +androidx-recycler = "1.3.0-rc01" +androidx-test = "1.5.1" +androidx-test-ext = "1.1.4" +androidx-work = "2.7.1" + +jetbrains-dokka = "1.7.20" +jetbrains-kotlin = "1.7.21" +jetbrains-kotlinx-coroutines = "1.6.4" + +io-mockk = "1.13.2" + +[libraries] +threeTenBp = "com.jakewharton.threetenabp:threetenabp:1.4.3" +timber = "com.jakewharton.timber:timber:5.0.1" +junit = "junit:junit:4.13.2" + +android-gradle-plugin = { module = "com.android.tools.build:gradle", version.ref = "gradle-plugin" } + +androidx-coreKtx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } + +androidx-lifecycle-extensions = "androidx.lifecycle:lifecycle-extensions:2.2.0" +androidx-lifecycle-runTimeKtx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "androix-lifecycle" } +androidx-lifecycle-liveDataKtx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "androix-lifecycle" } +androidx-lifecycle-viewModelKtx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "androix-lifecycle" } +androidx-lifecycle-liveDataCoreKtx = { module = "androidx.lifecycle:lifecycle-livedata-core-ktx", version.ref = "androix-lifecycle" } + +androidx-paging-common = { module = "androidx.paging:paging-common-ktx", version.ref = "androidx-paging" } +androidx-paging-runtime = { module = "androidx.paging:paging-runtime", version.ref = "androidx-paging" } +androidx-paging-runtimeKtx = { module = "androidx.paging:paging-runtime-ktx", version.ref = "androidx-paging" } + +androidx-preference = { module = "androidx.preference:preference", version.ref = "androidx-preference" } +androidx-preferenceKtx = { module = "androidx.preference:preference-ktx", version.ref = "androidx-preference" } + +androidx-recyclerView = { module = "androidx.recyclerview:recyclerview", version.ref = "androidx-recycler" } +androidx-recyclerViewSelection = { module = "androidx.recyclerview:recyclerview-selection", version.ref = "androidx-recycler" } + +androidx-startupRuntime = "androidx.startup:startup-runtime:1.1.1" + +androidx-swipeRefreshLayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01" + +androidx-test-core = { module = "androidx.test:core", version.ref = "androidx-test" } +androidx-test-coreKtx = { module = "androidx.test:core-ktx", version.ref = "androidx-test" } +androidx-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test" } +androidx-test-rules = { module = "androidx.test:rules", version.ref = "androidx-test" } + +androidx-junit = { module = "androidx.test.ext:junit", version.ref = "androidx-test-ext" } +androidx-junitKtx = { module = "androidx.test.ext:junit-ktx", version.ref = "androidx-test-ext" } + +androidx-runtimeKtx = { module = "androidx.work:work-runtime-ktx", version.ref = "androidx-work" } +androidx-runtime = { module = "androidx.work:work-runtime", version.ref = "androidx-work" } +androidx-test = { module = "androidx.work:work-test", version.ref = "androidx-work" } + +androidx-work-runtimeKtx = { module = "androidx.work:work-runtime-ktx", version.ref = "androidx-work" } +androidx-work-runtime = { module = "androidx.work:work-runtime", version.ref = "androidx-work" } +androidx-work-test = { module = "androidx.work:work-test", version.ref = "androidx-work" } + +cash-turbine = "app.cash.turbine:turbine:0.12.1" + +google-android-material = "com.google.android.material:material:1.7.0" + +jetbrains-dokka-gradle = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "jetbrains-dokka" } +jetbrains-kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "jetbrains-kotlin" } +jetbrains-kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "jetbrains-kotlin" } +jetbrains-kotlin-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "jetbrains-kotlin" } +jetbrains-kotlin-extensions = { module = "org.jetbrains.kotlin:kotlin-android-extensions", version.ref = "jetbrains-kotlin" } +jetbrains-kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "jetbrains-kotlinx-coroutines" } +jetbrains-kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "jetbrains-kotlinx-coroutines" } +jetbrains-kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "jetbrains-kotlinx-coroutines" } + +mockk = { module = "io.mockk:mockk", version.ref = "io-mockk" } +mockk-android = { module = "io.mockk:mockk-android", version.ref = "io-mockk" } + +gradle-versions = "com.github.ben-manes:gradle-versions-plugin:0.44.0" + +spotless-gradle = "com.diffplug.spotless:spotless-plugin-gradle:6.11.0" \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 7454180f2..249e5832f 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 669386b87..8fad3f5a9 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c5158..a69d9cb6c 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,101 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=`expr $i + 1` + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index ac1b06f93..53a6b238d 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -14,7 +14,7 @@ @rem limitations under the License. @rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,7 +25,7 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto execute +if %ERRORLEVEL% equ 0 goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -75,13 +75,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/recycler/build.gradle.kts b/recycler/build.gradle.kts index 932993b8d..2c0434767 100644 --- a/recycler/build.gradle.kts +++ b/recycler/build.gradle.kts @@ -1,5 +1,3 @@ -import co.anitrend.arch.buildSrc.Libraries - plugins { id("co.anitrend.arch") } @@ -10,9 +8,9 @@ dependencies { implementation(project(":theme")) implementation(project(":domain")) - implementation(Libraries.Google.material) + implementation(libs.google.android.material) - implementation(Libraries.AndroidX.SwipeRefresh.swipeRefreshLayout) - implementation(Libraries.AndroidX.Recycler.recyclerView) - implementation(Libraries.AndroidX.Paging.runtimeKtx) + implementation(libs.androidx.swipeRefreshLayout) + implementation(libs.androidx.paging.runtimeKtx) + implementation(libs.androidx.recyclerView) } \ No newline at end of file diff --git a/renovate.json b/renovate.json index 547d2c9e5..5b53f3f67 100644 --- a/renovate.json +++ b/renovate.json @@ -6,6 +6,8 @@ "addLabels": [ "dependencies" ], + "branchPrefix": "dependencies/", + "reviewers": ["wax911"], "baseBranches": [ "develop" ] diff --git a/theme/build.gradle.kts b/theme/build.gradle.kts index 5e9f9fe83..70ee361a1 100644 --- a/theme/build.gradle.kts +++ b/theme/build.gradle.kts @@ -1,9 +1,7 @@ -import co.anitrend.arch.buildSrc.Libraries - plugins { id("co.anitrend.arch") } dependencies { - implementation(Libraries.Google.material) + implementation(libs.google.android.material) } \ No newline at end of file diff --git a/ui/build.gradle.kts b/ui/build.gradle.kts index 637eccb1b..d2df273ce 100644 --- a/ui/build.gradle.kts +++ b/ui/build.gradle.kts @@ -1,5 +1,3 @@ -import co.anitrend.arch.buildSrc.Libraries - plugins { id("co.anitrend.arch") } @@ -11,9 +9,9 @@ dependencies { implementation(project(":domain")) implementation(project(":recycler")) - implementation(Libraries.Google.material) + implementation(libs.google.android.material) - implementation(Libraries.AndroidX.Core.coreKtx) - implementation(Libraries.AndroidX.SwipeRefresh.swipeRefreshLayout) - implementation(Libraries.AndroidX.Paging.runtimeKtx) + implementation(libs.androidx.coreKtx) + implementation(libs.androidx.swipeRefreshLayout) + implementation(libs.androidx.paging.runtimeKtx) } \ No newline at end of file