diff --git a/.idea/artifacts/database_jvm.xml b/.idea/artifacts/database_jvm.xml index a32d631c..e1faad6e 100644 --- a/.idea/artifacts/database_jvm.xml +++ b/.idea/artifacts/database_jvm.xml @@ -2,7 +2,7 @@ $PROJECT_DIR$/database/build/libs - + \ No newline at end of file diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 37d1c36a..32db9efd 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,14 +1,14 @@ plugins { kotlin("jvm") - id("com.google.devtools.ksp") version Dependencies.KSP_VERSION + id("com.google.devtools.ksp") `lobsters-plugin` } dependencies { - api(Dependencies.ThirdParty.Retrofit.lib) - ksp(Dependencies.ThirdParty.Moshi.ksp) - implementation(Dependencies.ThirdParty.Retrofit.moshi) - testImplementation(Dependencies.Kotlin.Coroutines.core) + api(libs.thirdparty.retrofit.lib) + ksp(libs.thirdparty.moshi.ksp) + implementation(libs.thirdparty.retrofit.moshiConverter) + testImplementation(libs.kotlin.coroutines.core) testImplementation(kotlin("test-junit")) - testImplementation(Dependencies.Testing.mockWebServer) + testImplementation(libs.testing.mockWebServer) } diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 3487fa40..f6c4bc59 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,7 +5,7 @@ plugins { kotlin("android") kotlin("kapt") id("dagger.hilt.android.plugin") - id("org.jetbrains.compose") version Dependencies.JB_COMPOSE_VERSION + id("org.jetbrains.compose") id("shot") `versioning-plugin` `lobsters-plugin` @@ -27,28 +27,27 @@ android { } dependencies { - kapt(Dependencies.AndroidX.Hilt.daggerCompiler) + kapt(libs.androidx.hilt.daggerCompiler) implementation(projects.api) implementation(projects.common) implementation(projects.database) implementation(compose.foundation) implementation(compose.material) - implementation(Dependencies.AndroidX.appCompat) - implementation(Dependencies.AndroidX.browser) - implementation(Dependencies.AndroidX.datastore) - implementation(Dependencies.AndroidX.Compose.activity) - implementation(Dependencies.AndroidX.Compose.lifecycleViewModel) - implementation(Dependencies.AndroidX.Compose.navigation) - implementation(Dependencies.AndroidX.Compose.paging) - implementation(Dependencies.AndroidX.Compose.uiTooling) - implementation(Dependencies.AndroidX.Hilt.dagger) - implementation(Dependencies.AndroidX.Lifecycle.runtimeKtx) - implementation(Dependencies.AndroidX.Lifecycle.viewmodelKtx) - implementation(Dependencies.Kotlin.Coroutines.android) - implementation(Dependencies.ThirdParty.accompanistCoil) - implementation(Dependencies.ThirdParty.accompanistFlow) - implementation(Dependencies.ThirdParty.Moshi.lib) - implementation(Dependencies.ThirdParty.Retrofit.moshi) + implementation(libs.androidx.appcompat) + implementation(libs.androidx.browser) + implementation(libs.androidx.datastore) + implementation(libs.androidx.compose.activity) + implementation(libs.androidx.compose.lifecycleViewModel) + implementation(libs.androidx.compose.navigation) + implementation(libs.androidx.compose.paging) + implementation(libs.androidx.compose.uiTooling) + implementation(libs.androidx.hilt.dagger) + implementation(libs.bundles.androidxLifecycle) + implementation(libs.kotlin.coroutines.android) + implementation(libs.thirdparty.accompanistCoil) + implementation(libs.thirdparty.accompanistFlow) + implementation(libs.thirdparty.moshi.lib) + implementation(libs.thirdparty.retrofit.moshiConverter) testImplementation(kotlin("test-junit")) androidTestImplementation(kotlin("test-junit")) } diff --git a/build.gradle.kts b/build.gradle.kts index eb81133e..924ffed8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,7 +4,8 @@ subprojects { configurations.configureEach { resolutionStrategy { // Retrofit depends on a very old version of Moshi that causes moshi-ksp to fail - force(Dependencies.ThirdParty.Moshi.lib) + // Using gradle catalog here prevents compilation + force("com.squareup.moshi:moshi:1.12.0") } } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b55ecea0..34b2a0eb 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -3,6 +3,7 @@ plugins { `kotlin-dsl` } repositories { google() gradlePluginPortal() + maven(url = "https://maven.pkg.jetbrains.space/public/p/compose/dev") } kotlinDslPluginOptions { experimentalWarning.set(false) } @@ -25,10 +26,12 @@ gradlePlugin { } dependencies { - implementation(Plugins.android) - implementation(Plugins.hilt) - implementation(Plugins.jsemver) - implementation(Plugins.kotlin) - implementation(Plugins.shot) - implementation(Plugins.sqldelight) + implementation("com.android.tools.build:gradle:7.0.0-alpha14") + implementation("com.google.dagger:hilt-android-gradle-plugin:2.34.1-beta") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32") + implementation("com.google.devtools.ksp:symbol-processing-gradle-plugin:1.4.32-1.0.0-alpha07") + implementation("com.github.zafarkhaja:java-semver:0.9.0") + implementation("com.karumi:shot:5.10.3") + implementation("com.squareup.sqldelight:gradle-plugin:1.4.4") + implementation("org.jetbrains.compose:compose-gradle-plugin:0.4.0-build183") } diff --git a/buildSrc/buildSrc/build.gradle.kts b/buildSrc/buildSrc/build.gradle.kts deleted file mode 100644 index f4bc8a7e..00000000 --- a/buildSrc/buildSrc/build.gradle.kts +++ /dev/null @@ -1,17 +0,0 @@ -plugins { `kotlin-dsl` } - -repositories { - mavenCentral() - google() - gradlePluginPortal() -} - -kotlinDslPluginOptions { experimentalWarning.set(false) } - -// force compilation of Dependencies.kt so it can be referenced in buildSrc/build.gradle.kts -sourceSets.main { - java { - setSrcDirs(setOf(projectDir.parentFile.resolve("src/main/java"))) - include("Dependencies.kt") - } -} diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 00000000..215a5d58 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,7 @@ +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} diff --git a/buildSrc/src/main/java/CoreLibraryDesugaringPlugin.kt b/buildSrc/src/main/java/CoreLibraryDesugaringPlugin.kt index 7bd2c0b7..ba31163c 100644 --- a/buildSrc/src/main/java/CoreLibraryDesugaringPlugin.kt +++ b/buildSrc/src/main/java/CoreLibraryDesugaringPlugin.kt @@ -30,6 +30,6 @@ class CoreLibraryDesugaringPlugin : Plugin { private fun TestedExtension.configure(project: Project) { compileOptions.isCoreLibraryDesugaringEnabled = true - project.dependencies.add("coreLibraryDesugaring", Dependencies.AndroidX.coreLibraryDesugaring) + project.dependencies.add("coreLibraryDesugaring", "com.android.tools:desugar_jdk_libs:1.0.10") } } diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt deleted file mode 100644 index efb8b9ab..00000000 --- a/buildSrc/src/main/java/Dependencies.kt +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright © 2014-2020 The Android Password Store Authors. All Rights Reserved. - * SPDX-License-Identifier: GPL-3.0-only - */ - -private const val DAGGER_HILT_VERSION = "2.34.1-beta" - -object Plugins { - const val android = "com.android.tools.build:gradle:7.0.0-alpha14" - const val hilt = "com.google.dagger:hilt-android-gradle-plugin:${DAGGER_HILT_VERSION}" - const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.32" - const val jsemver = "com.github.zafarkhaja:java-semver:0.9.0" - const val shot = "com.karumi:shot:5.10.3" - const val sqldelight = "com.squareup.sqldelight:gradle-plugin:1.4.4" -} - -object Dependencies { - const val COMPOSE_VERSION = "1.0.0-beta04" - const val KSP_VERSION = "1.4.32-1.0.0-alpha07" - const val JB_COMPOSE_VERSION = "0.4.0-build183" - - object Kotlin { - - object Coroutines { - - private const val version = "1.4.3" - const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version" - const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version" - const val jvmCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$version" - } - } - - object AndroidX { - - const val appCompat = "androidx.appcompat:appcompat:1.3.0-rc01" - const val browser = "androidx.browser:browser:1.3.0" - const val coreLibraryDesugaring = "com.android.tools:desugar_jdk_libs:1.0.10" - const val datastore = "androidx.datastore:datastore-preferences:1.0.0-alpha08" - - object Compose { - - const val activity = "androidx.activity:activity-compose:1.3.0-alpha06" - const val compiler = "androidx.compose.compiler:compiler:$COMPOSE_VERSION" - const val foundation = "androidx.compose.foundation:foundation:$COMPOSE_VERSION" - const val foundationLayout = "androidx.compose.foundation:foundation-layout:$COMPOSE_VERSION" - const val lifecycleViewModel = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04" - const val material = "androidx.compose.material:material:$COMPOSE_VERSION" - const val navigation = "androidx.navigation:navigation-compose:1.0.0-alpha10" - const val paging = "androidx.paging:paging-compose:1.0.0-alpha08" - const val runtime = "androidx.compose.runtime:runtime:$COMPOSE_VERSION" - const val ui = "androidx.compose.ui:ui:$COMPOSE_VERSION" - const val uiUnit = "androidx.compose.ui:ui-unit:$COMPOSE_VERSION" - const val uiTooling = "androidx.compose.ui:ui-tooling:$COMPOSE_VERSION" - } - - object Hilt { - const val dagger = "com.google.dagger:hilt-android:$DAGGER_HILT_VERSION" - const val daggerCompiler = "com.google.dagger:hilt-compiler:$DAGGER_HILT_VERSION" - } - - object Lifecycle { - - private const val version = "2.4.0-alpha01" - const val runtimeKtx = "androidx.lifecycle:lifecycle-runtime-ktx:$version" - const val viewmodelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version" - } - } - - object ThirdParty { - - private const val accompanistVersion = "0.7.1" - const val accompanistCoil = "com.google.accompanist:accompanist-coil:$accompanistVersion" - const val accompanistFlow = "com.google.accompanist:accompanist-flowlayout:$accompanistVersion" - const val kamel = "com.alialbaali.kamel:kamel-image:0.2.0" - const val pullToRefresh = "com.puculek.pulltorefresh:pull-to-refresh-compose:1.0.1" - - object Moshi { - - const val lib = "com.squareup.moshi:moshi:1.12.0" - const val ksp = "dev.zacsweers.moshix:moshi-ksp:0.10.0" - } - - object Retrofit { - - private const val version = "2.9.0" - const val lib = "com.squareup.retrofit2:retrofit:$version" - const val moshi = "com.squareup.retrofit2:converter-moshi:$version" - } - - object SQLDelight { - - private const val version = "1.4.4" - const val jvmDriver = "com.squareup.sqldelight:sqlite-driver:$version" - const val androidDriver = "com.squareup.sqldelight:android-driver:$version" - } - } - - object Testing { - - const val mockWebServer = "com.squareup.okhttp3:mockwebserver3-junit4:5.0.0-alpha.2" - } -} diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 336c120c..c58456da 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,7 +1,7 @@ plugins { kotlin("multiplatform") id("com.android.library") - id("org.jetbrains.compose") version Dependencies.JB_COMPOSE_VERSION + id("org.jetbrains.compose") `lobsters-plugin` } @@ -26,7 +26,7 @@ kotlin { sourceSets { named("androidMain") { dependencies { - implementation(Dependencies.AndroidX.browser) + implementation(libs.androidx.browser) } } diff --git a/database/build.gradle.kts b/database/build.gradle.kts index 763013a7..5d66cdcd 100644 --- a/database/build.gradle.kts +++ b/database/build.gradle.kts @@ -26,18 +26,18 @@ kotlin { } val jvmTest by getting { dependencies { - implementation(Dependencies.Kotlin.Coroutines.core) + implementation(libs.kotlin.coroutines.core) implementation(kotlin("test-junit")) } } val jvmMain by getting { dependencies { - implementation(Dependencies.ThirdParty.SQLDelight.jvmDriver) + implementation(libs.thirdparty.sqldelight.jvmDriver) } } val androidMain by getting { dependencies { - implementation(Dependencies.ThirdParty.SQLDelight.androidDriver) + implementation(libs.thirdparty.sqldelight.androidDriver) } } } diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 3a5380ac..b912c10f 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -3,12 +3,10 @@ import org.jetbrains.compose.desktop.application.dsl.TargetFormat plugins { kotlin("multiplatform") - id("org.jetbrains.compose") version Dependencies.JB_COMPOSE_VERSION + id("org.jetbrains.compose") `lobsters-plugin` } -repositories { maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") } - kotlin { jvm() sourceSets { @@ -19,9 +17,9 @@ kotlin { implementation(projects.common) implementation(projects.database) implementation(compose.material) - implementation(Dependencies.Kotlin.Coroutines.jvmCore) - implementation(Dependencies.ThirdParty.kamel) - implementation(Dependencies.ThirdParty.Retrofit.moshi) + implementation(libs.kotlin.coroutines.jvm) + implementation(libs.thirdparty.kamel) + implementation(libs.thirdparty.retrofit.moshiConverter) } } } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 00000000..d0fdd587 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,80 @@ +# Centralized versions for dependencies that share versions +[versions] +accompanist = "0.7.1" +androidx_test = "1.4.0-alpha05" +compose = "1.0.0-beta04" +coroutines = "1.4.3" +dagger_hilt = "2.34.1-beta" +jb_compose = "0.4.0-build183" +kotlin = "1.4.32" +ksp = "1.4.32-1.0.0-alpha07" +lifecycle = "2.4.0-alpha01" +retrofit = "2.9.0" +sqldelight = "1.4.4" + +[libraries] +# buildSrc dependencies +androidGradlePlugin = "com.android.tools.build:gradle:7.0.0-alpha14" +composeGradlePlugin = { module = "org.jetbrains.compose:compose-gradle-plugin", version.ref = "jb_compose" } +hiltGradlePlugin = { module = "com.google.dagger:hilt-android-gradle-plugin", version.ref = "dagger_hilt" } +jsemverGradlePlugin = "com.github.zafarkhaja:java-semver:0.9.0" +kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +kspGradlePlugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" } +shotGradlePlugin = "com.karumi:shot:5.10.3" +sqldelightGradlePlugin = { module = "com.squareup.sqldelight:gradle-plugin", version.ref = "sqldelight" } + +# Kotlin dependencies +kotlin-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } +kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } +kotlin-coroutines-jvm = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-jvm", version.ref = "coroutines" } + +# AndroidX dependencies +androidx-appcompat = "androidx.appcompat:appcompat:1.3.0-rc01" +androidx-browser = "androidx.browser:browser:1.3.0" +androidx-coreLibraryDesugaring = "com.android.tools:desugar_jdk_libs:1.0.10" +androidx-datastore = "androidx.datastore:datastore-preferences:1.0.0-alpha08" +androidx-lifecycle-runtimeKtx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" } +androidx-lifecycle-viewmodelKtx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycle" } + +# Compose dependencies +androidx-compose-activity = "androidx.activity:activity-compose:1.3.0-alpha06" +androidx-compose-lifecycleViewModel = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha04" +androidx-compose-navigation = "androidx.navigation:navigation-compose:1.0.0-alpha10" +androidx-compose-paging = "androidx.paging:paging-compose:1.0.0-alpha08" +androidx-compose-uiTooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } + +# Hilt dependencies +androidx-hilt-dagger = { module = "com.google.dagger:hilt-android", version.ref = "dagger_hilt" } +androidx-hilt-daggerCompiler = { module = "com.google.dagger:hilt-compiler", version.ref = "dagger_hilt" } + +# Third-party dependencies +thirdparty-accompanistCoil = { module = "com.google.accompanist:accompanist-coil", version.ref = "accompanist" } +thirdparty-accompanistFlow = { module = "com.google.accompanist:accompanist-flowlayout", version.ref = "accompanist" } +thirdparty-kamel = "com.alialbaali.kamel:kamel-image:0.2.0" +thirdparty-pullToRefresh = "com.puculek.pulltorefresh:pull-to-refresh-compose:1.0.1" + +# Moshi dependencies +thirdparty-moshi-lib = "com.squareup.moshi:moshi:1.12.0" +thirdparty-moshi-ksp = "dev.zacsweers.moshix:moshi-ksp:0.10.0" + +# Retrofit dependencies +thirdparty-retrofit-lib = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +thirdparty-retrofit-moshiConverter = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" } + +# Sqldelight dependencies +thirdparty-sqldelight-jvmDriver = { module = "com.squareup.sqldelight:sqlite-driver", version.ref = "sqldelight" } +thirdparty-sqldelight-androidDriver = { module = "com.squareup.sqldelight:android-driver", version.ref = "sqldelight" } + + +# Testing dependencies +androidx-testing-rules = { module = "androidx.test:rules", version.ref = "androidx_test" } +androidx-testing-runner = { module = "androidx.test:runner", version.ref = "androidx_test" } +testing-junit = "junit:junit:4.13.2" +testing-mockWebServer = "com.squareup.okhttp3:mockwebserver3-junit4:5.0.0-alpha.2" +testing-kotlintest-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } + +# Bundles of dependencies usually used together so they can be included in one go +[bundles] +androidxLifecycle = ["androidx-lifecycle-runtimeKtx", "androidx-lifecycle-viewmodelKtx"] +testDependencies = ["testing-junit", "testing-kotlintest-junit"] +androidTestDependencies = ["androidx-testing-rules", "androidx-testing-runner"] \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index d58439c8..40504a2e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -7,6 +7,7 @@ include(":database") include(":desktop") enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") +enableFeaturePreview("VERSION_CATALOGS") pluginManagement { repositories {