fix: remove slimTests property and make it default

This commit is contained in:
Harsh Shandilya 2023-02-19 11:22:47 +05:30
parent 3da0674031
commit 95fd166a98
No known key found for this signature in database
2 changed files with 13 additions and 25 deletions

View file

@ -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' }}

View file

@ -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<Project> {
private companion object {
@ -74,16 +72,7 @@ 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<LibraryAndroidComponentsExtension>()?.run {
beforeVariants(selector().withBuildType("release")) {
@ -100,4 +89,3 @@ private fun Project.configureSlimTests() {
}
}
}
}