autonomousapps / autonomousapps/dependency-analysis-gradle-plugin

Do not ignore advice for `gradleApi()` dependency

Open
#1,624 1 comment 0 reactions 0 assignees View on GitHub
bug toolchain:java
Dominant language
Kotlin
Stars
2.2k
Forks
158
Avg merge
16h 25m
Merged PRs (30d)
46

Description

**Is your feature request related to a problem? Please describe.**
In the rare case where you have a project that has both a `gradleApi()` dependency (either explicitly or from `java-gradle-plugin`) and also depends on `org.gradle:gradle-tooling-api` ([example](https://github.com/block/artifact-swap/commit/20018736deed92ca0e0d3e7fcaeb2e08118ed0c9), running `./gradlew :gradle-plugin:reason --id libs.gradle.tooling.api` informs me that I am using classes from the tooling API:

```
Source: main
------------
* Uses 2 classes: org.gradle.api.Action, org.gradle.api.GradleException (implies implementation).
```

In fact, I was not actually needing the tooling-api dependency any longer, and those classes are provided by `gradleApi()` as well. DAGP should complain about that too if multiple dependencies provide duplicate classes, but it did not.

This is obviously a very weird scenario, but I arrived here because `gradleApi()` is ignored and DAGP picked up my use of gradle-tooling-api in a sibling project and added that transitive to a plugin project.

**Describe the solution you'd like**
Stop excluding `gradleApi()` from analysis.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the dependency-analysis path that excludes gradleApi() from advice, using the reported :gradle-plugin:reason --id libs.gradle.tooling.api invocation and the linked artifact-swap example as a reproduction. Done means gradleApi() is included in duplicate-class analysis and the tooling API dependency receives advice when both provide the same classes.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
build-system, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.