Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused testImplementation dependencies are not reported #366

Closed
Dim0N22 opened this issue Feb 11, 2021 · 5 comments · Fixed by #418
Closed

Unused testImplementation dependencies are not reported #366

Dim0N22 opened this issue Feb 11, 2021 · 5 comments · Fixed by #418
Labels
bug Something isn't working question Further information is requested
Milestone

Comments

@Dim0N22
Copy link

Dim0N22 commented Feb 11, 2021

Is your feature request related to a problem? Please describe.
I'm trying to remove unused dependencies in my project. Particularly I have unused testImplementation dependencies that are not reported by the plugin.

Describe the solution you'd like
testImplementation dependencies should be reported as unused if they are not needed in tests.

Additional context
I've created a repro: https://github.com/Dim0N22/dependency-analysis-android-gradle-plugin-testImplementation-bug-repro.

Steps to reproduce:

git clone https://github.com/Dim0N22/dependency-analysis-android-gradle-plugin-testImplementation-bug-repro.git
chmod +x ./gradlew
./gradlew buildHealth

Output

❯ ./gradlew buildHealth

> Task :buildHealth
Advice for root project
Looking good! No changes needed

Advice for project :lib
Unused dependencies which should be removed:
- implementation("com.google.guava:guava:29.0-jre")
- api("org.apache.commons:commons-math3:3.6.1")

Expected output
Since the library build script contains an unused testImplementation dependency on org.robolectric:robolectric:3.8, it should be reported by ./gradlew buildHealth.

@autonomousapps
Copy link
Owner

Thanks for the reproducer! That will make it a lot easier to dig into. I wonder if Robolectric is only used at runtime.... I wonder what would happen if you used the Reason feature?

./gradlew lib:reason --id org.robolectric:robolectric

that feature is a work in progress and so may or may not be useful in this situation.

@autonomousapps autonomousapps added bug Something isn't working question Further information is requested labels Apr 18, 2021
@autonomousapps autonomousapps added this to the 1.0 milestone May 19, 2021
@autonomousapps
Copy link
Owner

I've reproduced this and understand the reason. A fix will be forthcoming.

@autonomousapps
Copy link
Owner

This will be released as 0.74.0.

@eugene-krivobokov
Copy link
Contributor

I see new issues about this new behavior: #423, #425, #424.
They force to add many ignores a multi-module project or disable the check.

How about adding an experimental feature toggle for new behavior?

@autonomousapps
Copy link
Owner

This plugin is in a prerelease state, as indicated by the leading zero. As such, it does not support experimental toggles.

That said, I already have a fix for one of those issues, and a WIP for another.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants