dependency-guard icon indicating copy to clipboard operation
dependency-guard copied to clipboard

FR: harmonize `GradleException` content between List and Tree

Open SimonMarquis opened this issue 2 years ago • 6 comments

List and Tree modes throw different exception content.

Tree

***** DEPENDENCY CHANGE DETECTED *****
-\--- androidx.activity:activity:1.4.0
-     +--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     +--- androidx.core:core:1.7.0
-     |    +--- androidx.annotation:annotation:1.2.0
-     |    +--- androidx.annotation:annotation-experimental:1.1.0
-     |    +--- androidx.lifecycle:lifecycle-runtime:2.3.1
-     |    |    +--- androidx.arch.core:core-runtime:2.1.0
-     |    |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     |    |    |    \--- androidx.arch.core:core-common:2.1.0
-     |    |    |         \--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     |    |    +--- androidx.lifecycle:lifecycle-common:2.3.1
-     |    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     |    |    +--- androidx.arch.core:core-common:2.1.0 (*)
-     |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     |    +--- androidx.versionedparcelable:versionedparcelable:1.1.1
-     |    |    +--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     |    |    \--- androidx.collection:collection:1.0.0
-     |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.2.0
-     |    +--- androidx.collection:collection:1.0.0 (*)
-     |    \--- androidx.concurrent:concurrent-futures:1.0.0
-     |         +--- com.google.guava:listenablefuture:1.0
-     |         \--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     +--- androidx.lifecycle:lifecycle-runtime:2.3.1 (*)
-     +--- androidx.lifecycle:lifecycle-viewmodel:2.3.1
-     |    \--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     +--- androidx.savedstate:savedstate:1.1.0
-     |    +--- androidx.annotation:annotation:1.1.0 -> 1.2.0
-     |    +--- androidx.arch.core:core-common:2.0.1 -> 2.1.0 (*)
-     |    \--- androidx.lifecycle:lifecycle-common:2.0.0 -> 2.3.1 (*)
-     +--- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1
-     |    +--- androidx.annotation:annotation:1.0.0 -> 1.2.0
-     |    +--- androidx.savedstate:savedstate:1.1.0 (*)
-     |    +--- androidx.lifecycle:lifecycle-livedata-core:2.3.1
-     |    |    +--- androidx.arch.core:core-common:2.1.0 (*)
-     |    |    +--- androidx.arch.core:core-runtime:2.1.0 (*)
-     |    |    \--- androidx.lifecycle:lifecycle-common:2.3.1 (*)
-     |    \--- androidx.lifecycle:lifecycle-viewmodel:2.3.1 (*)
-     +--- org.jetbrains.kotlin:kotlin-stdlib:1.5.31 -> 1.6.10 (*)
-     +--- androidx.collection:collection:1.0.0 (*)
-     \--- androidx.tracing:tracing:1.0.0
-          \--- androidx.annotation:annotation:1.1.0 -> 1.2.0
+\--- androidx.activity:activity:1.4.1 FAILED


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sample:app:dependencyTreeDiffReleaseRuntimeClasspath'.
> ***** DEPENDENCY CHANGE DETECTED *****
  Dependency Tree comparison to baseline does not match.
  
  If this is intentional, re-baseline using ./gradlew :sample:app:dependencyGuardBaseline
  Or use ./gradlew dependencyGuardBaseline to re-baseline dependencies in entire project.


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 9s
9:07:35 pm: Execution finished ':sample:app:dependencyGuard --quiet'.

List

Dependencies Changed in :sample:app for configuration releaseRuntimeClasspath
- androidx.activity:activity:1.4.0
- androidx.annotation:annotation-experimental:1.1.0
- androidx.annotation:annotation:1.2.0
- androidx.arch.core:core-common:2.1.0
- androidx.arch.core:core-runtime:2.1.0
- androidx.collection:collection:1.0.0
- androidx.concurrent:concurrent-futures:1.0.0
- androidx.core:core:1.7.0
- androidx.lifecycle:lifecycle-common:2.3.1
- androidx.lifecycle:lifecycle-livedata-core:2.3.1
- androidx.lifecycle:lifecycle-runtime:2.3.1
- androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1
- androidx.lifecycle:lifecycle-viewmodel:2.3.1
- androidx.savedstate:savedstate:1.1.0
- androidx.tracing:tracing:1.0.0
- androidx.versionedparcelable:versionedparcelable:1.1.1
- com.google.guava:listenablefuture:1.0


If this is intentional, re-baseline using ./gradlew :sample:app:dependencyGuardBaseline
Or use ./gradlew dependencyGuardBaseline to re-baseline dependencies in entire project.


FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sample:app:dependencyGuard'.
> Dependencies Changed in :sample:app for configuration releaseRuntimeClasspath
  - androidx.activity:activity:1.4.0
  - androidx.annotation:annotation-experimental:1.1.0
  - androidx.annotation:annotation:1.2.0
  - androidx.arch.core:core-common:2.1.0
  - androidx.arch.core:core-runtime:2.1.0
  - androidx.collection:collection:1.0.0
  - androidx.concurrent:concurrent-futures:1.0.0
  - androidx.core:core:1.7.0
  - androidx.lifecycle:lifecycle-common:2.3.1
  - androidx.lifecycle:lifecycle-livedata-core:2.3.1
  - androidx.lifecycle:lifecycle-runtime:2.3.1
  - androidx.lifecycle:lifecycle-viewmodel-savedstate:2.3.1
  - androidx.lifecycle:lifecycle-viewmodel:2.3.1
  - androidx.savedstate:savedstate:1.1.0
  - androidx.tracing:tracing:1.0.0
  - androidx.versionedparcelable:versionedparcelable:1.1.1
  - com.google.guava:listenablefuture:1.0
  
  If this is intentional, re-baseline using ./gradlew :sample:app:dependencyGuardBaseline
  Or use ./gradlew dependencyGuardBaseline to re-baseline dependencies in entire project.
  


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 2s

As you can see, the List output contains the diff twice. Moreover, the colored diff output is generally hidden, and only the last bit appear, which is the GradleException message. (and the first line is different as well) Do you think we could harmonize this behavior?

  • Tree (ad-hoc message)

https://github.com/dropbox/dependency-guard/blob/56ba80d9612e5de24a1d9e722f9befaf9ef19a47/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/utils/DependencyGuardTreeDiffer.kt#L66-L72

  • List (reuses the exception message, leading to duplicated output)

https://github.com/dropbox/dependency-guard/blob/56ba80d9612e5de24a1d9e722f9befaf9ef19a47/dependency-guard/src/main/kotlin/com/dropbox/gradle/plugins/dependencyguard/internal/list/DependencyGuardListTask.kt#L105

SimonMarquis avatar Feb 14 '23 20:02 SimonMarquis