Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JakeWharton/dependency-tree-diff
An intelligent diff tool for the output of Gradle's dependencies task
https://github.com/JakeWharton/dependency-tree-diff
Last synced: about 2 months ago
JSON representation
An intelligent diff tool for the output of Gradle's dependencies task
- Host: GitHub
- URL: https://github.com/JakeWharton/dependency-tree-diff
- Owner: JakeWharton
- License: apache-2.0
- Created: 2020-08-21T15:01:44.000Z (over 4 years ago)
- Default Branch: trunk
- Last Pushed: 2024-04-13T00:25:43.000Z (8 months ago)
- Last Synced: 2024-04-14T08:41:40.225Z (8 months ago)
- Language: Kotlin
- Homepage:
- Size: 186 KB
- Stars: 776
- Watchers: 12
- Forks: 24
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-kotlin - dependency-tree-diff - An intelligent diff tool for the output of Gradle's dependencies task (Libraries)
README
# Dependency Tree Diff
An intelligent diff tool for the output of Gradle's `dependencies` task which always shows
the path to the root dependency.```diff
+--- com.squareup.sqldelight:android-driver:1.4.0
| +--- com.squareup.sqldelight:runtime-jvm:1.4.0
-| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72
-| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
+| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*)
-| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
+| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0
-| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*)
+| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*)
\--- com.squareup.sqldelight:rxjava2-extensions:1.4.0
- \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*)
+ \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*)
```Unlike a normal `diff`, unchanged entries are displayed only when they are a parent dependency
to one that changed.Compare the above diff to `diff -U 0`:
```diff
@@ -31,3 +31,3 @@
-| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72
-| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
-| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
+| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*)
+| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0
@@ -35 +35 @@
-| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*)
@@ -40 +40 @@
-| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*)
@@ -51 +51 @@
```Note how there is no context as to what is affected.
In this particular sample we can reach the root dependencies with `diff -U 2`:
```diff
@@ -29,14 +29,14 @@
+--- com.squareup.sqldelight:android-driver:1.4.0
| +--- com.squareup.sqldelight:runtime-jvm:1.4.0
-| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72
-| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*)
-| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72
+| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0
+| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*)
+| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0
| +--- androidx.sqlite:sqlite:2.1.0 (*)
-| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*)
| \--- androidx.sqlite:sqlite-framework:2.1.0 (*)
+--- com.squareup.sqldelight:rxjava2-extensions:1.4.0
| +--- com.squareup.sqldelight:runtime:1.4.0
| | \--- com.squareup.sqldelight:runtime-jvm:1.4.0 (*)
-| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*)
| \--- io.reactivex.rxjava2:rxjava:2.2.5 -> 2.2.19 (*)
\--- com.squareup.inject:inflation-inject:0.5.1
@@ -49,4 +49,4 @@
```Now, however, additional unchanged dependencies are displayed such as `androidx.sqlite` and the
SQLDelight runtime dependency by the RxJava 2 extensions artifact.For deep dependency chains, `-U 2` will not be enough to see all the roots. Increasing the value
will only show more unchanged dependencies. `dependency-tree-diff` will always display the
minimal subset needed to provide context.For more information about why a diff of the dependency tree is useful see
["Surfacing Hidden Change to Pull Requests"](https://developer.squareup.com/blog/surfacing-hidden-change-to-pull-requests/).
To learn about how code shrinking keeps the binary as small as possible see
["Shrinking a Kotlin binary by 99.2%"](https://jakewharton.com/shrinking-a-kotlin-binary/).## Usage
The tool parses the output of Gradle's `dependencies` task. Specify `--configuration ` when
running the task so that only a single tree will be shown.```
$ ./gradlew :app:dependencies --configuration releaseRuntimeClasspath > old.txt
$ # Update a dependency...
$ ./gradlew :app:dependencies --configuration releaseRuntimeClasspath > new.txt
$ ./dependency-tree-diff.jar old.txt new.txt
```See `src/test/fixtures/` for example outputs and their expected diffs.
## Install
**Mac OS**
```
$ brew install JakeWharton/repo/dependency-tree-diff
```**Other**
Download standalone JAR from
[latest release](https://github.com/JakeWharton/dependency-tree-diff/releases/latest).
On Linux and macOS you can `chmod +x` and execute the `.jar` directly.
On Windows use `java -jar`.## License
Copyright 2020 Jake Wharton
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License athttp://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.