dependency-analysis-gradle-plugin icon indicating copy to clipboard operation
dependency-analysis-gradle-plugin copied to clipboard

ignoreKtx(true) is not working

Open emartynov opened this issue 1 year ago • 5 comments

Plugin version 2.1.4

Gradle version 8.10.2

JDK version 23

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

(Optional) Android Gradle Plugin (AGP) version 8.6.2

(Optional) reason output for bugs relating to incorrect advice ./gradlew sha:vide:reason --id androidx.lifecycle:lifecycle-runtime:2.8.6

:shared:video-player
\--- io.coil-kt:coil-base:2.7.0
      \--- androidx.lifecycle:lifecycle-runtime:2.8.6

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

./gradlew sha:vide:reason --id libs.androidx.lifecycle.runtime

Shortest path from :shared:video-player to androidx.lifecycle:lifecycle-runtime-ktx:2.8.6 (libs.androidx.lifecycle.runtime) for nowsecureReleaseUnitTestRuntimeClasspath:
:shared:video-player
\--- androidx.lifecycle:lifecycle-runtime-ktx:2.8.6

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

Describe the bug The ktx dependency is proposed to be removed and the normal dependency is proposed to be added even we have

dependencyAnalysis {
    structure {
        ignoreKtx(true) // default is false
    }
}

In the root folder.

Expected behavior ignoreKtx is respected

Additional context Plugin is applied in root folder and then applied in every module. The ignoreKts is applied in the root file.

emartynov avatar Oct 10 '24 13:10 emartynov

Thanks for the issue. Do you have a reproducer?

autonomousapps avatar Dec 14 '24 17:12 autonomousapps

Sorry for the delay, let me try in small project.

emartynov avatar Dec 17 '24 18:12 emartynov

Having the same issue with these three

implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
implementation("androidx.paging:paging-common-ktx:3.3.6")

Plugin version 2.16.0

Gradle version 8.13

JDK version 23 (for Gradle), 17 (for code generation)

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

(Optional) Android Gradle Plugin (AGP) version 8.9.1

(Optional) reason output for bugs relating to incorrect advice All these 3 dependencies are directly declared in the build.gradle.kts file. When I ask why adding the others are suggested I get this:

------------------------------------------------------------
You asked about the dependency 'androidx.lifecycle:lifecycle-runtime:2.8.7'.
You have been advised to add this dependency to 'implementation'.
It matched a bundle rule: androidx.lifecycle:lifecycle-runtime:2.8.7 was substituted for androidx.lifecycle:lifecycle-runtime-android:2.8.7.
------------------------------------------------------------

Shortest path from :myproject to androidx.lifecycle:lifecycle-runtime:2.8.7 for myflavorDebugCompileClasspath:
:myproject
\--- com.google.android.material:material:1.12.0
      \--- androidx.lifecycle:lifecycle-runtime:2.8.7

Shortest path from :myproject to androidx.lifecycle:lifecycle-runtime:2.8.7 for myflavorDebugRuntimeClasspath:
:myproject
\--- androidx.lifecycle:lifecycle-extensions:2.2.0
      \--- androidx.lifecycle:lifecycle-runtime:2.8.7

(ditto for other flavors)

Similar for the others:

------------------------------------------------------------
You asked about the dependency 'androidx.lifecycle:lifecycle-viewmodel:2.8.7'.
You have been advised to add this dependency to 'implementation'.
It matched a bundle rule: androidx.lifecycle:lifecycle-viewmodel:2.8.7 was substituted for androidx.lifecycle:lifecycle-viewmodel-android:2.8.7.
------------------------------------------------------------

Shortest path from :myproject to androidx.lifecycle:lifecycle-viewmodel:2.8.7 for myflavorDebugCompileClasspath:
:myproject
\--- androidx.lifecycle:lifecycle-extensions:2.2.0
      \--- androidx.lifecycle:lifecycle-viewmodel:2.8.7

Shortest path from :myproject to androidx.lifecycle:lifecycle-viewmodel:2.8.7 for myflavorDebugRuntimeClasspath:
:myproject
\--- androidx.lifecycle:lifecycle-extensions:2.2.0
      \--- androidx.lifecycle:lifecycle-viewmodel:2.8.7

(etc)
------------------------------------------------------------
You asked about the dependency 'androidx.paging:paging-common:3.3.6'.
You have been advised to add this dependency to 'implementation'.
It matched a bundle rule: androidx.paging:paging-common:3.3.6 was substituted for androidx.paging:paging-common-android:3.3.6.
------------------------------------------------------------

Shortest path from :myproject to androidx.paging:paging-common:3.3.6 for myflavorDebugCompileClasspath:
:myproject
\--- androidx.paging:paging-common-ktx:3.3.6
      \--- androidx.paging:paging-common:3.3.6

Shortest path from :myproject to androidx.paging:paging-common:3.3.6 for myflavorDebugRuntimeClasspath:
:myproject
\--- androidx.paging:paging-common-ktx:3.3.6
      \--- androidx.paging:paging-common:3.3.6

(etc)

No idea what all of this means.

drubio-izzi avatar Apr 15 '25 13:04 drubio-izzi

@drubio-izzi could you provide the actual output of running buildHealth or projectHealth?

autonomousapps avatar Apr 15 '25 17:04 autonomousapps

I sent you the output through email. Hope you don't mind.

drubio-izzi avatar Apr 17 '25 10:04 drubio-izzi

Should we close it? I don't get these advices anymore.

emartynov avatar Dec 18 '25 14:12 emartynov

If I can get a second confirmation, happy to close the issue as resolved.

autonomousapps avatar Dec 19 '25 21:12 autonomousapps