From 95fd166a98268955a178cbae7f0ced58d983dbe6 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sun, 19 Feb 2023 11:22:47 +0530 Subject: [PATCH] fix: remove slimTests property and make it default --- .github/workflows/ci.yml | 2 +- .../claw/gradle/AndroidCommonPlugin.kt | 36 +++++++------------ 2 files changed, 13 insertions(+), 25 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a38966de..539cbe8f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: - name: Run unit tests uses: gradle/gradle-build-action@6095a76664413da4c8c134ee32e8a8ae900f0f1f # v2.4.0 with: - arguments: --no-configuration-cache --stacktrace check -PslimTests + arguments: --no-configuration-cache --stacktrace check gradle-home-cache-cleanup: true cache-read-only: ${{ github.ref != 'refs/heads/main' }} diff --git a/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/AndroidCommonPlugin.kt b/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/AndroidCommonPlugin.kt index 39727af0..f33c1c24 100644 --- a/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/AndroidCommonPlugin.kt +++ b/build-logic/src/main/kotlin/dev/msfjarvis/claw/gradle/AndroidCommonPlugin.kt @@ -1,5 +1,5 @@ /* - * Copyright © 2022 Harsh Shandilya. + * Copyright © 2022-2023 Harsh Shandilya. * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. @@ -22,8 +22,6 @@ import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.findByType -private const val SLIM_TESTS_PROPERTY = "slimTests" - class AndroidCommonPlugin : Plugin { private companion object { @@ -74,30 +72,20 @@ private fun Lint.configureLint(project: Project) { baseline = project.file("lint-baseline.xml") } -/** - * When the "slimTests" project property is provided, disable the unit test tasks on `release` build - * type and `nonFree` product flavor to avoid running the same tests repeatedly in different build - * variants. - * - * Examples: `./gradlew test -PslimTests` will run unit tests for `nonFreeDebug` and `debug` build - * variants in Android App and Library projects, and all tests in JVM projects. - */ private fun Project.configureSlimTests() { - if (providers.gradleProperty(SLIM_TESTS_PROPERTY).isPresent) { - // Disable unit test tasks on the release build type for Android Library projects - extensions.findByType()?.run { - beforeVariants(selector().withBuildType("release")) { - it.enableUnitTest = false - it.enableAndroidTest = false - } + // Disable unit test tasks on the release build type for Android Library projects + extensions.findByType()?.run { + beforeVariants(selector().withBuildType("release")) { + it.enableUnitTest = false + it.enableAndroidTest = false } + } - // Disable unit test tasks on the release build type for Android Application projects. - extensions.findByType()?.run { - beforeVariants(selector().withBuildType("release")) { - it.enableUnitTest = false - it.enableAndroidTest = false - } + // Disable unit test tasks on the release build type for Android Application projects. + extensions.findByType()?.run { + beforeVariants(selector().withBuildType("release")) { + it.enableUnitTest = false + it.enableAndroidTest = false } } }