autonomousapps / autonomousapps/dependency-analysis-gradle-plugin
Listing filetree jars in a "bundle" does not seem to work
- Dominant language
- Kotlin
- Stars
- 2.2k
- Forks
- 158
- Avg merge
- 16h 25m
- Merged PRs (30d)
- 46
Description
**Build scan link**
https://gradle.com/s/szpiljfc2wde2
**Plugin version**
3.16.0
**Gradle version**
9.4.1
**JDK version**
OpenJDK 64-Bit Server VM Temurin-17.0.17+10 (build 17.0.17+10, mixed mode, sharing)
**(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version**
No Kotlin used
**(Optional) Android Gradle Plugin (AGP) version**
No Android used
**(Optional) `reason` output for bugs relating to incorrect advice**
This is the output from "build-health-report.txt" (not from the "reason" task):
```
Advice for :SubprojectA
Unused dependencies which should be removed:
api 'libtest.jar'
Advice for :SubprojectB
Unused dependencies which should be removed:
implementation project(':SubprojectA')
```
**Describe the bug**
I'm not sure whether this is a bug, a misconfiguration on my side or perhaps even a feature request.
I have a multi-project build. Some of the projects "bundle" jar files with generated code and include these with "filetree" dependencies. When I refer to these classes from other projects, I want to refer to the bundeling project, not to the individual jars. It seemed to me that "structure" "bundle" could get me where I want, but it does not seem to work. A specific example with an artifical test project: In the test project, "SubprojectB" references "SubprojectA" and uses a dependency that "SubprojectA" includes from a jar ("SubprojectA/libs/libtest.jar") and declares as api. I bundle the project and jar as follows in the root build.gradle:
```
dependencyAnalysis {
issues {
all {
onAny {
severity('fail')
}
}
}
structure {
bundle('ProjectAWithLibs') {
includeDependency(':SubprojectA')
includeDependency('libtest.jar')
}
}
}
```
but still get the advice listed above. Also, I have no clue from the output whether "bundle" worked at all.
**To Reproduce**
Steps to reproduce the behavior:
1. Run ".\gradlew buildHealth" with my test project
**Expected behavior**
The project and the jar files are treated as one bundle, so that the test project should be OK (no advice).
**Additional context**
You can find the test project in the attached [dependencyAnalysisTest.zip](https://github.com/user-attachments/files/29701340/dependencyAnalysisTest.zip)
If there are other ways to solve the problem without "bundle", they would also be fine (or perhaps even better, as the list of jars is dynamic in reality).
Perhaps this is just a misconfiguration on my side, but the documentation for "bundle" did not help me much and I found no nice way to debug it.
Contributor guide
Research direction
Start with the attached dependencyAnalysisTest.zip and the root build.gradle structure.bundle configuration, then run .\gradlew buildHealth and inspect build-health-report.txt. Compare the bundle configuration with the advice for SubprojectA and SubprojectB; done means the bundled project and jar produce no incorrect dependency advice or the configuration failure is clearly reported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy, java
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100