autonomousapps / autonomousapps/dependency-analysis-gradle-plugin

Advice to configure dependency only for specific variant

Open
#1,625 2 comments 0 reactions 0 assignees View on GitHub
bug more information needed
Dominant language
Kotlin
Stars
2.2k
Forks
158
Avg merge
16h 25m
Merged PRs (30d)
46

Description

**Plugin version**
3.5.1

**Gradle version**
9.2.1

**JDK version**
21

**(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version**
2.2.21

**(Optional) Android Gradle Plugin (AGP) version**
8.13.1

**(Optional) `reason` output for bugs relating to incorrect advice**
```
./gradlew :core:track:reason --id :external:SomeTracker
Parallel Configuration Cache is an incubating feature.
Calculating task graph as no cached configuration is available for tasks: :core:track:reason --id :external:SomeTracker

> Configure project :app
WARNING: The option setting 'android.enableBuildConfigAsBytecode=true' is experimental.
The current default is 'false'.

> Task :core:tracking:reason

------------------------------------------------------------
You asked about the dependency ':external:SomeTracker'.
You have been advised to change this dependency to 'variantADebugImplementation' from 'variantAImplementation'.
------------------------------------------------------------

There is no path from :core:tracking to :external:SomeTracker for variantBDebugCompileClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBDebugRuntimeClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBDebugUnitTestCompileClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBDebugUnitTestRuntimeClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBDebugAndroidTestCompileClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBDebugAndroidTestRuntimeClasspath

Shortest path from :core:tracking to :external:AomeTracker for variantADebugCompileClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantADebugRuntimeClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantADebugUnitTestCompileClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantADebugUnitTestRuntimeClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantADebugAndroidTestCompileClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantADebugAndroidTestRuntimeClasspath:
:core:tracking
\--- :external:SomeTracker

There is no path from :core:tracking to :external:SomeTracker for variantBReleaseCompileClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBReleaseRuntimeClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBReleaseUnitTestCompileClasspath

There is no path from :core:tracking to :external:SomeTracker for variantBReleaseUnitTestRuntimeClasspath

Shortest path from :core:tracking to :external:SomeTracker for variantAReleaseCompileClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantAReleaseRuntimeClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantAReleaseUnitTestCompileClasspath:
:core:tracking
\--- :external:SomeTracker

Shortest path from :core:tracking to :external:SomeTracker for variantAReleaseUnitTestRuntimeClasspath:
:core:tracking
\--- :external:SomeTracker

Source: variantBDebug, android_test
-----------------------------
(no usages)

Source: variantBDebug, main
---------------------
(no usages)

Source: variantBDebug, test
---------------------
(no usages)

Source: variantBRelease, main
-----------------------
(no usages)

Source: variantBRelease, test
-----------------------
(no usages)

Source: variantADebug, android_test
------------------------------
(no usages)

Source: variantADebug, main
----------------------
* Uses 5 classes: (implies implementation).
* Uses 1 constant: URL (implies implementation).

Source: variantADebug, test
----------------------
(no usages)

Source: variantARelease, main
------------------------
* Uses 5 classes: (implies implementation).
* Uses 1 constant: URL (implies implementation).

Source: variantARelease, test
------------------------
(no usages)
```

**Describe the bug**
Suggests to limit to debug variantA while it is uses in both build types

**Expected behavior**
Don't suggest

**Additional information**
The module `:external:SomeTracker` is just binary sdk:

```
build.gradle
SomeTrackerSDK_x.x.x.aar
```

And `build.gradle` is:

```
configurations.maybeCreate("default")
artifacts.add("default", file('SomeTrackerSDK_x.x.x.aar'))
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with the `:core:track:reason --id :external:SomeTracker` task and the `:core:tracking` and `:external:SomeTracker` modules. Inspect the variant-specific dependency advice and the binary SDK setup in `build.gradle`, especially the `variantA` and `variantB` build types. Done means the advice no longer suggests limiting the dependency to `variantADebugImplementation` when it is used by both `variantA` build types.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.