feat(build): move to AGP 8.2.x

This commit is contained in:
Harsh Shandilya 2023-05-19 21:11:21 +05:30
parent e96f816501
commit 6b8ca1601d
No known key found for this signature in database
3 changed files with 13 additions and 11 deletions

View file

@ -6,10 +6,10 @@
package app.passwordstore.gradle.flavors package app.passwordstore.gradle.flavors
import com.android.build.api.variant.ApplicationAndroidComponentsExtension import com.android.build.api.variant.ApplicationAndroidComponentsExtension
import com.android.build.api.variant.HasUnitTestBuilder
import com.android.build.api.variant.LibraryAndroidComponentsExtension import com.android.build.api.variant.LibraryAndroidComponentsExtension
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.findByType
import org.gradle.language.nativeplatform.internal.BuildType
/** /**
* When the "slimTests" project property is provided, disable the unit test tasks on `release` build * When the "slimTests" project property is provided, disable the unit test tasks on `release` build
@ -21,20 +21,22 @@ import org.gradle.language.nativeplatform.internal.BuildType
*/ */
internal fun Project.configureSlimTests() { internal fun Project.configureSlimTests() {
if (providers.gradleProperty(SLIM_TESTS_PROPERTY).isPresent) { if (providers.gradleProperty(SLIM_TESTS_PROPERTY).isPresent) {
// disable unit test tasks on the release build type for Android Library projects // Disable unit test tasks on the release build type for Android Library projects
extensions.findByType<LibraryAndroidComponentsExtension>()?.run { extensions.findByType<LibraryAndroidComponentsExtension>()?.run {
beforeVariants(selector().withBuildType(BuildType.RELEASE.name)) { beforeVariants(selector().withBuildType(BUILD_TYPE_RELEASE)) {
it.enableUnitTest = false (it as HasUnitTestBuilder).enableUnitTest = false
it.enableAndroidTest = false it.enableAndroidTest = false
} }
} }
// disable unit test tasks on the release build type and free flavor for Android Application // Disable unit test tasks on the release build type and free flavor for Android Application
// projects. // projects.
extensions.findByType<ApplicationAndroidComponentsExtension>()?.run { extensions.findByType<ApplicationAndroidComponentsExtension>()?.run {
beforeVariants(selector().withBuildType(BuildType.RELEASE.name)) { it.enableUnitTest = false } beforeVariants(selector().withBuildType(BUILD_TYPE_RELEASE)) {
(it as HasUnitTestBuilder).enableUnitTest = false
}
beforeVariants(selector().withFlavor(FlavorDimensions.FREE to ProductFlavors.NON_FREE)) { beforeVariants(selector().withFlavor(FlavorDimensions.FREE to ProductFlavors.NON_FREE)) {
it.enableUnitTest = false (it as HasUnitTestBuilder).enableUnitTest = false
it.enableAndroidTest = false it.enableAndroidTest = false
} }
} }
@ -42,3 +44,4 @@ internal fun Project.configureSlimTests() {
} }
private const val SLIM_TESTS_PROPERTY = "slimTests" private const val SLIM_TESTS_PROPERTY = "slimTests"
private const val BUILD_TYPE_RELEASE = "release"

View file

@ -32,8 +32,7 @@ kotlin.compiler.preciseCompilationResultsBackup=true
kotlin.build.report.output=file kotlin.build.report.output=file
# Use R8 instead of ProGuard for code shrinking. # Use R8 instead of ProGuard for code shrinking.
# TODO: Re-enable after diagnosing JGit VerifyError android.enableR8.fullMode=true
android.enableR8.fullMode=false
# Enable AndroidX # Enable AndroidX
android.useAndroidX=true android.useAndroidX=true

View file

@ -1,5 +1,5 @@
[versions] [versions]
agp = "8.0.1" agp = "8.2.0-alpha04"
androidxActivity = "1.7.1" androidxActivity = "1.7.1"
bouncycastle = "1.73" bouncycastle = "1.73"
# @keep used for kotlinCompilerExtensionVersion # @keep used for kotlinCompilerExtensionVersion
@ -45,7 +45,7 @@ build-metalava = "me.tylerbwong.gradle.metalava:plugin:0.3.3"
build-moshi = "com.squareup.moshi:moshi:1.15.0" build-moshi = "com.squareup.moshi:moshi:1.15.0"
build-moshi-kotlin = "com.squareup.moshi:moshi-kotlin:1.15.0" build-moshi-kotlin = "com.squareup.moshi:moshi-kotlin:1.15.0"
build-okhttp = "com.squareup.okhttp3:okhttp:4.11.0" build-okhttp = "com.squareup.okhttp3:okhttp:4.11.0"
build-r8 = "com.android.tools:r8:8.0.40" build-r8 = "com.android.tools:r8:8.2.7-dev"
build-semver = "com.vdurmont:semver4j:3.1.0" build-semver = "com.vdurmont:semver4j:3.1.0"
build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:3.7.0" build-sentry = "io.sentry.android.gradle:io.sentry.android.gradle.gradle.plugin:3.7.0"
build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.8.0" build-vcu = "nl.littlerobots.version-catalog-update:nl.littlerobots.version-catalog-update.gradle.plugin:0.8.0"