autonomousapps / dependency-analysis-gradle-plugin

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.77k stars 116 forks source link

Add more information to the transitively used dependencies advice #442

Closed KatieBarnett closed 2 years ago

KatieBarnett commented 3 years ago

It would be great to show what the transitively used dependencies listed in the advice can replace (similar to how incorrect configuration tells you what it was). This would help developers know what to do to fix the issue (especially inexperienced developers). The current list can be overwhelming!

Example on what I see now below. Note - some of these dependencies are actually in another module that is a dependency of this module. If that information (i.e. fix in module :core) could be given, that would also be great.

  Transitively used dependencies that should be declared directly as indicated:
  - api("javax.inject:javax.inject:1")
  - api("androidx.paging:paging-common:2.1.2")
  - api("androidx.lifecycle:lifecycle-livedata:2.2.0")
  - api("androidx.appcompat:appcompat:1.2.0")
  - api("com.google.dagger:dagger:2.38")
  - api("com.algolia:algoliasearch-client-kotlin-jvm:1.6.2")
  - api("com.google.code.gson:gson:2.8.6")
  - api("com.google.dagger:dagger-android-support:2.38")
  - api("androidx.constraintlayout:constraintlayout:2.0.4")
  - api("com.google.android.material:material:1.3.0")
  - api("au.net.abc.terminus:terminus:2.12.2")
  - api("androidx.lifecycle:lifecycle-livedata-core:2.3.1")
  - api("com.google.dagger:dagger-android:2.38")
  - api("androidx.recyclerview:recyclerview:1.2.0")
  - implementation("org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.0.1")
  - implementation("androidx.arch.core:core-common:2.1.0")
  - implementation("androidx.fragment:fragment:1.3.2")
  - implementation("androidx.lifecycle:lifecycle-common:2.3.1")
  - testImplementation("org.robolectric:annotations:4.6.1")
  - implementation("androidx.core:core:1.5.0")
  - implementation("com.jakewharton.timber:timber:4.7.1")
  - testImplementation("io.reactivex.rxjava2:rxjava:2.2.12")
  - implementation("androidx.lifecycle:lifecycle-viewmodel:2.3.1")
  - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.4.3")
autonomousapps commented 3 years ago

Try out ./gradlew :core:reason --id javax.inject:javax.inject and let me know what you think (where "core" is the module that has this advice).