commit cfe5272b3d3fcdb64bdcec741819fb86f2025fd6 Author: vladimir-shperling Date: Tue Jan 9 14:10:16 2024 +0700 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6fbe8a4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/.gradle +/build \ No newline at end of file diff --git a/.gradle/8.2.1/executionHistory/executionHistory.bin b/.gradle/8.2.1/executionHistory/executionHistory.bin new file mode 100644 index 0000000..c10c85a Binary files /dev/null and b/.gradle/8.2.1/executionHistory/executionHistory.bin differ diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..4866817 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + `kotlin-dsl` +} + +repositories { + google() + mavenCentral() +} \ No newline at end of file diff --git a/src/main/java/Dependencies.kt b/src/main/java/Dependencies.kt new file mode 100644 index 0000000..fde0e53 --- /dev/null +++ b/src/main/java/Dependencies.kt @@ -0,0 +1,201 @@ +data class Dependency( + val name: String, + val version: String, +) { + val fullPath get() = "$name:$version" +} + +object Dependencies { + + /** + * Type-safe HTTP client for Android and Java by Square, Inc. + * + * [Documentation](http://square.github.io/retrofit/) + * + * [Github](https://github.com/square/retrofit) + * + * [Apache License 2.0](https://github.com/square/retrofit/blob/master/LICENSE.txt) + * + * [Changelog](https://github.com/square/retrofit/blob/master/CHANGELOG.md) + */ + object Retrofit { + private const val version = "2.9.0" + + val library = Dependency("com.squareup.retrofit2:retrofit", version) + val gsonConverter = Dependency("com.squareup.retrofit2:converter-gson", version) + } + + + /** + * [Documentation](https://developer.android.com/jetpack/androidx) + * + * [Releases](https://developer.android.com/jetpack/androidx/versions). + */ + object AndroidX { + /** + * [androidx.tech](https://androidx.tech/artifacts/appcompat/appcompat/) + * + * [Changelog](https://developer.android.com/jetpack/androidx/releases/appcompat) + */ + val appcompat = Dependency("androidx.appcompat:appcompat", "1.6.1") + + /** + * [androidx.tech](https://androidx.tech/artifacts/recyclerview/recyclerview/) + * + * [Changelog](https://developer.android.com/jetpack/androidx/releases/recyclerview) + */ + val recyclerView = Dependency("androidx.recyclerview:recyclerview", "1.3.2") + + /** + * [androidx.tech](https://androidx.tech/artifacts/cardview/cardview/) + * + * [Changelog](https://developer.android.com/jetpack/androidx/releases/cardview) + */ + val cardView = Dependency("androidx.cardview:cardview", "1.0.0") + + /** + * [androidx.tech](https://androidx.tech/artifacts/gridlayout/gridlayout/) + * + * [Changelog](https://developer.android.com/jetpack/androidx/releases/gridlayout) + */ + val gridLayout = Dependency("androidx.gridlayout:gridlayout", "1.0.0") + + /** + * A ConstraintLayout is a ViewGroup which allows you to position and size widgets in a flexible way. + * + * [Documentation](https://developer.android.com/reference/android/support/constraint/ConstraintLayout) + * + * [androidx.tech](https://androidx.tech/artifacts/constraintlayout/constraintlayout/) + * + * [Changelog](https://developer.android.com/jetpack/androidx/releases/constraintlayout) + */ + val constraintLayout = Dependency("androidx.constraintlayout:constraintlayout", "2.1.4") + + /** + * CoordinatorLayout is a super-powered FrameLayout. + * CoordinatorLayout is intended for two primary use cases: + * 1. As a top-level application decor or chrome layout + * 2. As a container for a specific interaction with one or more child views + * + * [Documentation](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout) + * + * [androidx.tech](https://androidx.tech/artifacts/coordinatorlayout/coordinatorlayout/) + * + * [Changelog](https://developer.android.com/jetpack/androidx/releases/coordinatorlayout) + */ + val coordinatorLayout = Dependency("androidx.coordinatorlayout:coordinatorlayout", "1.2.0") + + /** + * The SwipeRefreshLayout should be used whenever the user + * can refresh the contents of a view via a vertical swipe gesture. + * + * [Documentation](https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout) + * + * [Changelog](https://developer.android.com/jetpack/androidx/releases/swiperefreshlayout) + */ + val swipeRefreshLayout = Dependency("androidx.swiperefreshlayout:swiperefreshlayout", "1.1.0") + + /** + * [Changelog](https://developer.android.com/jetpack/androidx/releases/test/) + */ + object Testing { + + /** + * [androidx.tech](https://androidx.tech/artifacts/test/core/) + * + * [Documentation](https://developer.android.com/training/testing) + */ + val core = Dependency("androidx.test:core", "1.5.0") + + /** + * [androidx.tech](https://androidx.tech/artifacts/test.espresso/espresso-core/) + * + * [Documentation](https://developer.android.com/training/testing/espresso) + */ + object Espresso { + private const val version = "3.5.1" + val core = Dependency("androidx.test.espresso:espresso-core", version) + val intents = Dependency("androidx.test.espresso:espresso-intents", version) + val contrib = Dependency("androidx.test.espresso:espresso-contrib", version) + } + + /** + * [androidx.tech](https://androidx.tech/artifacts/test/runner/) + * + * [Documentation](https://developer.android.com/training/testing/junit-runner) + */ + val runner = Dependency("androidx.test:runner", "1.5.2") + + /** + * [androidx.tech](https://androidx.tech/artifacts/test/rules/) + * + * [Documentation](https://developer.android.com/training/testing/junit-rules) + */ + val rules = Dependency("androidx.test:rules", "1.5.0") + + /** + * [androidx.tech](https://androidx.tech/artifacts/test/orchestrator/) + * + * [Documentation](https://developer.android.com/training/testing/junit-runner#using-android-test-orchestrator) + */ + val orchestrator = Dependency("androidx.test:orchestrator", "1.4.2") + + /** + * [androidx.tech](https://androidx.tech/artifacts/test.uiautomator/uiautomator/) + * + * [Documentation](https://developer.android.com/training/testing/ui-automator) + */ + val uiAutomator = Dependency("androidx.test.uiautomator:uiautomator", "2.2.0") + } + + /** + * [Documentation](https://material.io/develop/android/) + * + * [Github](https://github.com/material-components/material-components-android) + * + * [Changelog](https://github.com/material-components/material-components-android/releases) + */ + val materialDesign = Dependency("com.google.android.material:material", "1.11.0") + + /** + * [androidx.tech](https://androidx.tech/artifacts/lifecycle/lifecycle-viewmodel/) + */ + object Lifecycle { + private const val version = "2.6.1" + + val viewModel = Dependency("androidx.lifecycle:lifecycle-viewmodel-ktx", version) + val common = Dependency("androidx.lifecycle:lifecycle-common", version) + } + } + + /** + * JUnit is a simple framework to write repeatable tests. + * + * [Documentation](https://junit.org/junit4/) + * + * [Github](https://github.com/junit-team/junit4) + * + * [Eclipse Public License 1.0](https://github.com/junit-team/junit4/blob/master/LICENSE-junit.txt) + * + * [Changelog](https://github.com/junit-team/junit4/wiki) + */ + val junit = Dependency("junit:junit", "4.13") + + /** + * Kaspresso is a framework for Android UI testing. Based on Espresso and UI Automator. + * + * [Documentation](https://kasperskylab.github.io/Kaspresso/) + * + * [Github](https://github.com/KasperskyLab/Kaspresso) + * + * [Apache License 2.0](https://github.com/KasperskyLab/Kaspresso/blob/master/LICENSE.txt) + * + * [Changelog](https://github.com/KasperskyLab/Kaspresso/releases) + */ + object Kaspresso { + private const val version = "1.5.3" + val core = Dependency("com.kaspersky.android-components:kaspresso", version) + val composeSupport = Dependency("com.kaspersky.android-components:kaspresso-compose-support", version) + } +} + diff --git a/src/main/java/DependencyHandlerExtensions.kt b/src/main/java/DependencyHandlerExtensions.kt new file mode 100644 index 0000000..a015586 --- /dev/null +++ b/src/main/java/DependencyHandlerExtensions.kt @@ -0,0 +1,41 @@ +import org.gradle.api.artifacts.dsl.DependencyHandler + +fun DependencyHandler.implementation(dependency: Dependency) { + add(Type.IMPLEMENTATION, dependency.fullPath) +} + +fun DependencyHandler.testImplementation(dependency: Dependency) { + add(Type.TEST_IMPLEMENTATION, dependency.fullPath) +} + +fun DependencyHandler.androidTestImplementation(dependency: Dependency) { + add(Type.ANDROID_TEST_IMPLEMENTATION, dependency.fullPath) +} + +fun DependencyHandler.api(dependency: Dependency) { + add(Type.API, dependency.fullPath) +} + +fun DependencyHandler.kapt(dependency: Dependency) { + add(Type.KAPT, dependency.fullPath) +} + +fun DependencyHandler.ksp(dependency: Dependency) { + add(Type.KSP, dependency.fullPath) +} + +fun DependencyHandler.defaultLibrary() { + api(Dependencies.AndroidX.appcompat) + api(Dependencies.AndroidX.materialDesign) + testImplementation(Dependencies.junit) + androidTestImplementation(Dependencies.Kaspresso.core) +} + +private object Type { + const val IMPLEMENTATION = "implementation" + const val TEST_IMPLEMENTATION = "testImplementation" + const val ANDROID_TEST_IMPLEMENTATION = "androidTestImplementation" + const val API = "api" + const val KAPT = "kapt" + const val KSP = "ksp" +} \ No newline at end of file diff --git a/src/main/java/Plugin.kt b/src/main/java/Plugin.kt new file mode 100644 index 0000000..819a9ec --- /dev/null +++ b/src/main/java/Plugin.kt @@ -0,0 +1,47 @@ +import org.gradle.plugin.use.PluginDependenciesSpec +import org.gradle.plugin.use.PluginDependencySpec + +val PluginDependenciesSpec.androidApplication: PluginDependencySpec + get() = id(Plugin.Id.Android.application) +val PluginDependenciesSpec.kotlinJvm: PluginDependencySpec + get() = id(Plugin.Id.Kotlin.jvm) +val PluginDependenciesSpec.kotlinParcelize: PluginDependencySpec + get() = id(Plugin.Id.Kotlin.parcelize) +val PluginDependenciesSpec.kotlinAnnotationProcessor: PluginDependencySpec + get() = id(Plugin.Id.Kotlin.annotationProcessor) +val PluginDependenciesSpec.kotlinSerialization: PluginDependencySpec + get() = id(Plugin.Id.Kotlin.serialization) + +object Plugin { + object Id { + object Android { + /** + * [Documentation](https://google.github.io/android-gradle-dsl/current/) + * [Changelog](https://developer.android.com/studio/releases/gradle-plugin) + */ + const val application = "com.android.application" + } + + object Kotlin { + /** + * Plugin published in https://plugins.gradle.org/ + */ + const val jvm = "org.jetbrains.kotlin.jvm" + + /** + * Plugin published in https://plugins.gradle.org/ + */ + const val parcelize = "kotlin-parcelize" + + /** + * Plugin published in https://plugins.gradle.org/ + */ + const val annotationProcessor = "kapt" + + /** + * Plugin published in https://plugins.gradle.org/ + */ + const val serialization = "plugin.serialization" + } + } +} \ No newline at end of file diff --git a/src/main/java/Version.kt b/src/main/java/Version.kt new file mode 100644 index 0000000..04cad49 --- /dev/null +++ b/src/main/java/Version.kt @@ -0,0 +1,42 @@ +import org.gradle.api.JavaVersion + +object Version { + + /** + * Gradle is an open-source build automation tool focused on flexibility and performance. + * + * [Documentation](https://docs.gradle.org/current/userguide/userguide.html) + * + * [Github](https://github.com/gradle/gradle) + * + * [Apache 2.0 License](https://github.com/gradle/gradle/blob/master/LICENSE) + * + * [Changelog](https://gradle.org/releases/) + */ + const val gradle = "8.2.1" + + object Kotlin { + + /** + * [Documentation](https://kotlinlang.org/) + * + * [Source Code](https://github.com/JetBrains/kotlin/) + * + * [Apache 2.0 License](https://github.com/JetBrains/kotlin/blob/master/license/LICENSE.txt) + * + * [Changelog](https://kotlinlang.org/releases.html) + */ + const val language = "1.9.10" + + val javaSource = JavaVersion.VERSION_1_8 + } + + object Android { + object Sdk { + const val min = 24 + const val compile = 34 + const val target = 34 + } + } + +} \ No newline at end of file