autonomousapps / autonomousapps/dependency-analysis-gradle-plugin
Depending on multiple feature variants of the same library reports the library as unused and breaks reason task
- Dominant language
- Kotlin
- Stars
- 2.2k
- Forks
- 158
- Avg merge
- 16h 25m
- Merged PRs (30d)
- 46
Description
**Build scan link**
https://scans.gradle.com/s/cwythadwgzmp2
**Plugin version**
3.6.1
**Gradle version**
9.4.1
**JDK version**
17
**(Optional) `reason` output for bugs relating to incorrect advice**
```plain
* What went wrong:
Execution failed for task ':reason'.
> A failure occurred while executing com.autonomousapps.tasks.ReasonTask$ExplainDependencyAdviceAction
> Could not create an instance of type com.autonomousapps.tasks.ReasonTask$ExplainDependencyAdviceAction.
> Coordinates 'net.kautler:command-framework' matches more than 1 dependency: [net.kautler:command-framework:0.6.0, net.kautler:command-framework:0.6.0]
```
**Describe the bug**
If you depend on multiple feature variants of one library, DAPG gets confused.
It reports the library as unused even though it is used, and the reason task errors out.
**To Reproduce**
Steps to reproduce the behavior:
```kotlin
dependencies {
implementation("net.kautler:command-framework:0.6.0") {
capabilities {
requireFeature("jda-support")
}
}
implementation("net.kautler:command-framework:0.6.0") {
capabilities {
requireFeature("javacord-support")
}
}
}
```
**Expected behavior**
- No wrong advice
- Reason working
Contributor guide
Research direction
Start by reproducing the issue with the supplied Gradle dependency declarations, using the linked build scan and the `reason` task output as reference. Trace how the plugin handles the two feature variants of `net.kautler:command-framework`, then verify that dependency advice no longer marks the library unused and that the `reason` task completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100