Expose usage report as part of dependency analysis
#1,637 opened on Feb 6, 2026
Repository metrics
- Stars
- (2,172 stars)
- PR merge metrics
- (PR metrics pending)
Description
Is your feature request related to a problem? Please describe.
I would like to be able to get a report around dependency usages per Gradle module and a summary for the whole project. These reports would
- Provide a signal around module complexity
- Capture most frequently used APIs
- Enable a way to track migrations such as RxJava -> Coroutines
I'm including an example report that I generated using intermediary types already generated by this plugin
{
"module": ":instacart-flyers:public",
"summary": {
"dependencyTypes": 6,
"dependencyTypeUsages": 10,
"internalTypes": 4,
"projectDependencies": 2,
"libraryDependencies": 3
},
"internal": {
"com.instacart.client.flyers.eligibility.ICFlyersBadgeFormula$DefaultImpls": 1,
"com.instacart.client.flyers.eligibility.ICFlyersBadgeState$Companion": 1,
"com.instacart.client.flyers.eligibility.ICFlyersBadgeFormula": 1,
"com.instacart.client.flyers.eligibility.ICFlyersBadgeState": 1
},
"projectDependencies": {
":instacart-analytics:public": {
"com.instacart.analytics.latency.ICPageKey": 3
},
":instacart-global-home-tabs:public": {
"com.instacart.client.ui.pages.ICTabFeature": 2
}
},
"libraryDependencies": {
"com.instacart.formula:formula": {
"com.instacart.formula.IFormula": 2,
"com.instacart.formula.IFormula$DefaultImpls": 1
},
"com.instacart.formula:formula-android": {
"com.instacart.formula.android.RouteKey": 1
},
"io.reactivex.rxjava3:rxjava": {
"io.reactivex.rxjava3.core.Observable": 1
}
}
}
Describe the solution you'd like
This plugin is already doing deep usage analysis to be able to determine if a dependency is used or not. The ideal solution would provide first-class APIs to get access to this usage data. There are a couple of options here:
- Generate a first-class usage report similar
advise.json - Provide an extension API that provides direct access to the data models. The user can generate any kind of report using the data.
Regarding the implementation:
- To generate report, we need access to
ProjectVariantandDependenciestypes to generate the r - There already exists
ComputeUsagesTaskthat has access to both. It generatesdependency-trace-report.json.- The report provides a
"reason": "Uses 3 classes: okhttp3.Call, okhttp3.OkHttpClient, okhttp3.Request" - The task has access to data we need, but the generated report is not sufficient
- The report provides a
Options
- Update
ComputeUsagesTaskto generate a more artifacts - Update
dependency-trace-report.jsonwith more information - Create a separate, similar task to
ComputeUsagesTask
Recommendation
The simplest solution would be for ComputeUsagesTask to generate a separate, more detailed report around usages.
- The naming already implies this purpose.
- It has the necessary data dependencies.
- Single-pass to compute both reports would be more efficient.
- Modifying
dependency-trace-report.jsonwould potentially affect downstream tasks. I'm not sure combining different purposes into a single report is the right approach.