From 373a46f73a51bda3900b895f72fba5ca619e5884 Mon Sep 17 00:00:00 2001 From: Aditya Wasan Date: Tue, 25 May 2021 15:15:26 +0530 Subject: Add compose dependencies (#1421) Co-authored-by: Harsh Shandilya --- app/build.gradle.kts | 33 +++++++++++++++++++++++++++++++++ build.gradle.kts | 2 -- buildSrc/build.gradle.kts | 3 +-- gradle/libs.versions.toml | 29 ++++++++++++++++++++++++----- 4 files changed, 58 insertions(+), 9 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b0ee9972..ca591aef 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,6 +14,22 @@ plugins { `crowdin-plugin` } +repositories { + val composeSnapshot = libs.versions.composeSnapshot.get() + if (composeSnapshot.isNotEmpty()) { + maven("https://androidx.dev/snapshots/builds/$composeSnapshot/artifacts/repository/") { + content { + includeGroup("androidx.compose.animation") + includeGroup("androidx.compose.compiler") + includeGroup("androidx.compose.foundation") + includeGroup("androidx.compose.material") + includeGroup("androidx.compose.runtime") + includeGroup("androidx.compose.ui") + } + } + } +} + configure { projectName = "android-password-store" } android { @@ -31,12 +47,15 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } + buildFeatures.compose = true + lintOptions { isAbortOnError = true isCheckReleaseBuilds = false disable("MissingTranslation", "PluralsCandidate", "ImpliedQuantity") // https://issuetracker.google.com/issues/187524311 disable("DialogFragmentCallbacksDetector") + disable("CoroutineCreationDuringComposition") } flavorDimensions("free") @@ -45,6 +64,11 @@ android { create("nonFree") {} } testOptions { unitTests.isReturnDefaultValues = true } + + composeOptions { + kotlinCompilerVersion = libs.versions.kotlin.get() + kotlinCompilerExtensionVersion = libs.versions.compose.get() + } } dependencies { @@ -74,6 +98,15 @@ dependencies { implementation(libs.kotlin.coroutines.android) implementation(libs.kotlin.coroutines.core) + implementation(libs.androidx.activity.compose) + implementation(libs.androidx.hilt.compose) + implementation(libs.compose.foundation.core) + implementation(libs.compose.foundation.layout) + implementation(libs.compose.material) + implementation(libs.compose.ui.core) + implementation(libs.compose.ui.viewbinding) + compileOnly(libs.compose.ui.tooling) + implementation(libs.aps.sublimeFuzzy) implementation(libs.aps.zxingAndroidEmbedded) diff --git a/build.gradle.kts b/build.gradle.kts index 570f5ffb..3365e7b0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,8 +5,6 @@ plugins { `binary-compatibility-validator` `aps-plugin` - // Fix for leak in Kotlin Gradle Plugin: https://youtrack.jetbrains.com/issue/KT-46368 - id("dev.zacsweers.kgp-150-leak-patcher") version "1.1.0" } allprojects { apply(plugin = "com.diffplug.spotless") } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index dcdc6ec1..e76bcc15 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -46,10 +46,9 @@ dependencies { implementation("com.google.dagger:hilt-android-gradle-plugin:2.35.1") implementation("com.squareup.okhttp3:okhttp:4.9.0") implementation("com.vanniktech:gradle-maven-publish-plugin:0.15.1") - implementation("com.squareup.okhttp3:okhttp:4.9.0") implementation("com.vdurmont:semver4j:3.1.0") implementation("de.undercouch:gradle-download-task:4.1.1") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32") - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0") + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10") implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.5.0") } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 05eb54db..f3faa03a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,11 @@ # Centralized versions for dependencies that share versions [versions] androidx_test = "1.4.0-beta01" +compose = "1.0.0-SNAPSHOT" +composeSnapshot = "7395546" coroutines = "1.5.0" hilt = "2.35.1" -kotlin = "1.5.0" +kotlin = "1.5.10" lifecycle = "2.4.0-alpha01" [libraries] @@ -25,6 +27,7 @@ kotlin-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-co # AndroidX dependencies androidx-activityKtx = "androidx.activity:activity-ktx:1.3.0-alpha08" +androidx-activity-compose = "androidx.activity:activity-compose:1.3.0-alpha08" androidx-annotation = "androidx.annotation:annotation:1.2.0" androidx-autofill = "androidx.autofill:autofill:1.2.0-alpha01" androidx-appcompat = "androidx.appcompat:appcompat:1.3.0" @@ -33,9 +36,11 @@ androidx-constraintlayout = "androidx.constraintlayout:constraintlayout:2.1.0-be androidx-coreKtx = "androidx.core:core-ktx:1.6.0-beta01" androidx-documentfile = "androidx.documentfile:documentfile:1.0.1" androidx-fragmentKtx = "androidx.fragment:fragment-ktx:1.4.0-alpha01" -androidx-lifecycle_common = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref="lifecycle" } -androidx-lifecycle_livedataKtx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref="lifecycle" } -androidx-lifecycle_viewmodelKtx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref="lifecycle" } +androidx-hilt-compose = "androidx.hilt:hilt-navigation-compose:1.0.0-alpha02" +androidx-lifecycle-common = { module = "androidx.lifecycle:lifecycle-common-java8", version.ref="lifecycle" } +androidx-lifecycle-livedataKtx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref="lifecycle" } +androidx-lifecycle-viewmodelKtx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref="lifecycle" } +androidx-lifecycle-viewmodel-compose = "androidx.lifecycle:lifecycle-viewmodel-compose:1.0.0-alpha05" androidx-material = "com.google.android.material:material:1.4.0-beta01" androidx-preference = "androidx.preference:preference:1.1.1" androidx-recyclerview = "androidx.recyclerview:recyclerview:1.2.0" @@ -43,6 +48,20 @@ androidx-recyclerviewSelection = "androidx.recyclerview:recyclerview-selection:1 androidx-security = "androidx.security:security-crypto:1.1.0-alpha03" androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01" +# Compose dependencies +compose-animation = { module = "androidx.compose.animation:animation", version.ref = "compose" } +compose-compiler = { module = "androidx.compose.compiler:compiler", version.ref = "compose" } +compose-foundation-core = { module = "androidx.compose.foundation:foundation", version.ref = "compose" } +compose-foundation-layout = { module = "androidx.compose.foundation:foundation-layout", version.ref = "compose" } +compose-material = { module = "androidx.compose.material:material", version.ref = "compose" } +compose-runtime = { module = "androidx.compose.runtime:runtime", version.ref = "compose" } +compose-ui-core = { module = "androidx.compose.ui:ui", version.ref = "compose" } +compose-ui-test = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "compose" } +compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" } +compose-ui-util = { module = "androidx.compose.ui:ui-util", version.ref = "compose" } +compose-ui-viewbinding = { module = "androidx.compose.ui:ui-viewbinding", version.ref = "compose" } + + # Dagger/Hilt dependencies dagger-hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } @@ -83,6 +102,6 @@ kotlin-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-te # Bundles of dependencies usually used together so they can be included in one go [bundles] -androidxLifecycle = ["androidx-lifecycle_common", "androidx-lifecycle_livedataKtx", "androidx-lifecycle_viewmodelKtx"] +androidxLifecycle = ["androidx-lifecycle-common", "androidx-lifecycle-livedataKtx", "androidx-lifecycle-viewmodelKtx"] testDependencies = ["testing-junit", "testing-kotlintest-junit"] androidTestDependencies = ["androidx-testing-rules", "androidx-testing-runner"] -- cgit v1.2.3