diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2023-05-19 21:11:21 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2023-05-20 23:50:39 +0530 |
commit | 6b8ca1601d0668125071839d9f10912d765460ad (patch) | |
tree | 468e05827ec4b9e094158a45902eb33494479299 /build-logic | |
parent | e96f8165016a4279a9bb0323538004e4bbeaeb02 (diff) |
feat(build): move to AGP 8.2.x
Diffstat (limited to 'build-logic')
-rw-r--r-- | build-logic/src/main/kotlin/app/passwordstore/gradle/flavors/SlimTests.kt | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/build-logic/src/main/kotlin/app/passwordstore/gradle/flavors/SlimTests.kt b/build-logic/src/main/kotlin/app/passwordstore/gradle/flavors/SlimTests.kt index 8755a872..5fd681f3 100644 --- a/build-logic/src/main/kotlin/app/passwordstore/gradle/flavors/SlimTests.kt +++ b/build-logic/src/main/kotlin/app/passwordstore/gradle/flavors/SlimTests.kt @@ -6,10 +6,10 @@ package app.passwordstore.gradle.flavors import com.android.build.api.variant.ApplicationAndroidComponentsExtension +import com.android.build.api.variant.HasUnitTestBuilder import com.android.build.api.variant.LibraryAndroidComponentsExtension import org.gradle.api.Project 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 @@ -21,20 +21,22 @@ import org.gradle.language.nativeplatform.internal.BuildType */ internal fun Project.configureSlimTests() { 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 { - beforeVariants(selector().withBuildType(BuildType.RELEASE.name)) { - it.enableUnitTest = false + beforeVariants(selector().withBuildType(BUILD_TYPE_RELEASE)) { + (it as HasUnitTestBuilder).enableUnitTest = 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. 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)) { - it.enableUnitTest = false + (it as HasUnitTestBuilder).enableUnitTest = false it.enableAndroidTest = false } } @@ -42,3 +44,4 @@ internal fun Project.configureSlimTests() { } private const val SLIM_TESTS_PROPERTY = "slimTests" +private const val BUILD_TYPE_RELEASE = "release" |