dependency-analysis-gradle-plugin
dependency-analysis-gradle-plugin copied to clipboard
`ignoreSourceSet` does not exclude `androidTest` from the report
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:
./gradlew buildHealthorgradlew :proj:projectHealthin a project with advices forandroidTest.
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.
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.
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.