From 37b80d5d1930d9847573520ba335b1af6bbb0eee Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Thu, 19 May 2022 12:53:59 +0530 Subject: [PATCH] Upgrade to AGP 7.2.0 (#1920) --- app/build.gradle.kts | 10 +--------- ...droid-password-store.android-application.gradle.kts | 6 ++++++ .../src/main/kotlin/snapshot/SnapshotExtension.kt | 10 ++++++++++ gradle/libs.versions.toml | 3 +-- 4 files changed, 18 insertions(+), 11 deletions(-) create mode 100644 build-logic/android-plugins/src/main/kotlin/snapshot/SnapshotExtension.kt diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 88a152116..e5d0c5d2f 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -20,14 +20,6 @@ crowdin { skipCleanup = false } -fun isSnapshot(): Boolean { - with(project.providers) { - val workflow = environmentVariable("GITHUB_WORKFLOW") - val snapshot = environmentVariable("SNAPSHOT") - return workflow.isPresent || snapshot.isPresent - } -} - android { compileOptions { isCoreLibraryDesugaringEnabled = true } @@ -96,7 +88,7 @@ dependencies { implementation(libs.thirdparty.sshauth) implementation(libs.thirdparty.sshj) - if (isSnapshot()) { + if (snapshot.snapshot) { implementation(libs.thirdparty.whatthestack) } else { debugImplementation(libs.thirdparty.whatthestack) diff --git a/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts b/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts index e56d400b2..509cc96d0 100644 --- a/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts +++ b/build-logic/android-plugins/src/main/kotlin/com.github.android-password-store.android-application.gradle.kts @@ -7,6 +7,7 @@ import flavors.FlavorDimensions import flavors.ProductFlavors import signing.configureBuildSigning +import snapshot.SnapshotExtension plugins { id("com.android.application") @@ -64,3 +65,8 @@ android { project.configureBuildSigning() } + +dependencies { + extensions.add("snapshot", SnapshotExtension::class.java) + the().snapshot = isSnapshot() +} diff --git a/build-logic/android-plugins/src/main/kotlin/snapshot/SnapshotExtension.kt b/build-logic/android-plugins/src/main/kotlin/snapshot/SnapshotExtension.kt new file mode 100644 index 000000000..80a352a5d --- /dev/null +++ b/build-logic/android-plugins/src/main/kotlin/snapshot/SnapshotExtension.kt @@ -0,0 +1,10 @@ +/* + * Copyright © 2014-2021 The Android Password Store Authors. All Rights Reserved. + * SPDX-License-Identifier: GPL-3.0-only + */ + +package snapshot + +abstract class SnapshotExtension { + abstract var snapshot: Boolean +} diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 26ca74e07..2d953d65c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,13 +39,12 @@ androidx-swiperefreshlayout = "androidx.swiperefreshlayout:swiperefreshlayout:1. aps-sublimeFuzzy = "com.github.android-password-store:sublime-fuzzy:2.1.0" aps-zxingAndroidEmbedded = "com.github.android-password-store:zxing-android-embedded:4.2.1" -build-agp = "com.android.tools.build:gradle:7.1.3" +build-agp = "com.android.tools.build:gradle:7.2.0" build-binarycompat = "org.jetbrains.kotlinx:binary-compatibility-validator:0.10.0" build-download = "de.undercouch:gradle-download-task:5.1.0" build-kotlin = "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21" build-mavenpublish = "com.vanniktech:gradle-maven-publish-plugin:0.19.0" build-okhttp = "com.squareup.okhttp3:okhttp:4.9.3" -build-r8 = "com.android.tools:r8:3.3.28" build-semver = "com.vdurmont:semver4j:3.1.0" build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:3.0.1" build-spotless = "com.diffplug.spotless:spotless-plugin-gradle:6.6.1"