GithubHelp home page GithubHelp logo

tchigher / dependency-tree-diff Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jakewharton/dependency-tree-diff

0.0 0.0 0.0 89 KB

An intelligent diff tool for the output of Gradle's dependencies task

License: Apache License 2.0

Kotlin 93.90% Shell 6.10%

dependency-tree-diff's Introduction

Dependency Tree Diff

An intelligent diff tool for the output of Gradle's dependencies task which always shows the path to the root dependency.

 +--- 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:

@@ -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:

@@ -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 of 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". To learn about how code shrinking keeps the binary as small as possible see "Shrinking a Kotlin binary by 99.2%".

Usage

The tool parses the output of Gradle's dependencies task. Specify --configuration <name> 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. On MacOS and Linux 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 at

   http://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.

dependency-tree-diff's People

Contributors

jakewharton avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.