From 1399d97e8e4930ccc7474cf02dc5039b07ca8626 Mon Sep 17 00:00:00 2001 From: Reza Najafi Date: Fri, 23 Feb 2024 09:00:12 +0100 Subject: [PATCH] Refactors BuildSrc to Version Catalog Adds Gradle Convention Plugins --- app/build.gradle.kts | 64 ++-- app/src/main/AndroidManifest.xml | 2 +- .../features/search/SearchFragment.kt | 2 + build-logic/convention/build.gradle.kts | 51 +++ .../AndroidApplicationConventionPlugin.kt | 22 ++ .../kotlin/AndroidHiltConventionPlugin.kt | 22 ++ .../kotlin/AndroidLibraryConventionPlugin.kt | 32 ++ .../main/kotlin/JvmLibraryConventionPlugin.kt | 14 + .../flickrSearch/AndroidInstrumentedTests.kt | 19 + .../android/flickrSearch/KotlinAndroid.kt | 70 ++++ .../android/flickrSearch/ProjectExtensions.kt | 9 + build-logic/gradle.properties | 4 + build-logic/settings.gradle.kts | 14 + build.gradle.kts | 63 +++- buildSrc/build.gradle.kts | 9 - buildSrc/src/main/kotlin/Config.kt | 14 - buildSrc/src/main/kotlin/Dependencies.kt | 47 --- buildSrc/src/main/kotlin/GradlePlugins.kt | 5 - buildSrc/src/main/kotlin/Versions.kt | 26 -- core/build.gradle.kts | 14 +- data/build.gradle.kts | 49 +-- .../data/core/util/FlickrInterceptor.kt | 5 +- domain/build.gradle.kts | 5 +- gradle.properties | 21 +- gradle/libs.versions.toml | 336 ++++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- platform/build.gradle.kts | 14 + settings.gradle.kts | 49 ++- 28 files changed, 780 insertions(+), 204 deletions(-) create mode 100644 build-logic/convention/build.gradle.kts create mode 100644 build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/AndroidHiltConventionPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt create mode 100644 build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/AndroidInstrumentedTests.kt create mode 100644 build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/KotlinAndroid.kt create mode 100644 build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/ProjectExtensions.kt create mode 100644 build-logic/gradle.properties create mode 100644 build-logic/settings.gradle.kts delete mode 100644 buildSrc/build.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/Config.kt delete mode 100644 buildSrc/src/main/kotlin/Dependencies.kt delete mode 100644 buildSrc/src/main/kotlin/GradlePlugins.kt delete mode 100644 buildSrc/src/main/kotlin/Versions.kt create mode 100644 gradle/libs.versions.toml create mode 100644 platform/build.gradle.kts diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 5528ca1..236fb51 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,21 +1,22 @@ plugins { - id("com.android.application") - kotlin("android") - kotlin("kapt") - id("dagger.hilt.android.plugin") + alias(libs.plugins.flickersearch.android.application) + alias(libs.plugins.flickersearch.hilt) + alias(libs.plugins.sgp.base) + alias(libs.plugins.kotlin.kapt) } android { - compileSdkVersion(Config.compileSdkVersion) - buildToolsVersion(Config.buildToolsVersion) + + namespace = "ir.zinutech.android.flickrsearch" defaultConfig { applicationId = "ir.zinutech.android.flickrsearch" - minSdkVersion(Config.minSdkVersion) - targetSdkVersion(Config.targetSdkVersion) - versionCode = Config.versionCode - versionName = Config.versionName - testInstrumentationRunner = Config.androidTestInstrumentation + + versionCode = 1 + versionName = "1.0" + + configure { archivesName.set("flickrSearch") } + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" buildConfigField("String", "FLICKR_API_KEY", "\"5a2cc90782760b3a6b3eca570dfaf5c3\"") } @@ -32,43 +33,30 @@ android { buildFeatures { dataBinding = true + buildConfig = true } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } } dependencies { implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar")))) - implementation(project(":domain")) - implementation(project(":core")) - implementation(project(":data")) + implementation(projects.domain) + runtimeOnly(projects.data) + implementation(projects.core) /*Kotlin*/ - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.Kotlin.coroutinesCore) + implementation(libs.kotlin.coroutines) /*AndroidX*/ - implementation(Dependencies.AndroidX.appCompat) - implementation(Dependencies.AndroidX.fragmentKtx) - implementation(Dependencies.AndroidX.coreKtx) - implementation(Dependencies.AndroidX.material) - implementation(Dependencies.AndroidX.constraintLayout) - implementation(Dependencies.AndroidX.viewModelKtx) - implementation(Dependencies.AndroidX.lifeCycleCommon) + implementation(libs.androidx.appCompat) + implementation(libs.androidx.fragment.ktx) + implementation(libs.androidx.coreKtx) + implementation(libs.androidx.coreKtx) + implementation(libs.androidx.constraintlayout) + implementation(libs.google.material) /*Misc*/ - implementation(Dependencies.Misc.timber) - implementation(Dependencies.Misc.viewBindingDelegate) - implementation(Dependencies.Misc.coil) - - /*Dagger*/ - implementation(Dependencies.Dagger.Hilt.android) - implementation(Dependencies.Dagger.Hilt.viewModel) - kapt(Dependencies.Dagger.Hilt.compiler) + implementation(libs.misc.timber) + implementation(libs.viewbindingpropertydelegate) + implementation(libs.coil.default) } \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 6acad9f..cafdb00 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -11,7 +11,7 @@ android:supportsRtl="true" android:name=".FlickrSearch" android:theme="@style/Theme.FlickrSearch"> - + diff --git a/app/src/main/java/ir/zinutech/android/flickrsearch/features/search/SearchFragment.kt b/app/src/main/java/ir/zinutech/android/flickrsearch/features/search/SearchFragment.kt index 98ffea8..351724e 100644 --- a/app/src/main/java/ir/zinutech/android/flickrsearch/features/search/SearchFragment.kt +++ b/app/src/main/java/ir/zinutech/android/flickrsearch/features/search/SearchFragment.kt @@ -125,6 +125,8 @@ class SearchFragment : Fragment(R.layout.fragment_search_layout) { SearchViewModel.SearchUiState.EmptyResult -> { showEmptyResultUi() } + + null -> {} } } diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.kts new file mode 100644 index 0000000..763ee9a --- /dev/null +++ b/build-logic/convention/build.gradle.kts @@ -0,0 +1,51 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +plugins { + `kotlin-dsl` +} + +group = "ir.zinutech.android.flickrSearch.buildlogic" + +java { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 +} +tasks.withType().configureEach { + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } +} + +dependencies { + compileOnly(libs.android.gradlePlugin) + compileOnly(libs.android.tools.common) + compileOnly(libs.kotlin.gradlePlugin) +} + +tasks { + validatePlugins { + enableStricterValidation = true + failOnWarning = true + } +} + +gradlePlugin { + plugins { + register("androidApplication") { + id = "flickrsearch.android.application" + implementationClass = "AndroidApplicationConventionPlugin" + } + register("androidLibrary") { + id = "flickrsearch.android.library" + implementationClass = "AndroidLibraryConventionPlugin" + } + register("androidHilt") { + id = "flickrsearch.android.hilt" + implementationClass = "AndroidHiltConventionPlugin" + } + register("jvmLibrary") { + id = "flickrsearch.jvm.library" + implementationClass = "JvmLibraryConventionPlugin" + } + } +} diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt new file mode 100644 index 0000000..7287cd8 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt @@ -0,0 +1,22 @@ +import com.android.build.api.dsl.ApplicationExtension +import ir.zinutech.android.flickrSearch.configureKotlinAndroid +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure + +class AndroidApplicationConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.application") + apply("org.jetbrains.kotlin.android") + } + + extensions.configure { + configureKotlinAndroid(this) + defaultConfig.targetSdk = 34 + } + } + } + +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/AndroidHiltConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidHiltConventionPlugin.kt new file mode 100644 index 0000000..a0642a4 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/AndroidHiltConventionPlugin.kt @@ -0,0 +1,22 @@ +import ir.zinutech.android.flickrSearch.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.dependencies + +class AndroidHiltConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.google.devtools.ksp") + apply("dagger.hilt.android.plugin") + } + + dependencies { + "implementation"(libs.findLibrary("hilt.android").get()) + "ksp"(libs.findLibrary("hilt.compiler").get()) + } + + } + } + +} diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt new file mode 100644 index 0000000..c487a06 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt @@ -0,0 +1,32 @@ +import com.android.build.api.variant.LibraryAndroidComponentsExtension +import com.android.build.gradle.LibraryExtension +import ir.zinutech.android.flickrSearch.configureKotlinAndroid +import ir.zinutech.android.flickrSearch.disableUnnecessaryAndroidTests +import ir.zinutech.android.flickrSearch.libs +import org.gradle.api.Plugin +import org.gradle.api.Project +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.kotlin + +class AndroidLibraryConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("com.android.library") + apply("org.jetbrains.kotlin.android") + } + + extensions.configure { + configureKotlinAndroid(this) + defaultConfig.targetSdk = 34 + } + extensions.configure { + disableUnnecessaryAndroidTests(target) + } + dependencies { + add("testImplementation", kotlin("test")) + } + } + } +} diff --git a/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt new file mode 100644 index 0000000..04a7f67 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt @@ -0,0 +1,14 @@ +import ir.zinutech.android.flickrSearch.configureKotlinJvm +import org.gradle.api.Plugin +import org.gradle.api.Project + +class JvmLibraryConventionPlugin : Plugin { + override fun apply(target: Project) { + with(target) { + with(pluginManager) { + apply("org.jetbrains.kotlin.jvm") + } + configureKotlinJvm() + } + } +} \ No newline at end of file diff --git a/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/AndroidInstrumentedTests.kt b/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/AndroidInstrumentedTests.kt new file mode 100644 index 0000000..1f85c73 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/AndroidInstrumentedTests.kt @@ -0,0 +1,19 @@ +package ir.zinutech.android.flickrSearch + +import com.android.build.api.variant.LibraryAndroidComponentsExtension +import org.gradle.api.Project + +/** + * Disable unnecessary Android instrumented tests for the [project] if there is no `androidTest` folder. + * Otherwise, these projects would be compiled, packaged, installed and ran only to end-up with the following message: + * + * > Starting 0 tests on AVD + * + * Note: this could be improved by checking other potential sourceSets based on buildTypes and flavors. + */ +internal fun LibraryAndroidComponentsExtension.disableUnnecessaryAndroidTests( + project: Project, +) = beforeVariants { + it.enableAndroidTest = it.enableAndroidTest + && project.projectDir.resolve("src/androidTest").exists() +} diff --git a/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/KotlinAndroid.kt new file mode 100644 index 0000000..c5eefdb --- /dev/null +++ b/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/KotlinAndroid.kt @@ -0,0 +1,70 @@ +package ir.zinutech.android.flickrSearch + +import com.android.build.api.dsl.CommonExtension +import org.gradle.api.JavaVersion +import org.gradle.api.Project +import org.gradle.api.plugins.JavaPluginExtension +import org.gradle.kotlin.dsl.configure +import org.gradle.kotlin.dsl.dependencies +import org.gradle.kotlin.dsl.provideDelegate +import org.gradle.kotlin.dsl.withType +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +/** + * Configure base Kotlin with Android options + */ +internal fun Project.configureKotlinAndroid( + commonExtension: CommonExtension<*, *, *, *, *, *>, +) { + commonExtension.apply { + compileSdk = 34 + + defaultConfig { + minSdk = 21 + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + } + + configureKotlin() + + dependencies { +// add("coreLibraryDesugaring", libs.findLibrary("android.desugarJdkLibs").get()) + } +} + +/** + * Configure base Kotlin options for JVM (non-Android) + */ +internal fun Project.configureKotlinJvm() { + extensions.configure { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + configureKotlin() +} + +/** + * Configure base Kotlin options + */ +private fun Project.configureKotlin() { + // Use withType to workaround https://youtrack.jetbrains.com/issue/KT-55947 + tasks.withType().configureEach { + kotlinOptions { + // Set JVM target to 11 + jvmTarget = JavaVersion.VERSION_17.toString() + // Treat all Kotlin warnings as errors (disabled by default) + // Override by setting warningsAsErrors=true in your ~/.gradle/gradle.properties + val warningsAsErrors: String? by project + allWarningsAsErrors = warningsAsErrors.toBoolean() + freeCompilerArgs = freeCompilerArgs + listOf( + // Enable experimental coroutines APIs, including Flow + "-opt-in=kotlinx.coroutines.ExperimentalCoroutinesApi", + ) + } + } +} diff --git a/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/ProjectExtensions.kt b/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/ProjectExtensions.kt new file mode 100644 index 0000000..2416118 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/ir/zinutech/android/flickrSearch/ProjectExtensions.kt @@ -0,0 +1,9 @@ +package ir.zinutech.android.flickrSearch + +import org.gradle.api.Project +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.kotlin.dsl.getByType + +val Project.libs + get(): VersionCatalog = extensions.getByType().named("libs") diff --git a/build-logic/gradle.properties b/build-logic/gradle.properties new file mode 100644 index 0000000..1c9073e --- /dev/null +++ b/build-logic/gradle.properties @@ -0,0 +1,4 @@ +# Gradle properties are not passed to included builds https://github.com/gradle/gradle/issues/2534 +org.gradle.parallel=true +org.gradle.caching=true +org.gradle.configureondemand=true diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 0000000..2907fbf --- /dev/null +++ b/build-logic/settings.gradle.kts @@ -0,0 +1,14 @@ +dependencyResolutionManagement { + repositories { + google() + mavenCentral() + } + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} + +rootProject.name = "build-logic" +include(":convention") diff --git a/build.gradle.kts b/build.gradle.kts index 740268a..02fe0ef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,22 +1,61 @@ +import com.autonomousapps.DependencyAnalysisExtension +import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask + + +plugins { + alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.kotlin.android) apply false + alias(libs.plugins.kotlin.kapt) apply false + alias(libs.plugins.android.application) apply false + alias(libs.plugins.android.library) apply false + alias(libs.plugins.android.test) apply false + alias(libs.plugins.sgp.root) + alias(libs.plugins.sgp.base) + alias(libs.plugins.spotless) apply false + alias(libs.plugins.doctor) apply false + alias(libs.plugins.ksp) apply false + alias(libs.plugins.cacheFixPlugin) apply false + alias(libs.plugins.detekt) apply false + alias(libs.plugins.retry) apply false + alias(libs.plugins.sortDependencies) apply false + alias(libs.plugins.dependencyAnalysis) apply false + alias(libs.plugins.versions) apply false + alias(libs.plugins.hilt) apply false +} buildscript { repositories { + gradlePluginPortal() google() - jcenter() - } - dependencies { - classpath(GradlePlugins.android) - classpath(GradlePlugins.kotlin) - classpath(GradlePlugins.hilt) } } allprojects { - repositories { - google() - jcenter() + apply(plugin = "com.github.ben-manes.versions") + fun isNonStable(version: String): Boolean { + val stableKeyword = + listOf("RELEASE", "FINAL", "GA").any { version.uppercase().contains(it) } + val regex = "^[0-9,.v-]+(-r)?$".toRegex() + val isStable = stableKeyword || regex.matches(version) + return isStable.not() + } + tasks.named("dependencyUpdates").configure { + rejectVersionIf { + isNonStable(candidate.version) + } + // optional parameters + checkForGradleUpdate = true + outputFormatter = "html" + outputDir = "build/dependencyUpdates" + reportfileName = "report" } } -tasks.register("clean", Delete::class) { - delete(rootProject.buildDir) -} \ No newline at end of file +apply(plugin = libs.plugins.dependencyAnalysis.get().pluginId) +configure { + structure { + bundle("compose-ui") { + primary("androidx.compose.ui:ui") + includeGroup("androidx.compose.ui") + } + } +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index a53bb06..0000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,9 +0,0 @@ -import org.gradle.kotlin.dsl.`kotlin-dsl` - -plugins { - `kotlin-dsl` -} - -repositories { - jcenter() -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Config.kt b/buildSrc/src/main/kotlin/Config.kt deleted file mode 100644 index 2a3968e..0000000 --- a/buildSrc/src/main/kotlin/Config.kt +++ /dev/null @@ -1,14 +0,0 @@ -object Config { - const val minSdkVersion = 21 - const val targetSdkVersion = 30 - const val compileSdkVersion = 30 - - const val buildToolsVersion = "30.0.3" - - const val versionCode = 1 - const val versionName = "1.0.0" - - const val applicationId = "ir.zinutech.android.flickrsearch" - - const val androidTestInstrumentation = "androidx.test.runner.AndroidJUnitRunner" -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt deleted file mode 100644 index df8aca2..0000000 --- a/buildSrc/src/main/kotlin/Dependencies.kt +++ /dev/null @@ -1,47 +0,0 @@ -object Dependencies { - - object Kotlin { - const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Versions.kotlin}" - const val coroutinesCore = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}" - } - - object AndroidX { - const val appCompat = "androidx.appcompat:appcompat:${Versions.appcompat}" - const val fragmentKtx = "androidx.fragment:fragment-ktx:${Versions.fragmentKtx}" - const val coreKtx = "androidx.core:core-ktx:${Versions.coreKtx}" - const val material = "com.google.android.material:material:${Versions.material}" - const val constraintLayout = "androidx.constraintlayout:constraintlayout:${Versions.constraintLayout}" - const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:${Versions.viewModel}" - const val lifeCycleCommon = "androidx.lifecycle:lifecycle-common-java8:${Versions.viewModel}" - } - - object Dagger { - const val dagger = "com.google.dagger:dagger:${Versions.dagger}" - const val compiler = "com.google.dagger:dagger-compiler:${Versions.dagger}" - object Hilt { - const val android = "com.google.dagger:hilt-android:${Versions.daggerHilt}" - const val compiler = "com.google.dagger:hilt-compiler:${Versions.daggerHilt}" - const val viewModel = "androidx.hilt:hilt-lifecycle-viewmodel:${Versions.hilt}" - } - } - - object Retrofit { - const val retrofit = "com.squareup.retrofit2:retrofit:${Versions.retrofit}" - const val moshiConverter = "com.squareup.retrofit2:converter-moshi:${Versions.retrofit}" - } - - object Moshi { - const val moshi = "com.squareup.moshi:moshi-kotlin:${Versions.moshi}" - const val lazyAdapter = "com.serjltt.moshi:moshi-lazy-adapters:2.2" - const val codgen = "com.squareup.moshi:moshi-kotlin-codegen:${Versions.moshi}" - } - - object Misc{ - const val timber = "com.jakewharton.timber:timber:${Versions.timber}" - const val viewBindingDelegate = "com.github.kirich1409:viewbindingpropertydelegate:${Versions.viewBindingDelegate}" - const val coil = "io.coil-kt:coil:${Versions.coil}" - const val chuckerDebug = "com.github.chuckerteam.chucker:library:${Versions.chucker}" - const val chuckerRelease = "com.github.chuckerteam.chucker:library-no-op:${Versions.chucker}" - } - -} diff --git a/buildSrc/src/main/kotlin/GradlePlugins.kt b/buildSrc/src/main/kotlin/GradlePlugins.kt deleted file mode 100644 index bdfb002..0000000 --- a/buildSrc/src/main/kotlin/GradlePlugins.kt +++ /dev/null @@ -1,5 +0,0 @@ -object GradlePlugins { - const val android = "com.android.tools.build:gradle:${Versions.gradle}" - const val kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}" - const val hilt = "com.google.dagger:hilt-android-gradle-plugin:${Versions.daggerHilt}" -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt deleted file mode 100644 index 1321db7..0000000 --- a/buildSrc/src/main/kotlin/Versions.kt +++ /dev/null @@ -1,26 +0,0 @@ -object Versions { - const val gradle = "4.1.3" - const val kotlin = "1.4.31" - const val kotlinCoroutines = "1.4.3" - - const val coreKtx = "1.2.0" - const val material = "1.3.0" - const val appcompat = "1.3.0-alpha01" - const val fragmentKtx = "1.3.1" - const val constraintLayout = "2.0.0-beta8" - const val viewModel = "2.3.0" - - const val dagger = "2.33" - const val daggerHilt = "2.33-beta" - const val hilt = "1.0.0-alpha03" - - const val retrofit = "2.9.0" - - const val moshi = "1.11.0" - - const val timber = "4.7.1" - const val viewBindingDelegate = "1.4.4" - const val coil = "1.1.1" - - const val chucker = "3.4.0" -} \ No newline at end of file diff --git a/core/build.gradle.kts b/core/build.gradle.kts index d5f8d63..15279ca 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,15 +1,11 @@ plugins { - id("kotlin") - kotlin("kapt") + alias(libs.plugins.flickersearch.jvm.library) + alias(libs.plugins.ksp) } dependencies { - /*Kotlin*/ - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.Kotlin.coroutinesCore) - - /*Dagger*/ - implementation(Dependencies.Dagger.dagger) - kapt(Dependencies.Dagger.compiler) + implementation(libs.kotlin.coroutines) + implementation(libs.dagger.runtime) + ksp(libs.dagger.apt.compiler) } \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts index 2b06e97..b7bebd3 100644 --- a/data/build.gradle.kts +++ b/data/build.gradle.kts @@ -1,47 +1,32 @@ + plugins { - id("com.android.library") - kotlin("android") - kotlin("kapt") + alias(libs.plugins.flickersearch.android.library) + alias(libs.plugins.flickersearch.hilt) + alias(libs.plugins.ksp) } android { - compileSdkVersion(Config.compileSdkVersion) - buildToolsVersion(Config.buildToolsVersion) - - defaultConfig { - minSdkVersion(Config.minSdkVersion) - targetSdkVersion(Config.targetSdkVersion) - versionCode = Config.versionCode - versionName = Config.versionName - } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = "1.8" - } + namespace = "ir.zinutech.android.flickrsearch.data" + compileSdk = 34 + + defaultConfig { minSdk = 21 } } dependencies { - implementation(project(":domain")) - implementation(project(":core")) + implementation(projects.domain) + implementation(projects.core) - /*Dagger*/ - implementation(Dependencies.Dagger.dagger) - implementation(Dependencies.Dagger.Hilt.android) - kapt(Dependencies.Dagger.Hilt.compiler) /*Retrofit*/ - api(Dependencies.Retrofit.retrofit) - implementation(Dependencies.Retrofit.moshiConverter) + api(libs.retrofit.core) + implementation(libs.retrofit.moshi) /*Moshi*/ - api(Dependencies.Moshi.moshi) - implementation(Dependencies.Moshi.lazyAdapter) - kapt(Dependencies.Moshi.codgen) + api(libs.moshi.core) + implementation(libs.misc.moshiLazyAdapters) + ksp(libs.moshi.kotlin.codegen) /*Chucker*/ - debugImplementation(Dependencies.Misc.chuckerDebug) - releaseImplementation(Dependencies.Misc.chuckerRelease) + releaseImplementation(libs.chucker.noop) + debugImplementation(libs.chucker.library) } \ No newline at end of file diff --git a/data/src/main/java/ir/zinutech/android/flickrsearch/data/core/util/FlickrInterceptor.kt b/data/src/main/java/ir/zinutech/android/flickrsearch/data/core/util/FlickrInterceptor.kt index 511743f..5de3cd9 100644 --- a/data/src/main/java/ir/zinutech/android/flickrsearch/data/core/util/FlickrInterceptor.kt +++ b/data/src/main/java/ir/zinutech/android/flickrsearch/data/core/util/FlickrInterceptor.kt @@ -7,15 +7,14 @@ import okhttp3.Response class FlickrInterceptor(private val apiKey: String) : Interceptor { override fun intercept(chain: Interceptor.Chain): Response = chain.run { - val originalHttpUrl: HttpUrl = chain.request().url() + val originalHttpUrl: HttpUrl = chain.request().url val url = originalHttpUrl.newBuilder() .addQueryParameter(QUERY_PARAM_API_KEY, apiKey) .addQueryParameter(QUERY_PARAM_API_FORMAT, JSON_FORMAT) .addQueryParameter(QUERY_PARAM_NO_JSON_CALLBACK, NO_JSON) .build() - proceed(request().newBuilder().url(url).build() - ) + proceed(request().newBuilder().url(url).build()) } companion object { diff --git a/domain/build.gradle.kts b/domain/build.gradle.kts index a10a0da..cafaab7 100644 --- a/domain/build.gradle.kts +++ b/domain/build.gradle.kts @@ -1,9 +1,8 @@ plugins { - id("kotlin") + alias(libs.plugins.kotlin.jvm) } dependencies { - implementation(Dependencies.Kotlin.stdlib) - implementation(Dependencies.Dagger.dagger) + api(libs.javaxInject) } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 98bed16..69cf714 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. -org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx6g -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects @@ -16,6 +16,21 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 # https://developer.android.com/topic/libraries/support-library/androidx-rn android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX -android.enableJetifier=true +android.enableJetifier=false # Kotlin code style for this project: "official" or "obsolete": -kotlin.code.style=official \ No newline at end of file +kotlin.code.style=official + + +systemProp.javax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl +systemProp.javax.xml.transform.TransformerFactory=com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl +systemProp.javax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl + + +slack.allowWarnings=true +slack.robolectricTestSdks=28,29,30,31,32,33,34 +slack.robolectricIVersion=4 +slack.compileSdkVersion=android-34 +slack.minSdkVersion=21 +slack.targetSdkVersion=34 +slack.auto-apply.detekt=false +slack.lint.baseline-file-name=lint-baseline.xml \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..81704dd --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,336 @@ +[versions] +accompanist = "0.35.0-alpha" +agp = "8.4.0-alpha10" +androidTools = "31.2.2" +androidDesugarJdkLibs = "2.0.4" +androidx-activity = "1.9.0-alpha03" +androidx-core = "1.13.0-alpha05" +google-material = "1.9.0" +androidx-sqlite = "2.4.0" +appcompat = "1.7.0-alpha03" +benchmark = "1.2.3" +compose-material3 = "1.2.0" +emoji = "1.2.0-alpha03" +anvil = "2.4.9" +apollo = "3.8.2" +circuit = "0.19.1" +coil = "2.5.0" +compose = "1.7.0-alpha02" +# Pre-release versions for testing Kotlin previews can be found here +# https://androidx.dev/storage/compose-compiler/repository +compose-compiler = "1.5.9" +compose-compiler-kotlinVersion = "1.9.22" +compose-jb = "1.5.12" +compose-jb-compiler = "1.5.8.1" +compose-jb-kotlinVersion = "1.9.20" +corbind = "1.10.0" +coroutines = "1.8.0" +dagger = "2.50" +datastore = "1.1.0-beta01" +detekt = "1.23.5" +eithernet = "1.8.1" +flipper = "0.247.0" +gradleVersionsPlugin = "0.51.0" +jdk = "21" +jvmTarget = "17" +kotlin = "1.9.22" +kotlinx-metadata = "0.7.0" +kotlinx-serialization = "1.6.3" +kotlinxCoroutinesCore = "1.6.4" +ksp = "1.9.22-1.0.17" +ktfmt = "0.47" +leakcanary = "2.13" +chucker = "4.0.0" +lifecycle = "2.8.0-alpha01" +lifecycleViewmodelKtx = "2.7.0" +markwon = "4.6.2" +moshi = "1.15.1" +moshix = "0.25.1" +okhttp = "5.0.0-alpha.12" +okio = "3.8.0" +preferences = "1.2.1" +retrofit = "2.9.0" +slack-lint = "0.7.0" +sortDependencies = "0.6" +sgp = "0.15.4" +spotless = "6.25.0" +sqldelight = "2.0.1" +telephoto = "0.8.0" +tikxml = "0.8.15" +viewbindingpropertydelegate = "1.5.9" +xerial = "3.45.1.0" +collapsingToolbar = "2.3.5" +org-jetbrains-kotlin-android = "1.9.0" + +[plugins] +anvil = { id = "com.squareup.anvil", version.ref = "anvil" } +android-application = { id = "com.android.application", version.ref = "agp" } +android-library = { id = "com.android.library", version.ref = "agp" } +android-test = { id = "com.android.test", version.ref = "agp" } +apollo = { id = "com.apollographql.apollo3", version.ref = "apollo" } +baselineprofile = { id = "androidx.baselineprofile", version.ref = "benchmark" } +bugsnag = { id = "com.bugsnag.android.gradle", version = "8.1.0" } +cacheFixPlugin = { id = "org.gradle.android.cache-fix", version = "3.0.1" } +dependencyAnalysis = { id = "com.autonomousapps.dependency-analysis", version = "1.30.0" } +detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" } +doctor = { id = "com.osacky.doctor", version = "0.9.1" } +kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } +kotlin-kapt = { id = "org.jetbrains.kotlin.kapt", version.ref = "org-jetbrains-kotlin-android" } +kotlin-noarg = { id = "org.jetbrains.kotlin.plugin.noarg", version.ref = "kotlin" } +kotlin-parcelize = { id = "org.jetbrains.kotlin.plugin.parcelize", version.ref = "kotlin" } +kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } +licensee = { id = "app.cash.licensee", version = "1.9.1" } +moshix = { id = "dev.zacsweers.moshix", version.ref = "moshix" } +playPublisher = { id = "com.github.triplet.play", version = "3.9.0" } +redacted = { id = "dev.zacsweers.redacted", version = "1.7.1" } +retry = { id = "org.gradle.test-retry", version = "1.5.8" } +sgp-base = { id = "com.slack.gradle.base", version.ref = "sgp" } +sgp-root = { id = "com.slack.gradle.root", version.ref = "sgp" } +sortDependencies = { id = "com.squareup.sort-dependencies", version.ref = "sortDependencies" } +spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } +sqldelight = { id = "app.cash.sqldelight", version.ref = "sqldelight" } +versions = "com.github.ben-manes.versions:0.51.0" +hilt = { id = "com.google.dagger.hilt.android", version.ref = "dagger" } +flickersearch-android-application = { id = "flickrsearch.android.application", version = "unspecified" } +flickersearch-jvm-library = { id = "flickrsearch.jvm.library", version = "unspecified" } +flickersearch-hilt = { id = "flickrsearch.android.hilt", version = "unspecified" } +flickersearch-android-library = { id = "flickrsearch.android.library", version = "unspecified" } + +[libraries] +androidx-annotations = "androidx.annotation:annotation:1.7.1" +androidx-activity = { module = "androidx.activity:activity", version.ref = "androidx-activity" } +androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activity" } +androidx-appCompat = { module = "androidx.appcompat:appcompat", version.ref = "appcompat" } +androidx-appCompat-resources = { module = "androidx.appcompat:appcompat-resources", version.ref = "appcompat" } + +androidx-benchmark-macro-junit = { module = "androidx.benchmark:benchmark-macro-junit4", version.ref = "benchmark" } + +androidx-collection = "androidx.collection:collection:1.4.0" + +androidx-core = { module = "androidx.core:core", version.ref = "androidx-core" } +androidx-coreKtx = { module = "androidx.core:core-ktx", version.ref = "androidx-core" } +androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" } +google-material = { module = "com.google.android.material:material", version.ref = "google-material" } + +androidx-customTabs = "androidx.browser:browser:1.8.0-beta02" +androidx-design = "com.google.android.material:material:1.11.0" + +androidx-emojiAppcompat = { module = "androidx.emoji:emoji-appcompat", version.ref = "emoji" } +# Amusingly, appcompat depends on fragment 1.0.0, so we have to have this version to force the latest +androidx-fragment = "androidx.fragment:fragment:1.7.0-alpha10" +androidx-fragment-ktx = "androidx.fragment:fragment-ktx:1.7.0-alpha10" + +androidx-lifecycle-viewmodel-core = { module = "androidx.lifecycle:lifecycle-viewmodel", version.ref = "lifecycle" } +androidx-lifecycle-viewmodel-savedState = { module = "androidx.lifecycle:lifecycle-viewmodel-savedstate", version.ref = "lifecycle" } + +androidx-palette = "androidx.palette:palette:1.0.0" +androidx-paletteKtx = "androidx.palette:palette-ktx:1.0.0" + +androidx-preference = { module = "androidx.preference:preference", version.ref = "preferences" } +androidx-preferenceKtx = { module = "androidx.preference:preference-ktx", version = "1.2.1" } + +androidx-lifecycle-extensions = "androidx.lifecycle:lifecycle-extensions:2.2.0" +androidx-lifecycle-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycle" } + +androidx-sqlite-framework = { module = "androidx.sqlite:sqlite-framework", version.ref = "androidx-sqlite" } +androidx-sqlite = { module = "androidx.sqlite:sqlite", version.ref = "androidx-sqlite" } + +androidx-compose-animation-graphics = { module = "androidx.compose.animation:animation-graphics", version.ref = "compose" } +# Here to trigger renovate updates +androidx-compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "compose-compiler" } +androidx-compose-animation = { module = "androidx.compose.animation:animation", version.ref = "compose" } +androidx-compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" } +androidx-compose-uiTooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } +androidx-compose-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } +androidx-compose-googleFonts = { module = "androidx.compose.ui:ui-text-google-fonts", version.ref = "compose" } +androidx-compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } +androidx-compose-material-ripple = { module = "androidx.compose.material:material-ripple", version.ref = "compose" } +androidx-compose-materialIcons = { module = "androidx.compose.material:material-icons-core", version.ref = "compose" } +androidx-compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" } +androidx-compose-accompanist-adaptive = { module = "com.google.accompanist:accompanist-adaptive", version.ref = "accompanist" } +androidx-compose-accompanist-systemUi = { module = "com.google.accompanist:accompanist-systemuicontroller", version.ref = "accompanist" } +androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.2.0-alpha13" +androidx-paging-compose = "androidx.paging:paging-compose:3.3.0-alpha03" +androidx-compose-material-material3 = { module = "androidx.compose.material3:material3", version.ref = "compose-material3" } +androidx-compose-material-material3-windowSizeClass = { module = "androidx.compose.material3:material3-window-size-class", version.ref = "compose-material3" } +androidx-window = { module = "androidx.window:window", version = "1.3.0-alpha02" } +androidx-splashscreen = "androidx.core:core-splashscreen:1.1.0-alpha02" + +androidx-profileinstaller = "androidx.profileinstaller:profileinstaller:1.4.0-alpha01" +androidx-test-ext-junit = "androidx.test.ext:junit:1.1.5" +androidx-test-monitor = "androidx.test:monitor:1.7.0-alpha04" +androidx-test-uiautomator = "androidx.test.uiautomator:uiautomator:2.3.0-rc01" + +compose-compilerJb = { module = "org.jetbrains.compose.compiler:compiler", version.ref = "compose-jb-compiler" } +compose-runtime = { module = "org.jetbrains.compose.runtime:runtime", version.ref = "compose-jb" } +compose-runtime-saveable = { module = "org.jetbrains.compose.runtime:runtime-saveable", version.ref = "compose-jb" } +compose-ui = { module = "org.jetbrains.compose.ui:ui", version.ref = "compose-jb" } +compose-uiUtil = { module = "org.jetbrains.compose.ui:ui-util", version.ref = "compose-jb" } +compose-foundation = { module = "org.jetbrains.compose.foundation:foundation", version.ref = "compose-jb" } +compose-material-material = { module = "org.jetbrains.compose.material:material", version.ref = "compose-jb" } +compose-material-material3 = { module = "org.jetbrains.compose.material3:material3", version.ref = "compose-jb" } + +firebase-core = "com.google.firebase:firebase-core:21.1.1" +firebase-database = "com.google.firebase:firebase-database:20.3.0" + +anvil-annotations = { module = "com.squareup.anvil:annotations", version.ref = "anvil" } +anvil-annotationsOptional = { module = "com.squareup.anvil:annotations-optional", version.ref = "anvil" } + +apollo-api = { module = "com.apollographql.apollo3:apollo-api", version.ref = "apollo" } +apollo-httpcache = { module = "com.apollographql.apollo3:apollo-http-cache", version.ref = "apollo" } +apollo-normalizedCache = { module = "com.apollographql.apollo3:apollo-normalized-cache", version.ref = "apollo" } +apollo-normalizedCache-api = { module = "com.apollographql.apollo3:apollo-normalized-cache-api", version.ref = "apollo" } +apollo-runtime = { module = "com.apollographql.apollo3:apollo-runtime", version.ref = "apollo" } + +autoService-annotations = "com.google.auto.service:auto-service:1.1.1" +autoService-ksp = "dev.zacsweers.autoservice:auto-service-ksp:1.1.0" + +google-coreLibraryDesugaring = "com.android.tools:desugar_jdk_libs_minimal:2.0.4" +android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" } + +hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "dagger" } +hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "dagger" } +javapoet = "com.squareup:javapoet:1.13.0" + +circuit-backstack = { module = "com.slack.circuit:circuit-backstack", version.ref = "circuit" } +circuit-foundation = { module = "com.slack.circuit:circuit-foundation", version.ref = "circuit" } +circuit-overlay = { module = "com.slack.circuit:circuit-overlay", version.ref = "circuit" } +circuit-retained = { module = "com.slack.circuit:circuit-retained", version.ref = "circuit" } +circuit-runtime = { module = "com.slack.circuit:circuit-runtime", version.ref = "circuit" } +circuit-runtime-presenter = { module = "com.slack.circuit:circuit-runtime-presenter", version.ref = "circuit" } +circuit-runtime-screen = { module = "com.slack.circuit:circuit-runtime-screen", version.ref = "circuit" } +circuit-runtime-ui = { module = "com.slack.circuit:circuit-runtime-ui", version.ref = "circuit" } +circuit-codegen = { module = "com.slack.circuit:circuit-codegen", version.ref = "circuit" } +circuit-codegenAnnotations = { module = "com.slack.circuit:circuit-codegen-annotations", version.ref = "circuit" } +circuitx-android = { module = "com.slack.circuit:circuitx-android", version.ref = "circuit" } +circuitx-gestureNav = { module = "com.slack.circuit:circuitx-gesture-navigation", version.ref = "circuit" } +circuitx-overlays = { module = "com.slack.circuit:circuitx-overlays", version.ref = "circuit" } + +clikt = "com.github.ajalt.clikt:clikt:4.2.2" + +coil-base = { module = "io.coil-kt:coil-base", version.ref = "coil" } +coil-default = { module = "io.coil-kt:coil", version.ref = "coil" } +coil-gif = { module = "io.coil-kt:coil-gif", version.ref = "coil" } +coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" } +coil-compose-base = { module = "io.coil-kt:coil-compose-base", version.ref = "coil" } + +corbind = { module = "ru.ldralighieri.corbind:corbind", version.ref = "corbind" } +dagger-apt-compiler = { module = "com.google.dagger:dagger-compiler", version.ref = "dagger" } +dagger-runtime = { module = "com.google.dagger:dagger", version.ref = "dagger" } +dagger-spi = { module = "com.google.dagger:dagger-spi", version.ref = "dagger" } + +androidx-datastore-core = { module = "androidx.datastore:datastore-core", version.ref = "datastore" } +androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastore" } +androidx-datastore-preferences-core = { module = "androidx.datastore:datastore-preferences-core", version.ref = "datastore" } + +eithernet = { module = "com.slack.eithernet:eithernet", version.ref = "eithernet" } + +errorProneAnnotations = "com.google.errorprone:error_prone_annotations:2.25.0" + +fileSize = "me.saket.filesize:filesize:1.2.0" + +haze = "dev.chrisbanes.haze:haze:0.5.3" + +javaxInject = "javax.inject:javax.inject:1" + +kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } +kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines" } +kotlin-coroutinesAndroid = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "coroutines" } +kotlin-datetime = "org.jetbrains.kotlinx:kotlinx-datetime:0.5.0" +kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin" } +kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } +kotlinx-coroutines-core-v164 = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" } +kotlinx-immutable = "org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7" +kotlinx-serialization-core = { module = "org.jetbrains.kotlinx:kotlinx-serialization-core", version.ref = "kotlinx-serialization" } +kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" } + +chucker-noop = { module = "com.github.chuckerteam.chucker:library-no-op", version.ref = "chucker" } +chucker-library = { module = "com.github.chuckerteam.chucker:library", version.ref = "chucker" } +lints-compose = "com.slack.lint.compose:compose-lint-checks:1.3.1" + +markwon-core = { module = "io.noties.markwon:core", version.ref = "markwon" } +markwon-extStrikethrough = { module = "io.noties.markwon:ext-strikethrough", version.ref = "markwon" } +markwon-extTables = { module = "io.noties.markwon:ext-tables", version.ref = "markwon" } +markwon-extTasklist = { module = "io.noties.markwon:ext-tasklist", version.ref = "markwon" } +markwon-html = { module = "io.noties.markwon:html", version.ref = "markwon" } +markwon-image = { module = "io.noties.markwon:image", version.ref = "markwon" } +markwon-imageCoil = { module = "io.noties.markwon:image-coil", version.ref = "markwon" } +markwon-linkify = { module = "io.noties.markwon:linkify", version.ref = "markwon" } + +misc-leakCanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" } +misc-leakCanary-shark = { module = "com.squareup.leakcanary:shark", version.ref = "leakcanary" } +misc-leakCanaryObjectWatcherAndroid = { module = "com.squareup.leakcanary:leakcanary-object-watcher-android", version.ref = "leakcanary" } +misc-bugsnag = "com.bugsnag:bugsnag-android:6.2.0" +misc-byteunits = "com.jakewharton.byteunits:byteunits:0.9.1" + +misc-debug-flipper = { module = "com.facebook.flipper:flipper", version.ref = "flipper" } +misc-debug-flipperNetwork = { module = "com.facebook.flipper:flipper-network-plugin", version.ref = "flipper" } +misc-debug-soLoader = "com.facebook.soloader:soloader:0.11.0" +misc-debug-guava = "com.google.guava:guava:33.0.0-jre" +misc-debug-processPhoenix = "com.jakewharton:process-phoenix:2.1.2" +misc-debug-telescope = "com.mattprecious.telescope:telescope:2.3.0" + +misc-composeSettings = "com.github.alorma:compose-settings-ui-m3:1.0.3" +misc-composeSettings-base = "com.github.alorma:compose-settings-storage-base:1.0.3" +misc-composeSettings-datastore = "com.github.alorma:compose-settings-storage-datastore:0.27.0" +misc-javaxInject = "org.glassfish:javax.annotation:10.0-b28" +misc-jsoup = "org.jsoup:jsoup:1.17.2" +misc-jsr250 = "javax.annotation:jsr250-api:1.0" +misc-jsr305 = "com.google.code.findbugs:jsr305:3.0.2" +misc-moshiLazyAdapters = "com.serjltt.moshi:moshi-lazy-adapters:2.2" +misc-okio = { module = "com.squareup.okio:okio", version.ref = "okio" } +misc-okio-fakeFileSystem = { module = "com.squareup.okio:okio-fakefilesystem", version.ref = "okio" } +misc-tapTargetView = "com.getkeepsafe.taptargetview:taptargetview:1.13.3" +misc-timber = "com.jakewharton.timber:timber:5.0.1" +misc-unbescape = "org.unbescape:unbescape:1.1.6.RELEASE" + +moshi-core = { module = "com.squareup.moshi:moshi", version.ref = "moshi" } +moshi-kotlin-codegen = { module = "com.squareup.moshi:moshi-kotlin-codegen", version.ref = "moshi" } +moshi-shimo = "com.jakewharton.moshi:shimo:0.1.1" + +okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp" } +okhttp-core = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" } +okhttp-debug-loggingInterceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "okhttp" } + +renovateTrigger-ktfmt = { module = "com.facebook:ktfmt", version.ref = "ktfmt" } + +retrofit-core = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } +retrofit-debug-mock = { module = "com.squareup.retrofit2:retrofit-mock", version.ref = "retrofit" } +retrofit-moshi = { module = "com.squareup.retrofit2:converter-moshi", version.ref = "retrofit" } +retrofit-kotlinxSerialization = "com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0" + +slack-lint-checks = { module = "com.slack.lint:slack-lint-checks", version.ref = "slack-lint" } +slack-lint-annotations = { module = "com.slack.lint:slack-lint-annotations", version.ref = "slack-lint" } + +sqldelight-driver-android = { module = "app.cash.sqldelight:android-driver", version.ref = "sqldelight" } +sqldelight-driver-jvm = { module = "app.cash.sqldelight:sqlite-driver", version.ref = "sqldelight" } +sqldelight-coroutines = { module = "app.cash.sqldelight:coroutines-extensions", version.ref = "sqldelight" } +sqldelight-paging = { module = "app.cash.sqldelight:androidx-paging3-extensions", version.ref = "sqldelight" } +sqldelight-primitiveAdapters = { module = "app.cash.sqldelight:primitive-adapters", version.ref = "sqldelight" } +sqldelight-runtime = { module = "app.cash.sqldelight:runtime", version.ref = "sqldelight" } + +sqlite-xerial = { module = "org.xerial:sqlite-jdbc", version.ref = "xerial" } + +telephoto-zoomable = { module = "me.saket.telephoto:zoomable", version.ref = "telephoto" } +telephoto-zoomableImage = { module = "me.saket.telephoto:zoomable-image", version.ref = "telephoto" } +telephoto-zoomableImageCoil = { module = "me.saket.telephoto:zoomable-image-coil", version.ref = "telephoto" } + +tikxml-htmlEscape = { module = "com.tickaroo.tikxml:converter-htmlescape", version.ref = "tikxml" } + +collapsingToolbar = { module = "me.onebone:toolbar-compose", version.ref = "collapsingToolbar" } + +test-junit = "junit:junit:4.13.2" +test-truth = "com.google.truth:truth:1.4.1" + +# Dependencies of the included build-logic +android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "agp" } +android-tools-common = { group = "com.android.tools", name = "common", version.ref = "androidTools" } + +viewbindingpropertydelegate = { module = "com.github.kirich1409:viewbindingpropertydelegate", version.ref = "viewbindingpropertydelegate" } + + + + diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d73eec7..c41bf5e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip diff --git a/platform/build.gradle.kts b/platform/build.gradle.kts new file mode 100644 index 0000000..d93bf81 --- /dev/null +++ b/platform/build.gradle.kts @@ -0,0 +1,14 @@ +import slack.gradle.Platforms + +plugins { + alias(libs.plugins.sgp.base) + `java-platform` +} + +val catalogExtension = + extensions.findByType() ?: error("Could not find any version catalogs!") + +for (name in catalogExtension.catalogNames) { + val catalog = catalogExtension.named(name) + Platforms.applyFromCatalog(project, catalog) +} \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index a669a10..bbb3d45 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,2 +1,49 @@ include(":core", ":app", ":domain", "data") -rootProject.name = "FlickrSearch" \ No newline at end of file +rootProject.name = "FlickrSearch" + +pluginManagement { + includeBuild("build-logic") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + } +} +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") + +include(":platform") + +inline fun configureIncludedBuild(key: String, body: (path: String) -> Unit) { + System.getProperty("slack.include-build.$key")?.let(body) +} +configureIncludedBuild("sgp") { path -> + includeBuild(path) { + dependencySubstitution { + substitute(module("com.slack.gradle:sgp")).using(project(":slack-plugin")) + substitute(module("com.slack.gradle:sgp-agp-handler-api")) + .using(project(":agp-handlers:agp-handler-api")) + substitute(module("com.slack.gradle:sgp-agp-handler-82")) + .using(project(":agp-handlers:agp-handler-82")) + substitute(module("com.slack.gradle:sgp-agp-handler-83")) + .using(project(":agp-handlers:agp-handler-83")) + } + } +} + +// See comments on systemProp.slack.include-build.dagp property in gradle.properties +configureIncludedBuild("dagp") { path -> + includeBuild(path) { + dependencySubstitution { + substitute(module("com.autonomousapps:dependency-analysis-gradle-plugin")).using(project(":")) + } + } +} +include(":platform")