dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

`ignoreSourceSet` does not exclude `androidTest` from the report

Open OVOSKOP opened this issue 1 year ago • 1 comments

Plugin version 1.25.0

Gradle version 8.3

JDK version 17

(Optional) reason output for bugs relating to incorrect advice

./gradlew :project:reason --id com.google.android.material:material

Source: googleDebug, android_test
---------------------------------
* Uses 1 resource: StyleParentRef(styleParent=Theme_MaterialComponents_DayNight_DarkActionBar) (implies testImplementation).

Source: huaweiDebug, android_test
---------------------------------
* Uses 1 resource: StyleParentRef(styleParent=Theme_MaterialComponents_DayNight_DarkActionBar) (implies testImplementation).

Describe the bug Our project does not use androidTests. We are trying to exclude androidTest source sets from the report. In the plugin configuration in the root build.gradle.kts we are trying to use ignoreSourceSet, but it has no effect.

root build.gradle.kts

configure<com.autonomousapps.DependencyAnalysisExtension> {
    issues {
        all {
            ignoreSourceSet("androidTest")
        }
    }
}

The report still has advices for androidTest

Existing dependencies which should be modified to be as indicated:
  androidTestImplementation("androidx.appcompat:appcompat:1.3.1") (was implementation)
  androidTestImplementation("com.google.android.material:material:1.3.0") (was implementation)

We also tried excluding either android_test or googleDebug, android_test/huaweiDebug, android_test, according to the reason, but this also had no effect.

To Reproduce Steps to reproduce the behavior:

  1. ./gradlew buildHealth or gradlew :proj:projectHealth in a project with advices for androidTest.

Expected behavior Report filtered from androidTest advices.

Additional context We also tried to completely disable all androidTest tasks, but the report still contained these advices.

OVOSKOP avatar Dec 18 '23 12:12 OVOSKOP

Thanks for the report. I suspect that that feature was developed with the JVM in mind, not Android.

For now, in your gradle.properties, you should be able to add dependency.analysis.test.analysis=false and disable test analysis.

autonomousapps avatar Dec 19 '23 07:12 autonomousapps

I don't recall when this was fixed exactly, but you can now use ignoreSourceSet("androidTest") and it works as expected. There is now a regression test validating this feature.

autonomousapps avatar Apr 21 '24 18:04 autonomousapps