autonomousapps / autonomousapps/dependency-analysis-gradle-plugin

Wrong configuration issue is not working

Open
#1,325 2 comments 1 reaction 0 assignees View on GitHub
bug toolchain:kotlin
Dominant language
Kotlin
Stars
2.2k
Forks
158
Avg merge
16h 25m
Merged PRs (30d)
46

Description

**Build scan link**

https://scans.gradle.com/s/2eobagb7ri4xq

**Plugin version**

2.5.0

**Gradle version**

8.11.1

**JDK version**

21

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

2.0.20

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

Not an android project, but I can reproduce on a private android project I'm working on and can't share.

**(Optional) `reason` output for bugs relating to incorrect advice**

```
------------------------------------------------------------
You asked about the dependency 'org.jetbrains.kotlinx:kotlinx-datetime:0.6.1 (libs.kotlinx.datetime)'.
There is no advice regarding this dependency.
It was removed because it matched a bundle rule for org.jetbrains.kotlinx:kotlinx-datetime:0.6.1 (libs.kotlinx.datetime), which is already declared.
------------------------------------------------------------

Shortest path from :lib to org.jetbrains.kotlinx:kotlinx-datetime:0.6.1 (libs.kotlinx.datetime) for compileClasspath:
:lib
\--- org.jetbrains.kotlinx:kotlinx-datetime:0.6.1

Shortest path from :lib to org.jetbrains.kotlinx:kotlinx-datetime:0.6.1 (libs.kotlinx.datetime) for runtimeClasspath:
:lib
\--- org.jetbrains.kotlinx:kotlinx-datetime:0.6.1

Shortest path from :lib to org.jetbrains.kotlinx:kotlinx-datetime:0.6.1 (libs.kotlinx.datetime) for testCompileClasspath:
:lib
\--- org.jetbrains.kotlinx:kotlinx-datetime:0.6.1

Shortest path from :lib to org.jetbrains.kotlinx:kotlinx-datetime:0.6.1 (libs.kotlinx.datetime) for testRuntimeClasspath:
:lib
\--- org.jetbrains.kotlinx:kotlinx-datetime:0.6.1

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

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

```

**Describe the bug**

I have a kotlin library project generated by gradle init. It contains a single kotlin lib subproject, with a single public class with a public function returning `kotlinx.datetime.Instant`.

The subproject declares `org.jetbrains.kotlinx:kotlinx-datetime` as `implementation`, but since it has a `kotlinx.datetime.Instant` as a return value in a public function, it seems that the plugin should give me an advice to change it to `api`. Instead, it gives me no advice.

**To Reproduce**
Steps to reproduce the behavior:
I have a project where the issue happens on my local machine and on Github CI: https://github.com/alyssoncs/dagp-bug

**Expected behavior**

The plugin should tell me to change `org.jetbrains.kotlinx:kotlinx-datetime` from `implementation` to `api`

**Additional context**

In the CI I can see the following warnings:

```
> Task :lib:filterAdvice
ANTLR Runtime version 4.10.1 used for parser compilation does not match the current runtime version 4.13.1
ANTLR Tool version 4.10.1 used for code generation does not match the current runtime version 4.13.1
ANTLR Runtime version 4.10.1 used for parser compilation does not match the current runtime version 4.13.1
```

Can't see them in my local machine, even after doing a gradle clean.

Contributor guide

Open the contributing guide

Research direction

Start with the linked reproduction project and the :lib:filterAdvice task, then inspect the reported `reason` output for kotlinx-datetime. Compare the public Kotlin return type with the dependency's implementation declaration and the plugin's advice result. Done means the reproduction advises changing org.jetbrains.kotlinx:kotlinx-datetime from implementation to api.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.