Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.66k
stars
116
forks
source link
Adviced to add transitive which is exposed as Kotlin default value in used lib function #1196
1.32.0, also tried debugging using the main branch
Gradle version
8.7
JDK version
Temurin-17
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
kotlin-gradle-plugin:2.0.0 using 1.9.24 gives the same result
(Optional) Android Gradle Plugin (AGP) version
(Optional) reason output for bugs relating to incorrect advice
Output
```
----------------------------------------
You asked about the dependency 'com.github.ajalt.mordant:mordant:2.5.0'.
You have been advised to add this dependency to 'testImplementation'. It matched a bundle rule: com.github.ajalt.mordant:mordant:2.5.0 was substituted for com.github.ajalt.mordant:mordant-jvm:2.5.0.
----------------------------------------
Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for compileClasspath:
:renovate-notifier
\--- com.github.ajalt.clikt:clikt:4.4.0
\--- com.github.ajalt.clikt:clikt-jvm:4.4.0
\--- com.github.ajalt.mordant:mordant:2.5.0
Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for runtimeClasspath:
:renovate-notifier
\--- com.github.ajalt.clikt:clikt:4.4.0
\--- com.github.ajalt.clikt:clikt-jvm:4.4.0
\--- com.github.ajalt.mordant:mordant:2.5.0
Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for testCompileClasspath:
:renovate-notifier
\--- com.github.ajalt.clikt:clikt:4.4.0
\--- com.github.ajalt.clikt:clikt-jvm:4.4.0
\--- com.github.ajalt.mordant:mordant:2.5.0
Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for testRuntimeClasspath:
:renovate-notifier
\--- com.github.ajalt.clikt:clikt:4.4.0
\--- com.github.ajalt.clikt:clikt-jvm:4.4.0
\--- com.github.ajalt.mordant:mordant:2.5.0
Source: main
------------
(no usages)
Source: test
------------
(no usages)
```
Describe the bug
The plugin tells me to add the transitive directly as testImplementation("com.github.ajalt.mordant:mordant:2.5.0").
I don't directly use anything from this dependency.
I use com.github.ajalt.clikt:clikt(-jvm) and in my test I use the test function which has the following signature.
The AnsiLevel is from mordant(-jvm), I suspect this is detected as a usage because of how kotlin default arguments are converted to bytecode, is that possible?
All I want to do is to understand if my understanding of when to add this as testimplementation (when I have an import statement for it) is correct.
Also clikt seems to correctly expose this as api dependency see here, so the combination of me not using it directly and them exposing it should be enough, right?
To Reproduce
Steps to reproduce the behavior:
Simply use Clickt in a dummy project and use the test method on CliktCommand
See for example this repo.
Build scan link
Plugin version
1.32.0, also tried debugging using the main branch
Gradle version
8.7
JDK version
Temurin-17
(Optional) Kotlin and Kotlin Gradle Plugin (KGP) version
kotlin-gradle-plugin:2.0.0 using 1.9.24 gives the same result
(Optional) Android Gradle Plugin (AGP) version
(Optional)
reason
output for bugs relating to incorrect adviceOutput
``` ---------------------------------------- You asked about the dependency 'com.github.ajalt.mordant:mordant:2.5.0'. You have been advised to add this dependency to 'testImplementation'. It matched a bundle rule: com.github.ajalt.mordant:mordant:2.5.0 was substituted for com.github.ajalt.mordant:mordant-jvm:2.5.0. ---------------------------------------- Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for compileClasspath: :renovate-notifier \--- com.github.ajalt.clikt:clikt:4.4.0 \--- com.github.ajalt.clikt:clikt-jvm:4.4.0 \--- com.github.ajalt.mordant:mordant:2.5.0 Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for runtimeClasspath: :renovate-notifier \--- com.github.ajalt.clikt:clikt:4.4.0 \--- com.github.ajalt.clikt:clikt-jvm:4.4.0 \--- com.github.ajalt.mordant:mordant:2.5.0 Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for testCompileClasspath: :renovate-notifier \--- com.github.ajalt.clikt:clikt:4.4.0 \--- com.github.ajalt.clikt:clikt-jvm:4.4.0 \--- com.github.ajalt.mordant:mordant:2.5.0 Shortest path from :renovate-notifier to com.github.ajalt.mordant:mordant:2.5.0 for testRuntimeClasspath: :renovate-notifier \--- com.github.ajalt.clikt:clikt:4.4.0 \--- com.github.ajalt.clikt:clikt-jvm:4.4.0 \--- com.github.ajalt.mordant:mordant:2.5.0 Source: main ------------ (no usages) Source: test ------------ (no usages) ```Describe the bug
The plugin tells me to add the transitive directly as
testImplementation("com.github.ajalt.mordant:mordant:2.5.0")
. I don't directly use anything from this dependency. I usecom.github.ajalt.clikt:clikt(-jvm)
and in my test I use the test function which has the following signature. TheAnsiLevel
is frommordant(-jvm)
, I suspect this is detected as a usage because of how kotlin default arguments are converted to bytecode, is that possible? All I want to do is to understand if my understanding of when to add this as testimplementation (when I have an import statement for it) is correct. Also clikt seems to correctly expose this as api dependency see here, so the combination of me not using it directly and them exposing it should be enough, right?To Reproduce Steps to reproduce the behavior: Simply use Clickt in a dummy project and use the test method on
CliktCommand
See for example this repo.Expected behavior
Additional context