diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 88a15211..e5d0c5d2 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 e56d400b..509cc96d 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 00000000..80a352a5 --- /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 26ca74e0..2d953d65 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"