├── .github ├── workflows │ ├── .java-version │ └── build.yaml └── renovate.json5 ├── .gitignore ├── src ├── test │ ├── fixtures │ │ ├── line-endings-mac │ │ │ ├── expected.txt │ │ │ ├── new.txt │ │ │ └── old.txt │ │ ├── line-endings-unix │ │ │ ├── expected.txt │ │ │ ├── new.txt │ │ │ └── old.txt │ │ ├── line-endings-windows │ │ │ ├── expected.txt │ │ │ ├── new.txt │ │ │ └── old.txt │ │ ├── unchanged-subtree │ │ │ ├── expected.txt │ │ │ ├── new.txt │ │ │ └── old.txt │ │ ├── new-at-end │ │ │ ├── expected.txt │ │ │ ├── old.txt │ │ │ └── new.txt │ │ ├── version-bump │ │ │ ├── expected.txt │ │ │ ├── old.txt │ │ │ └── new.txt │ │ ├── version-bump-tree-only │ │ │ ├── expected.txt │ │ │ ├── old.txt │ │ │ └── new.txt │ │ └── single │ │ │ ├── expected.txt │ │ │ ├── old.txt │ │ │ └── new.txt │ └── kotlin │ │ └── com │ │ └── jakewharton │ │ └── gradle │ │ └── dependencies │ │ ├── FixtureTest.kt │ │ └── MainTest.kt └── main │ ├── rules.txt │ └── kotlin │ └── com │ └── jakewharton │ └── gradle │ └── dependencies │ ├── main.kt │ └── treeDiff.kt ├── gradle ├── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── libs.versions.toml ├── .editorconfig ├── settings.gradle ├── RELEASING.md ├── CHANGELOG.md ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE.txt /.github/workflows/.java-version: -------------------------------------------------------------------------------- 1 | 25 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Gradle 2 | build 3 | /.gradle 4 | /reports 5 | 6 | # IntelliJ 7 | /.idea 8 | -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-mac/expected.txt: -------------------------------------------------------------------------------- 1 | \--- group:dep1:1.0 2 | - \--- group:dep2:2.0 3 | + \--- group:dep2:2.1 4 | -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-unix/expected.txt: -------------------------------------------------------------------------------- 1 | \--- group:dep1:1.0 2 | - \--- group:dep2:2.0 3 | + \--- group:dep2:2.1 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JakeWharton/dependency-tree-diff/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-windows/expected.txt: -------------------------------------------------------------------------------- 1 | \--- group:dep1:1.0 2 | - \--- group:dep2:2.0 3 | + \--- group:dep2:2.1 4 | -------------------------------------------------------------------------------- /src/test/fixtures/unchanged-subtree/expected.txt: -------------------------------------------------------------------------------- 1 | \--- com.google.firebase:firebase-perf:18.0.0 2 | - \--- com.squareup.okhttp3:okhttp:3.0.0 -> 4.8.0 3 | + \--- com.squareup.okhttp3:okhttp:3.0.0 -> 4.8.1 4 | -------------------------------------------------------------------------------- /src/main/rules.txt: -------------------------------------------------------------------------------- 1 | -dontobfuscate 2 | -allowaccessmodification 3 | -keepattributes SourceFile, LineNumberTable 4 | 5 | -keep class com.jakewharton.gradle.dependencies.DependencyTreeDiff { 6 | public static void main(java.lang.String[]); 7 | } 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = tab 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.yaml] 12 | indent_style = space 13 | -------------------------------------------------------------------------------- /gradle/libs.versions.toml: -------------------------------------------------------------------------------- 1 | [libraries] 2 | junit = "junit:junit:4.13.2" 3 | assertk = "com.willowtreeapps.assertk:assertk:0.28.1" 4 | r8 = "com.android.tools:r8:8.13.17" 5 | kotlin-gradle-plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.0" 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-mac/new.txt: -------------------------------------------------------------------------------- 1 | > Task :dependencies ------------------------------------------------------------ Project ':' ------------------------------------------------------------ default +--- group:dep1:1.0 | +--- group:dep2:2.1 \--- group:dep3:3.0 A web-based, searchable dependency report is available by adding the --scan option. BUILD SUCCESSFUL in 3s 9 actionable tasks: 1 executed, 8 up-to-date -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-mac/old.txt: -------------------------------------------------------------------------------- 1 | > Task :dependencies ------------------------------------------------------------ Project ':' ------------------------------------------------------------ default +--- group:dep1:1.0 | +--- group:dep2:2.0 \--- group:dep3:3.0 A web-based, searchable dependency report is available by adding the --scan option. BUILD SUCCESSFUL in 3s 9 actionable tasks: 1 executed, 8 up-to-date -------------------------------------------------------------------------------- /src/test/fixtures/unchanged-subtree/new.txt: -------------------------------------------------------------------------------- 1 | +--- com.google.firebase:firebase-perf:18.0.0 2 | | \--- com.squareup.okhttp3:okhttp:3.0.0 -> 4.8.1 3 | | +--- com.squareup.okio:okio:2.7.0 4 | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72 (*) 5 | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70 -> 1.3.72 6 | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 7 | -------------------------------------------------------------------------------- /src/test/fixtures/unchanged-subtree/old.txt: -------------------------------------------------------------------------------- 1 | +--- com.google.firebase:firebase-perf:18.0.0 2 | | \--- com.squareup.okhttp3:okhttp:3.0.0 -> 4.8.0 3 | | +--- com.squareup.okio:okio:2.7.0 4 | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.70 -> 1.3.72 (*) 5 | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.70 -> 1.3.72 6 | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0' 3 | } 4 | 5 | dependencyResolutionManagement { 6 | repositories { 7 | mavenCentral() 8 | google { 9 | mavenContent { 10 | includeGroupAndSubgroups("androidx") 11 | includeGroupAndSubgroups("com.android") 12 | includeGroupAndSubgroups("com.google") 13 | } 14 | } 15 | } 16 | } 17 | 18 | rootProject.name = 'dependency-tree-diff' 19 | -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-unix/new.txt: -------------------------------------------------------------------------------- 1 | > Task :dependencies 2 | 3 | ------------------------------------------------------------ 4 | Project ':' 5 | ------------------------------------------------------------ 6 | 7 | default 8 | +--- group:dep1:1.0 9 | | +--- group:dep2:2.1 10 | \--- group:dep3:3.0 11 | 12 | A web-based, searchable dependency report is available by adding the --scan option. 13 | 14 | BUILD SUCCESSFUL in 3s 15 | 9 actionable tasks: 1 executed, 8 up-to-date 16 | -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-unix/old.txt: -------------------------------------------------------------------------------- 1 | > Task :dependencies 2 | 3 | ------------------------------------------------------------ 4 | Project ':' 5 | ------------------------------------------------------------ 6 | 7 | default 8 | +--- group:dep1:1.0 9 | | +--- group:dep2:2.0 10 | \--- group:dep3:3.0 11 | 12 | A web-based, searchable dependency report is available by adding the --scan option. 13 | 14 | BUILD SUCCESSFUL in 3s 15 | 9 actionable tasks: 1 executed, 8 up-to-date 16 | -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-windows/new.txt: -------------------------------------------------------------------------------- 1 | > Task :dependencies 2 | 3 | ------------------------------------------------------------ 4 | Project ':' 5 | ------------------------------------------------------------ 6 | 7 | default 8 | +--- group:dep1:1.0 9 | | +--- group:dep2:2.1 10 | \--- group:dep3:3.0 11 | 12 | A web-based, searchable dependency report is available by adding the --scan option. 13 | 14 | BUILD SUCCESSFUL in 3s 15 | 9 actionable tasks: 1 executed, 8 up-to-date 16 | -------------------------------------------------------------------------------- /src/test/fixtures/line-endings-windows/old.txt: -------------------------------------------------------------------------------- 1 | > Task :dependencies 2 | 3 | ------------------------------------------------------------ 4 | Project ':' 5 | ------------------------------------------------------------ 6 | 7 | default 8 | +--- group:dep1:1.0 9 | | +--- group:dep2:2.0 10 | \--- group:dep3:3.0 11 | 12 | A web-based, searchable dependency report is available by adding the --scan option. 13 | 14 | BUILD SUCCESSFUL in 3s 15 | 9 actionable tasks: 1 executed, 8 up-to-date 16 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | # Releasing 2 | 3 | 1. Update the `CHANGELOG.md`: 4 | 1. Change the `Unreleased` header to the release version. 5 | 2. Add a link URL to ensure the header link works. 6 | 3. Add a new `Unreleased` section to the top. 7 | 8 | 2. Commit 9 | 10 | ``` 11 | $ git commit -am "Prepare version X.Y.X" 12 | ``` 13 | 14 | 3. Tag 15 | 16 | ``` 17 | $ git tag -am "Version X.Y.Z" X.Y.Z 18 | ``` 19 | 20 | 4. Push! 21 | 22 | ``` 23 | $ git push && git push --tags 24 | ``` 25 | 26 | This will trigger a GitHub Action workflow which will create a GitHub release, upload the 27 | jar, and send a PR to the Homebrew repo. 28 | 29 | 5. Find [the Homebrew PR](https://github.com/JakeWharton/homebrew-repo/pulls) and merge it! 30 | -------------------------------------------------------------------------------- /src/test/fixtures/new-at-end/expected.txt: -------------------------------------------------------------------------------- 1 | +\--- com.autonomousapps:dependency-analysis-gradle-plugin:0.59.0 2 | + +--- org.jetbrains.kotlin:kotlin-bom:1.3.72 -> 1.4.0 (*) 3 | + +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 -> 1.4.10 (*) 4 | + +--- com.squareup.moshi:moshi:1.9.2 -> 1.9.3 (*) 5 | + +--- com.squareup.moshi:moshi-kotlin:1.9.2 6 | + | +--- com.squareup.moshi:moshi:1.9.2 -> 1.9.3 (*) 7 | + | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.50 -> 1.4.10 (*) 8 | + | \--- org.jetbrains.kotlin:kotlin-reflect:1.3.50 -> 1.4.10 (*) 9 | + +--- org.jetbrains.kotlin:kotlin-reflect:1.3.72 -> 1.4.10 (*) 10 | + \--- org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0 11 | + \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 -> 1.4.10 (*) 12 | -------------------------------------------------------------------------------- /.github/renovate.json5: -------------------------------------------------------------------------------- 1 | { 2 | $schema: 'https://docs.renovatebot.com/renovate-schema.json', 3 | extends: [ 4 | 'config:recommended', 5 | ], 6 | ignorePresets: [ 7 | // Ensure we get the latest version and are not pinned to old versions. 8 | 'workarounds:javaLTSVersions', 9 | ], 10 | customManagers: [ 11 | // Update .java-version file with the latest JDK version. 12 | { 13 | customType: 'regex', 14 | fileMatch: [ 15 | '\\.java-version$', 16 | ], 17 | matchStrings: [ 18 | '(?.*)\\n', 19 | ], 20 | datasourceTemplate: 'java-version', 21 | depNameTemplate: 'java', 22 | // Only write the major version. 23 | extractVersionTemplate: '^(?\\d+)', 24 | }, 25 | ], 26 | } 27 | -------------------------------------------------------------------------------- /src/test/fixtures/version-bump/expected.txt: -------------------------------------------------------------------------------- 1 | +--- com.squareup.sqldelight:android-driver:1.4.0 2 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 3 | -| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 4 | -| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 5 | +| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 6 | +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*) 7 | -| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 8 | +| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0 9 | -| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 10 | +| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 11 | \--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 12 | - \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 13 | + \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 14 | -------------------------------------------------------------------------------- /src/test/fixtures/version-bump-tree-only/expected.txt: -------------------------------------------------------------------------------- 1 | +--- com.squareup.sqldelight:android-driver:1.4.0 2 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 3 | -| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 4 | -| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 5 | +| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 6 | +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*) 7 | -| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 8 | +| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0 9 | -| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 10 | +| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 11 | \--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 12 | - \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 13 | + \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 14 | -------------------------------------------------------------------------------- /src/test/kotlin/com/jakewharton/gradle/dependencies/FixtureTest.kt: -------------------------------------------------------------------------------- 1 | package com.jakewharton.gradle.dependencies 2 | 3 | import assertk.assertThat 4 | import assertk.assertions.isEqualTo 5 | import org.junit.Test 6 | import org.junit.runner.RunWith 7 | import org.junit.runners.Parameterized 8 | import org.junit.runners.Parameterized.Parameters 9 | import java.io.File 10 | 11 | @RunWith(Parameterized::class) 12 | class FixtureTest(private val fixtureDir: File) { 13 | @Test fun run() { 14 | val old = fixtureDir.resolve("old.txt").readText() 15 | val new = fixtureDir.resolve("new.txt").readText() 16 | val expected = fixtureDir.resolve("expected.txt").readText() 17 | val actual = dependencyTreeDiff(old, new) 18 | assertThat(actual).isEqualTo(expected) 19 | } 20 | 21 | companion object { 22 | @JvmStatic 23 | @Parameters(name = "{0}") 24 | fun params() = File("src/test/fixtures") 25 | .listFiles { file -> file.isDirectory } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/kotlin/com/jakewharton/gradle/dependencies/main.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("DependencyTreeDiff") 2 | 3 | package com.jakewharton.gradle.dependencies 4 | 5 | import java.nio.charset.Charset 6 | import java.nio.charset.StandardCharsets 7 | import java.nio.file.Files 8 | import java.nio.file.Path 9 | import kotlin.io.path.Path 10 | import kotlin.system.exitProcess 11 | 12 | fun main(vararg args: String) { 13 | val help = "-h" in args || "--help" in args 14 | if (help || args.size != 2) { 15 | System.err.println("Usage: dependency-tree-diff old.txt new.txt") 16 | if (!help) { 17 | exitProcess(1) 18 | } 19 | return 20 | } 21 | 22 | val old = Path(args[0]).readText() 23 | val new = Path(args[1]).readText() 24 | 25 | print(dependencyTreeDiff(old, new)) 26 | } 27 | 28 | // Don't use Path.readText from stdlib because it introduces few classes, which will increase the binary size a bit. 29 | @Suppress("NOTHING_TO_INLINE") 30 | private inline fun Path.readText(charset: Charset = StandardCharsets.UTF_8): String { 31 | return Files.readAllBytes(this).toString(charset) 32 | } 33 | -------------------------------------------------------------------------------- /src/test/kotlin/com/jakewharton/gradle/dependencies/MainTest.kt: -------------------------------------------------------------------------------- 1 | package com.jakewharton.gradle.dependencies 2 | 3 | import org.junit.Test 4 | 5 | class MainTest { 6 | @Test fun helpDoesNotExitProcess() { 7 | // Bare flag. 8 | main("-h") 9 | main("--help") 10 | 11 | // Flag with valid arguments. 12 | main("-h", "old.txt", "new.txt") 13 | main("--help", "old.txt", "new.txt") 14 | main("old.txt", "-h", "new.txt") 15 | main("old.txt", "--help", "new.txt") 16 | main("old.txt", "new.txt", "-h") 17 | main("old.txt", "new.txt", "--help") 18 | 19 | // Flag with too few arguments. 20 | main("-h", "old.txt") 21 | main("--help", "old.txt") 22 | main("old.txt", "-h") 23 | main("old.txt", "--help") 24 | 25 | // Flag with too many arguments. 26 | main("-h", "old.txt", "new.txt", "wat.txt") 27 | main("--help", "old.txt", "new.txt", "wat.txt") 28 | main("old.txt", "-h", "new.txt", "wat.txt") 29 | main("old.txt", "--help", "new.txt", "wat.txt") 30 | main("old.txt", "new.txt", "-h", "wat.txt") 31 | main("old.txt", "new.txt", "--help", "wat.txt") 32 | main("old.txt", "new.txt", "wat.txt", "-h") 33 | main("old.txt", "new.txt", "wat.txt", "--help") 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | ## [Unreleased] 4 | 5 | 6 | ## [1.2.1] - 2024-01-02 7 | 8 | ### Fixed 9 | 10 | - Support dependency trees with a single root dependency. 11 | 12 | 13 | ## [1.2.0] - 2020-09-16 14 | 15 | ### Fixed 16 | 17 | - Include the final node of the tree when parsing. Previously it was being dropped which would lead to incorrect diffs when the new tree added a dependency at the end. 18 | 19 | 20 | ## [1.1.0] - 2020-08-25 21 | 22 | ### Added 23 | 24 | - `-h` and `--help` flags now recognized. 25 | 26 | ### Changed 27 | 28 | - Dependency trees which are unchanged beneath a changed node are no longer displayed. 29 | - Group changed nodes in a tree by their Maven coordinate. 30 | 31 | 32 | ## [1.0.0] - 2020-08-24 33 | 34 | Initial release 35 | 36 | 37 | [Unreleased]: https://github.com/JakeWharton/dependency-tree-diff/compare/1.2.1...HEAD 38 | [1.2.1]: https://github.com/JakeWharton/dependency-tree-diff/releases/tag/1.2.1 39 | [1.2.0]: https://github.com/JakeWharton/dependency-tree-diff/releases/tag/1.2.0 40 | [1.1.0]: https://github.com/JakeWharton/dependency-tree-diff/releases/tag/1.1.0 41 | [1.0.0]: https://github.com/JakeWharton/dependency-tree-diff/releases/tag/1.0.0 42 | -------------------------------------------------------------------------------- /src/test/fixtures/new-at-end/old.txt: -------------------------------------------------------------------------------- 1 | +--- com.github.ben-manes:gradle-versions-plugin:0.28.0 2 | | \--- com.thoughtworks.xstream:xstream:1.4.10 3 | | +--- xmlpull:xmlpull:1.1.3.1 4 | | \--- xpp3:xpp3_min:1.1.4c 5 | \--- com.diffplug.spotless:spotless-plugin-gradle:5.4.0 6 | +--- com.diffplug.spotless:spotless-lib:2.5.0 7 | +--- com.diffplug.spotless:spotless-lib-extra:2.5.0 8 | | +--- com.diffplug.spotless:spotless-lib:2.5.0 9 | | +--- com.diffplug.durian:durian-core:1.2.0 10 | | +--- com.diffplug.durian:durian-collect:1.2.0 11 | | | \--- com.diffplug.durian:durian-core:1.2.0 12 | | +--- org.eclipse.jgit:org.eclipse.jgit:5.8.0.202006091008-r 13 | | | +--- com.googlecode.javaewah:JavaEWAH:1.1.7 14 | | | \--- org.slf4j:slf4j-api:1.7.2 -> 1.7.22 15 | | +--- com.googlecode.concurrent-trees:concurrent-trees:2.6.1 16 | | \--- org.codehaus.groovy:groovy-xml:3.0.3 17 | | \--- org.codehaus.groovy:groovy:3.0.3 18 | +--- com.diffplug.durian:durian-core:1.2.0 19 | +--- com.diffplug.durian:durian-io:1.2.0 20 | | +--- com.diffplug.durian:durian-core:1.2.0 21 | | \--- com.diffplug.durian:durian-collect:1.2.0 (*) 22 | +--- com.diffplug.durian:durian-collect:1.2.0 (*) 23 | \--- org.eclipse.jgit:org.eclipse.jgit:5.8.0.202006091008-r (*) 24 | -------------------------------------------------------------------------------- /src/test/fixtures/version-bump-tree-only/old.txt: -------------------------------------------------------------------------------- 1 | +--- com.google.dagger:dagger:2.28.1 2 | | \--- javax.inject:javax.inject:1 3 | +--- com.google.dagger:dagger-android:2.28.1 4 | | +--- com.google.dagger:dagger:2.28.1 (*) 5 | | +--- com.google.dagger:dagger-lint-aar:2.28.1 6 | | +--- androidx.annotation:annotation:1.1.0 7 | | \--- javax.inject:javax.inject:1 8 | +--- com.squareup.sqldelight:android-driver:1.4.0 9 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 10 | | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 11 | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 12 | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 13 | | +--- androidx.sqlite:sqlite:2.1.0 (*) 14 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 15 | | \--- androidx.sqlite:sqlite-framework:2.1.0 (*) 16 | +--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 17 | | +--- com.squareup.sqldelight:runtime:1.4.0 18 | | | \--- com.squareup.sqldelight:runtime-jvm:1.4.0 (*) 19 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 20 | | \--- io.reactivex.rxjava2:rxjava:2.2.5 -> 2.2.19 (*) 21 | \--- com.squareup.inject:inflation-inject:0.5.1 22 | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0 23 | +--- com.squareup.inject:assisted-inject-annotations:0.5.1 24 | \--- javax.inject:javax.inject:1 25 | -------------------------------------------------------------------------------- /src/test/fixtures/version-bump-tree-only/new.txt: -------------------------------------------------------------------------------- 1 | +--- com.google.dagger:dagger:2.28.1 2 | | \--- javax.inject:javax.inject:1 3 | +--- com.google.dagger:dagger-android:2.28.1 4 | | +--- com.google.dagger:dagger:2.28.1 (*) 5 | | +--- com.google.dagger:dagger-lint-aar:2.28.1 6 | | +--- androidx.annotation:annotation:1.1.0 7 | | \--- javax.inject:javax.inject:1 8 | +--- com.squareup.sqldelight:android-driver:1.4.0 9 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 10 | | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 11 | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*) 12 | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0 13 | | +--- androidx.sqlite:sqlite:2.1.0 (*) 14 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 15 | | \--- androidx.sqlite:sqlite-framework:2.1.0 (*) 16 | +--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 17 | | +--- com.squareup.sqldelight:runtime:1.4.0 18 | | | \--- com.squareup.sqldelight:runtime-jvm:1.4.0 (*) 19 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 20 | | \--- io.reactivex.rxjava2:rxjava:2.2.5 -> 2.2.19 (*) 21 | \--- com.squareup.inject:inflation-inject:0.5.1 22 | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0 23 | +--- com.squareup.inject:assisted-inject-annotations:0.5.1 24 | \--- javax.inject:javax.inject:1 25 | -------------------------------------------------------------------------------- /src/test/fixtures/new-at-end/new.txt: -------------------------------------------------------------------------------- 1 | +--- com.github.ben-manes:gradle-versions-plugin:0.28.0 2 | | \--- com.thoughtworks.xstream:xstream:1.4.10 3 | | +--- xmlpull:xmlpull:1.1.3.1 4 | | \--- xpp3:xpp3_min:1.1.4c 5 | +--- com.diffplug.spotless:spotless-plugin-gradle:5.4.0 6 | | +--- com.diffplug.spotless:spotless-lib:2.5.0 7 | | +--- com.diffplug.spotless:spotless-lib-extra:2.5.0 8 | | | +--- com.diffplug.spotless:spotless-lib:2.5.0 9 | | | +--- com.diffplug.durian:durian-core:1.2.0 10 | | | +--- com.diffplug.durian:durian-collect:1.2.0 11 | | | | \--- com.diffplug.durian:durian-core:1.2.0 12 | | | +--- org.eclipse.jgit:org.eclipse.jgit:5.8.0.202006091008-r 13 | | | | +--- com.googlecode.javaewah:JavaEWAH:1.1.7 14 | | | | \--- org.slf4j:slf4j-api:1.7.2 -> 1.7.22 15 | | | +--- com.googlecode.concurrent-trees:concurrent-trees:2.6.1 16 | | | \--- org.codehaus.groovy:groovy-xml:3.0.3 17 | | | \--- org.codehaus.groovy:groovy:3.0.3 18 | | +--- com.diffplug.durian:durian-core:1.2.0 19 | | +--- com.diffplug.durian:durian-io:1.2.0 20 | | | +--- com.diffplug.durian:durian-core:1.2.0 21 | | | \--- com.diffplug.durian:durian-collect:1.2.0 (*) 22 | | +--- com.diffplug.durian:durian-collect:1.2.0 (*) 23 | | \--- org.eclipse.jgit:org.eclipse.jgit:5.8.0.202006091008-r (*) 24 | \--- com.autonomousapps:dependency-analysis-gradle-plugin:0.59.0 25 | +--- org.jetbrains.kotlin:kotlin-bom:1.3.72 -> 1.4.0 (*) 26 | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72 -> 1.4.10 (*) 27 | +--- com.squareup.moshi:moshi:1.9.2 -> 1.9.3 (*) 28 | +--- com.squareup.moshi:moshi-kotlin:1.9.2 29 | | +--- com.squareup.moshi:moshi:1.9.2 -> 1.9.3 (*) 30 | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.50 -> 1.4.10 (*) 31 | | \--- org.jetbrains.kotlin:kotlin-reflect:1.3.50 -> 1.4.10 (*) 32 | +--- org.jetbrains.kotlin:kotlin-reflect:1.3.72 -> 1.4.10 (*) 33 | \--- org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0 34 | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.31 -> 1.4.10 (*) 35 | 36 | -------------------------------------------------------------------------------- /src/test/fixtures/version-bump/old.txt: -------------------------------------------------------------------------------- 1 | > Task :example:compileKotlin UP-TO-DATE 2 | > Task :example:compileJava NO-SOURCE 3 | > Task :example:pluginDescriptors UP-TO-DATE 4 | > Task :example:processResources UP-TO-DATE 5 | > Task :example:classes UP-TO-DATE 6 | > Task :example:inspectClassesForKotlinIC UP-TO-DATE 7 | > Task :example:jar UP-TO-DATE 8 | 9 | > Configure project :app 10 | Random stdout output here! 11 | 12 | > Configure project :whatever:thing 13 | Kotlin Multiplatform Projects are an Alpha feature. 14 | 15 | > Task :app:dependencies 16 | 17 | ------------------------------------------------------------ 18 | Project :app 19 | ------------------------------------------------------------ 20 | 21 | productionReleaseRuntimeClasspath - Runtime classpath of compilation 'productionRelease' (target (androidJvm)). 22 | +--- com.google.dagger:dagger:2.28.1 23 | | \--- javax.inject:javax.inject:1 24 | +--- com.google.dagger:dagger-android:2.28.1 25 | | +--- com.google.dagger:dagger:2.28.1 (*) 26 | | +--- com.google.dagger:dagger-lint-aar:2.28.1 27 | | +--- androidx.annotation:annotation:1.1.0 28 | | \--- javax.inject:javax.inject:1 29 | +--- com.squareup.sqldelight:android-driver:1.4.0 30 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 31 | | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 32 | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 33 | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 34 | | +--- androidx.sqlite:sqlite:2.1.0 (*) 35 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 36 | | \--- androidx.sqlite:sqlite-framework:2.1.0 (*) 37 | +--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 38 | | +--- com.squareup.sqldelight:runtime:1.4.0 39 | | | \--- com.squareup.sqldelight:runtime-jvm:1.4.0 (*) 40 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 41 | | \--- io.reactivex.rxjava2:rxjava:2.2.5 -> 2.2.19 (*) 42 | \--- com.squareup.inject:inflation-inject:0.5.1 43 | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0 44 | +--- com.squareup.inject:assisted-inject-annotations:0.5.1 45 | \--- javax.inject:javax.inject:1 46 | 47 | (*) - dependencies omitted (listed previously) 48 | 49 | A web-based, searchable dependency report is available by adding the --scan option. 50 | 51 | BUILD SUCCESSFUL in 13s 52 | 1 actionable task: 1 executed 53 | -------------------------------------------------------------------------------- /src/test/fixtures/version-bump/new.txt: -------------------------------------------------------------------------------- 1 | > Task :example:compileKotlin UP-TO-DATE 2 | > Task :example:compileJava NO-SOURCE 3 | > Task :example:pluginDescriptors UP-TO-DATE 4 | > Task :example:processResources UP-TO-DATE 5 | > Task :example:classes UP-TO-DATE 6 | > Task :example:inspectClassesForKotlinIC UP-TO-DATE 7 | > Task :example:jar UP-TO-DATE 8 | 9 | > Configure project :app 10 | Random stdout output here! 11 | 12 | > Configure project :whatever:thing 13 | Kotlin Multiplatform Projects are an Alpha feature. 14 | 15 | > Task :app:dependencies 16 | 17 | ------------------------------------------------------------ 18 | Project :app 19 | ------------------------------------------------------------ 20 | 21 | productionReleaseRuntimeClasspath - Runtime classpath of compilation 'productionRelease' (target (androidJvm)). 22 | +--- com.google.dagger:dagger:2.28.1 23 | | \--- javax.inject:javax.inject:1 24 | +--- com.google.dagger:dagger-android:2.28.1 25 | | +--- com.google.dagger:dagger:2.28.1 (*) 26 | | +--- com.google.dagger:dagger-lint-aar:2.28.1 27 | | +--- androidx.annotation:annotation:1.1.0 28 | | \--- javax.inject:javax.inject:1 29 | +--- com.squareup.sqldelight:android-driver:1.4.0 30 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 31 | | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 32 | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*) 33 | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0 34 | | +--- androidx.sqlite:sqlite:2.1.0 (*) 35 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 36 | | \--- androidx.sqlite:sqlite-framework:2.1.0 (*) 37 | +--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 38 | | +--- com.squareup.sqldelight:runtime:1.4.0 39 | | | \--- com.squareup.sqldelight:runtime-jvm:1.4.0 (*) 40 | | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 41 | | \--- io.reactivex.rxjava2:rxjava:2.2.5 -> 2.2.19 (*) 42 | \--- com.squareup.inject:inflation-inject:0.5.1 43 | +--- androidx.annotation:annotation:1.0.0 -> 1.1.0 44 | +--- com.squareup.inject:assisted-inject-annotations:0.5.1 45 | \--- javax.inject:javax.inject:1 46 | 47 | (*) - dependencies omitted (listed previously) 48 | 49 | A web-based, searchable dependency report is available by adding the --scan option. 50 | 51 | BUILD SUCCESSFUL in 5s 52 | 1 actionable task: 1 executed 53 | -------------------------------------------------------------------------------- /src/test/fixtures/single/expected.txt: -------------------------------------------------------------------------------- 1 | \--- io.gitlab.arturbosch.detekt:detekt-cli:1.20.0 2 | +--- io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0 3 | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 4 | | \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20 5 | - | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 6 | - | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.6.20 7 | - | | \--- org.jetbrains:annotations:13.0 8 | + | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 -> 1.6.21 9 | + | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 10 | + | | \--- org.jetbrains:annotations:13.0 11 | | \--- org.jetbrains.kotlin:kotlin-reflect:1.6.20 12 | - | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 (*) 13 | + | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 -> 1.6.21 (*) 14 | \--- io.gitlab.arturbosch.detekt:detekt-core:1.20.0 15 | \--- io.gitlab.arturbosch.detekt:detekt-report-sarif:1.20.0 16 | \--- io.github.detekt.sarif4k:sarif4k:0.0.1 17 | +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0 18 | | \--- org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.1.0 19 | - | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.20 (*) 20 | + | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.21 (*) 21 | - | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.20 22 | + | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.21 23 | | \--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0 24 | | \--- org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.1.0 25 | - | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.20 (*) 26 | + | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.21 (*) 27 | - | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.20 28 | + | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.21 29 | - \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.31 -> 1.6.20 (*) 30 | + \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.31 -> 1.6.21 (*) 31 | +\--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 (*) 32 | -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | pull_request: {} 5 | push: 6 | branches: 7 | - 'trunk' 8 | tags: 9 | - '*' 10 | 11 | jobs: 12 | build: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v6 17 | - uses: actions/setup-java@v5 18 | with: 19 | distribution: 'zulu' 20 | java-version-file: .github/workflows/.java-version 21 | 22 | - uses: gradle/actions/setup-gradle@v5 23 | - run: ./gradlew build 24 | - run: build/dependency-tree-diff.jar --help 25 | 26 | - uses: actions/upload-artifact@v6 27 | with: 28 | name: dependency-tree-diff.jar 29 | path: build/dependency-tree-diff.jar 30 | if-no-files-found: error 31 | 32 | - name: Extract release notes 33 | id: release_notes 34 | if: startsWith(github.ref, 'refs/tags/') 35 | uses: ffurrer2/extract-release-notes@v3 36 | 37 | - name: Create Release 38 | if: startsWith(github.ref, 'refs/tags/') 39 | uses: softprops/action-gh-release@v2 40 | with: 41 | body: ${{ steps.release_notes.outputs.release_notes }} 42 | files: build/dependency-tree-diff.jar 43 | env: 44 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 45 | 46 | - name: Get version 47 | id: get_version 48 | if: startsWith(github.ref, 'refs/tags/') 49 | run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} 50 | 51 | - name: Set SHA 52 | id: shasum 53 | if: startsWith(github.ref, 'refs/tags/') 54 | run: echo ::set-output name=sha::"$(shasum -a 256 build/dependency-tree-diff.jar | awk '{printf $1}')" 55 | 56 | - name: Bump Brew 57 | if: startsWith(github.ref, 'refs/tags/') 58 | env: 59 | HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GH_HOMEBREW_TOKEN }} 60 | run: | 61 | git config --global user.email "41898282+github-actions@users.noreply.github.com" 62 | git config --global user.name "github-actions" 63 | # Update to ensure we have the latest version which supports arbitrary default branches. 64 | brew update 65 | brew tap JakeWharton/repo 66 | brew bump-formula-pr -f --version=${{ steps.get_version.outputs.version }} --no-browse --no-audit \ 67 | --sha256=${{ steps.shasum.outputs.sha }} \ 68 | --url="https://github.com/JakeWharton/dependency-tree-diff/releases/download/${{ steps.get_version.outputs.version }}/dependency-tree-diff.jar" \ 69 | JakeWharton/repo/dependency-tree-diff 70 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | 74 | 75 | @rem Execute Gradle 76 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 77 | 78 | :end 79 | @rem End local scope for the variables with windows NT shell 80 | if %ERRORLEVEL% equ 0 goto mainEnd 81 | 82 | :fail 83 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 84 | rem the _cmd.exe /c_ return code! 85 | set EXIT_CODE=%ERRORLEVEL% 86 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 87 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 88 | exit /b %EXIT_CODE% 89 | 90 | :mainEnd 91 | if "%OS%"=="Windows_NT" endlocal 92 | 93 | :omega 94 | -------------------------------------------------------------------------------- /src/main/kotlin/com/jakewharton/gradle/dependencies/treeDiff.kt: -------------------------------------------------------------------------------- 1 | @file:JvmName("DependencyTrees") 2 | 3 | package com.jakewharton.gradle.dependencies 4 | 5 | import java.util.ArrayDeque 6 | import java.util.regex.Pattern 7 | 8 | @JvmName("diff") 9 | fun dependencyTreeDiff(old: String, new: String): String { 10 | val oldPaths = findDependencyPaths(old) 11 | val newPaths = findDependencyPaths(new) 12 | 13 | val removedTree = buildTree(oldPaths - newPaths) 14 | val addedTree = buildTree(newPaths - oldPaths) 15 | 16 | return buildString { 17 | appendDiff(removedTree, addedTree, "") 18 | } 19 | } 20 | 21 | private val newlineRegex = Pattern.compile("(\r\n|\n|\r)") 22 | 23 | private fun findDependencyPaths(text: String): Set> { 24 | val dependencyLines = newlineRegex.split(text) 25 | .dropWhile { !it.startsWith("+--- ") && !it.startsWith("\\---") } 26 | .takeWhile { it.isNotEmpty() } 27 | 28 | val dependencyPaths = mutableSetOf>() 29 | val stack = ArrayDeque() 30 | for (dependencyLine in dependencyLines) { 31 | val coordinateStart = dependencyLine.indexOf("--- ") 32 | check(coordinateStart > 0) { 33 | "Unable to find coordinate delimiter: $dependencyLine" 34 | } 35 | val coordinates = dependencyLine.substring(coordinateStart + 4) 36 | 37 | val coordinateDepth = coordinateStart / 5 38 | if (stack.size > coordinateDepth) { 39 | // The stack is too large. Save the current branch and pop off leaves to match depth. 40 | dependencyPaths += stack.toList() 41 | for (i in coordinateDepth until stack.size) { 42 | stack.removeLast() 43 | } 44 | } 45 | 46 | stack.addLast(coordinates) 47 | } 48 | 49 | // The loop only commits a path when it sees the following dependency. Don't forget the last one! 50 | dependencyPaths += stack.toList() 51 | 52 | return dependencyPaths 53 | } 54 | 55 | private data class Node( 56 | val coordinate: String, 57 | val versionInfo: String, 58 | val children: MutableList, 59 | ) { 60 | override fun toString() = "$coordinate:$versionInfo" 61 | } 62 | 63 | private fun buildTree(paths: Iterable>): List { 64 | val rootNodes = mutableListOf() 65 | for (path in paths) { 66 | var nodes = rootNodes 67 | for (node in path) { 68 | val coordinate = node.substringBeforeLast(':') 69 | val versionInfo = node.substringAfterLast(':') 70 | 71 | val foundNode = 72 | nodes.singleOrNull { it.coordinate == coordinate && it.versionInfo == versionInfo } 73 | nodes = if (foundNode != null) { 74 | foundNode.children 75 | } else { 76 | val newNode = Node(coordinate, versionInfo, mutableListOf()) 77 | nodes.add(newNode) 78 | newNode.children 79 | } 80 | } 81 | } 82 | return rootNodes 83 | } 84 | 85 | private fun StringBuilder.appendDiff( 86 | oldTree: List, 87 | newTree: List, 88 | indent: String, 89 | ) { 90 | var oldIndex = 0 91 | var newIndex = 0 92 | while (oldIndex < oldTree.size && newIndex < newTree.size) { 93 | val oldNode = oldTree[oldIndex] 94 | val newNode = newTree[newIndex] 95 | when { 96 | oldNode.coordinate == newNode.coordinate -> { 97 | if (oldNode.versionInfo == newNode.versionInfo) { 98 | val last = oldIndex == oldTree.lastIndex && newIndex == oldTree.lastIndex 99 | val nextIndent = appendNode(' ', indent, oldNode, last) 100 | appendDiff(oldNode.children, newNode.children, nextIndent) 101 | } else { 102 | // Optimization for when transitive dependencies have not changed. We only display 103 | // the subtree when it contains changes. 104 | val childrenChanged = oldNode.children != newNode.children 105 | 106 | val nextIndent = appendNode('-', indent, oldNode, oldIndex == oldTree.lastIndex) 107 | if (childrenChanged) { 108 | appendDiff(oldNode.children, emptyList(), nextIndent) 109 | } 110 | appendNode('+', indent, newNode, newIndex == newTree.lastIndex) 111 | if (childrenChanged) { 112 | appendDiff(emptyList(), newNode.children, nextIndent) 113 | } 114 | } 115 | oldIndex++ 116 | newIndex++ 117 | } 118 | oldNode.coordinate < newNode.coordinate -> { 119 | appendRemoved(oldNode, indent, oldIndex == oldTree.lastIndex) 120 | oldIndex++ 121 | } 122 | oldNode.coordinate > newNode.coordinate -> { 123 | appendAdded(newNode, indent, newIndex == newTree.lastIndex) 124 | newIndex++ 125 | } 126 | } 127 | } 128 | for (i in oldIndex until oldTree.size) { 129 | appendRemoved(oldTree[i], indent, i == oldTree.lastIndex) 130 | } 131 | for (i in newIndex until newTree.size) { 132 | appendAdded(newTree[i], indent, i == newTree.lastIndex) 133 | } 134 | } 135 | 136 | private fun StringBuilder.appendNode( 137 | diffChar: Char, 138 | indent: String, 139 | item: Any?, 140 | last: Boolean, 141 | ): String { 142 | append(diffChar) 143 | append(indent) 144 | append(if (last) '\\' else '+') 145 | append("--- ") 146 | append(item) 147 | append('\n') 148 | val carryChar = if (last) ' ' else '|' 149 | return "$indent$carryChar " 150 | } 151 | 152 | private fun StringBuilder.appendAdded( 153 | node: Node, 154 | indent: String, 155 | last: Boolean, 156 | ) { 157 | val nextIndent = appendNode('+', indent, node, last) 158 | appendDiff(emptyList(), node.children, nextIndent) 159 | } 160 | 161 | private fun StringBuilder.appendRemoved( 162 | node: Node, 163 | indent: String, 164 | last: Boolean, 165 | ) { 166 | val nextIndent = appendNode('-', indent, node, last) 167 | appendDiff(node.children, emptyList(), nextIndent) 168 | } 169 | -------------------------------------------------------------------------------- /src/test/fixtures/single/old.txt: -------------------------------------------------------------------------------- 1 | Starting a Gradle Daemon (subsequent builds will be faster) 2 | > Task :buildSrc:compileKotlin UP-TO-DATE 3 | > Task :buildSrc:compileJava NO-SOURCE 4 | > Task :buildSrc:compileGroovy NO-SOURCE 5 | > Task :buildSrc:pluginDescriptors UP-TO-DATE 6 | > Task :buildSrc:processResources UP-TO-DATE 7 | > Task :buildSrc:classes UP-TO-DATE 8 | > Task :buildSrc:inspectClassesForKotlinIC UP-TO-DATE 9 | > Task :buildSrc:jar UP-TO-DATE 10 | > Task :buildSrc:assemble UP-TO-DATE 11 | > Task :buildSrc:detekt UP-TO-DATE 12 | > Task :buildSrc:compileTestKotlin NO-SOURCE 13 | > Task :buildSrc:pluginUnderTestMetadata UP-TO-DATE 14 | > Task :buildSrc:compileTestJava NO-SOURCE 15 | > Task :buildSrc:compileTestGroovy NO-SOURCE 16 | > Task :buildSrc:processTestResources NO-SOURCE 17 | > Task :buildSrc:testClasses UP-TO-DATE 18 | > Task :buildSrc:test NO-SOURCE 19 | > Task :buildSrc:validatePlugins UP-TO-DATE 20 | > Task :buildSrc:check UP-TO-DATE 21 | > Task :buildSrc:build UP-TO-DATE 22 | 23 | > Task :backend:endpoint:dependencies 24 | 25 | ------------------------------------------------------------ 26 | Project ':backend:endpoint' 27 | ------------------------------------------------------------ 28 | 29 | detekt - The detekt dependencies to be used for this project. 30 | \--- io.gitlab.arturbosch.detekt:detekt-cli:1.20.0 31 | +--- com.beust:jcommander:1.82 32 | +--- io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0 33 | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 34 | | +--- io.gitlab.arturbosch.detekt:detekt-utils:1.20.0 35 | | +--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20 36 | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 37 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.6.20 38 | | | | \--- org.jetbrains:annotations:13.0 39 | | | +--- org.jetbrains.kotlin:kotlin-script-runtime:1.6.20 40 | | | +--- org.jetbrains.kotlin:kotlin-reflect:1.6.20 41 | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 (*) 42 | | | +--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.6.20 43 | | | +--- org.jetbrains.intellij.deps:trove4j:1.0.20200330 44 | | | \--- net.java.dev.jna:jna:5.6.0 45 | | \--- io.gitlab.arturbosch.detekt:detekt-psi-utils:1.20.0 46 | | \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20 (*) 47 | +--- io.gitlab.arturbosch.detekt:detekt-parser:1.20.0 48 | | +--- io.gitlab.arturbosch.detekt:detekt-psi-utils:1.20.0 (*) 49 | | \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20 (*) 50 | +--- io.gitlab.arturbosch.detekt:detekt-core:1.20.0 51 | | +--- org.yaml:snakeyaml:1.30 52 | | +--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 53 | | +--- io.gitlab.arturbosch.detekt:detekt-metrics:1.20.0 54 | | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 55 | | +--- io.gitlab.arturbosch.detekt:detekt-parser:1.20.0 (*) 56 | | +--- io.gitlab.arturbosch.detekt:detekt-psi-utils:1.20.0 (*) 57 | | +--- io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0 (*) 58 | | +--- io.gitlab.arturbosch.detekt:detekt-report-html:1.20.0 59 | | | +--- io.gitlab.arturbosch.detekt:detekt-utils:1.20.0 60 | | | \--- org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.5 61 | | +--- io.gitlab.arturbosch.detekt:detekt-report-txt:1.20.0 62 | | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 63 | | +--- io.gitlab.arturbosch.detekt:detekt-report-xml:1.20.0 64 | | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 65 | | +--- io.gitlab.arturbosch.detekt:detekt-report-sarif:1.20.0 66 | | | \--- io.github.detekt.sarif4k:sarif4k:0.0.1 67 | | | +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0 68 | | | | \--- org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.1.0 69 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.20 (*) 70 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.20 71 | | | | \--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0 72 | | | | \--- org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.1.0 73 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.20 (*) 74 | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.20 75 | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.31 -> 1.6.20 (*) 76 | | \--- io.gitlab.arturbosch.detekt:detekt-utils:1.20.0 77 | \--- io.gitlab.arturbosch.detekt:detekt-rules:1.20.0 78 | +--- io.gitlab.arturbosch.detekt:detekt-rules-complexity:1.20.0 79 | +--- io.gitlab.arturbosch.detekt:detekt-rules-coroutines:1.20.0 80 | +--- io.gitlab.arturbosch.detekt:detekt-rules-documentation:1.20.0 81 | +--- io.gitlab.arturbosch.detekt:detekt-rules-empty:1.20.0 82 | +--- io.gitlab.arturbosch.detekt:detekt-rules-errorprone:1.20.0 83 | | \--- io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0 (*) 84 | +--- io.gitlab.arturbosch.detekt:detekt-rules-exceptions:1.20.0 85 | +--- io.gitlab.arturbosch.detekt:detekt-rules-naming:1.20.0 86 | +--- io.gitlab.arturbosch.detekt:detekt-rules-performance:1.20.0 87 | \--- io.gitlab.arturbosch.detekt:detekt-rules-style:1.20.0 88 | 89 | (*) - dependencies omitted (listed previously) 90 | 91 | A web-based, searchable dependency report is available by adding the --scan option. 92 | 93 | BUILD SUCCESSFUL in 11s 94 | 9 actionable tasks: 1 executed, 8 up-to-date 95 | -------------------------------------------------------------------------------- /src/test/fixtures/single/new.txt: -------------------------------------------------------------------------------- 1 | > Task :buildSrc:compileKotlin UP-TO-DATE 2 | > Task :buildSrc:compileJava NO-SOURCE 3 | > Task :buildSrc:compileGroovy NO-SOURCE 4 | > Task :buildSrc:pluginDescriptors UP-TO-DATE 5 | > Task :buildSrc:processResources UP-TO-DATE 6 | > Task :buildSrc:classes UP-TO-DATE 7 | > Task :buildSrc:inspectClassesForKotlinIC UP-TO-DATE 8 | > Task :buildSrc:jar UP-TO-DATE 9 | > Task :buildSrc:assemble UP-TO-DATE 10 | > Task :buildSrc:detekt UP-TO-DATE 11 | > Task :buildSrc:compileTestKotlin NO-SOURCE 12 | > Task :buildSrc:pluginUnderTestMetadata UP-TO-DATE 13 | > Task :buildSrc:compileTestJava NO-SOURCE 14 | > Task :buildSrc:compileTestGroovy NO-SOURCE 15 | > Task :buildSrc:processTestResources NO-SOURCE 16 | > Task :buildSrc:testClasses UP-TO-DATE 17 | > Task :buildSrc:test NO-SOURCE 18 | > Task :buildSrc:validatePlugins UP-TO-DATE 19 | > Task :buildSrc:check UP-TO-DATE 20 | > Task :buildSrc:build UP-TO-DATE 21 | 22 | > Task :backend:endpoint:dependencies 23 | 24 | ------------------------------------------------------------ 25 | Project ':backend:endpoint' 26 | ------------------------------------------------------------ 27 | 28 | detekt - The detekt dependencies to be used for this project. 29 | +--- io.gitlab.arturbosch.detekt:detekt-cli:1.20.0 30 | | +--- com.beust:jcommander:1.82 31 | | +--- io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0 32 | | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 33 | | | +--- io.gitlab.arturbosch.detekt:detekt-utils:1.20.0 34 | | | +--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20 35 | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 -> 1.6.21 36 | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.6.21 37 | | | | | \--- org.jetbrains:annotations:13.0 38 | | | | +--- org.jetbrains.kotlin:kotlin-script-runtime:1.6.20 39 | | | | +--- org.jetbrains.kotlin:kotlin-reflect:1.6.20 40 | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.20 -> 1.6.21 (*) 41 | | | | +--- org.jetbrains.kotlin:kotlin-daemon-embeddable:1.6.20 42 | | | | +--- org.jetbrains.intellij.deps:trove4j:1.0.20200330 43 | | | | \--- net.java.dev.jna:jna:5.6.0 44 | | | \--- io.gitlab.arturbosch.detekt:detekt-psi-utils:1.20.0 45 | | | \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20 (*) 46 | | +--- io.gitlab.arturbosch.detekt:detekt-parser:1.20.0 47 | | | +--- io.gitlab.arturbosch.detekt:detekt-psi-utils:1.20.0 (*) 48 | | | \--- org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.20 (*) 49 | | +--- io.gitlab.arturbosch.detekt:detekt-core:1.20.0 50 | | | +--- org.yaml:snakeyaml:1.30 51 | | | +--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 52 | | | +--- io.gitlab.arturbosch.detekt:detekt-metrics:1.20.0 53 | | | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 54 | | | +--- io.gitlab.arturbosch.detekt:detekt-parser:1.20.0 (*) 55 | | | +--- io.gitlab.arturbosch.detekt:detekt-psi-utils:1.20.0 (*) 56 | | | +--- io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0 (*) 57 | | | +--- io.gitlab.arturbosch.detekt:detekt-report-html:1.20.0 58 | | | | +--- io.gitlab.arturbosch.detekt:detekt-utils:1.20.0 59 | | | | \--- org.jetbrains.kotlinx:kotlinx-html-jvm:0.7.5 60 | | | +--- io.gitlab.arturbosch.detekt:detekt-report-txt:1.20.0 61 | | | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 62 | | | +--- io.gitlab.arturbosch.detekt:detekt-report-xml:1.20.0 63 | | | | \--- io.gitlab.arturbosch.detekt:detekt-api:1.20.0 (*) 64 | | | +--- io.gitlab.arturbosch.detekt:detekt-report-sarif:1.20.0 65 | | | | \--- io.github.detekt.sarif4k:sarif4k:0.0.1 66 | | | | +--- org.jetbrains.kotlinx:kotlinx-serialization-json:1.1.0 67 | | | | | \--- org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.1.0 68 | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.21 (*) 69 | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.21 70 | | | | | \--- org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0 71 | | | | | \--- org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.1.0 72 | | | | | +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.30 -> 1.6.21 (*) 73 | | | | | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.4.30 -> 1.6.21 74 | | | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.31 -> 1.6.21 (*) 75 | | | \--- io.gitlab.arturbosch.detekt:detekt-utils:1.20.0 76 | | \--- io.gitlab.arturbosch.detekt:detekt-rules:1.20.0 77 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-complexity:1.20.0 78 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-coroutines:1.20.0 79 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-documentation:1.20.0 80 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-empty:1.20.0 81 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-errorprone:1.20.0 82 | | | \--- io.gitlab.arturbosch.detekt:detekt-tooling:1.20.0 (*) 83 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-exceptions:1.20.0 84 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-naming:1.20.0 85 | | +--- io.gitlab.arturbosch.detekt:detekt-rules-performance:1.20.0 86 | | \--- io.gitlab.arturbosch.detekt:detekt-rules-style:1.20.0 87 | \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.21 (*) 88 | 89 | (*) - dependencies omitted (listed previously) 90 | 91 | A web-based, searchable dependency report is available by adding the --scan option. 92 | 93 | BUILD SUCCESSFUL in 3s 94 | 9 actionable tasks: 1 executed, 8 up-to-date 95 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dependency Tree Diff 2 | 3 | An intelligent diff tool for the output of Gradle's `dependencies` task which always shows 4 | the path to the root dependency. 5 | 6 | ```diff 7 | +--- com.squareup.sqldelight:android-driver:1.4.0 8 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 9 | -| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 10 | -| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 11 | +| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 12 | +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*) 13 | -| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 14 | +| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0 15 | -| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 16 | +| \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 17 | \--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 18 | - \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 19 | + \--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 20 | ``` 21 | 22 | Unlike a normal `diff`, unchanged entries are displayed only when they are a parent dependency 23 | to one that changed. 24 | 25 | Compare the above diff to `diff -U 0`: 26 | 27 | ```diff 28 | @@ -31,3 +31,3 @@ 29 | -| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 30 | -| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 31 | -| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 32 | +| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 33 | +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*) 34 | +| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0 35 | @@ -35 +35 @@ 36 | -| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 37 | +| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 38 | @@ -40 +40 @@ 39 | -| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 40 | +| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 41 | @@ -51 +51 @@ 42 | ``` 43 | 44 | Note how there is no context as to what is affected. 45 | 46 | In this particular sample we can reach the root dependencies with `diff -U 2`: 47 | 48 | ```diff 49 | @@ -29,14 +29,14 @@ 50 | +--- com.squareup.sqldelight:android-driver:1.4.0 51 | | +--- com.squareup.sqldelight:runtime-jvm:1.4.0 52 | -| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 53 | -| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 (*) 54 | -| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 55 | +| | +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 56 | +| | | \--- org.jetbrains.kotlin:kotlin-stdlib:1.4.0 (*) 57 | +| | \--- org.jetbrains.kotlin:kotlin-stdlib-common:1.3.72 -> 1.4.0 58 | | +--- androidx.sqlite:sqlite:2.1.0 (*) 59 | -| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 60 | +| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 61 | | \--- androidx.sqlite:sqlite-framework:2.1.0 (*) 62 | +--- com.squareup.sqldelight:rxjava2-extensions:1.4.0 63 | | +--- com.squareup.sqldelight:runtime:1.4.0 64 | | | \--- com.squareup.sqldelight:runtime-jvm:1.4.0 (*) 65 | -| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 (*) 66 | +| +--- org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72 -> 1.4.0 (*) 67 | | \--- io.reactivex.rxjava2:rxjava:2.2.5 -> 2.2.19 (*) 68 | \--- com.squareup.inject:inflation-inject:0.5.1 69 | @@ -49,4 +49,4 @@ 70 | ``` 71 | 72 | Now, however, additional unchanged dependencies are displayed such as `androidx.sqlite` and the 73 | SQLDelight runtime dependency by the RxJava 2 extensions artifact. 74 | 75 | For deep dependency chains, `-U 2` will not be enough to see all the roots. Increasing the value 76 | will only show more unchanged dependencies. `dependency-tree-diff` will always display the 77 | minimal subset needed to provide context. 78 | 79 | For more information about why a diff of the dependency tree is useful see 80 | ["Surfacing Hidden Change to Pull Requests"](https://developer.squareup.com/blog/surfacing-hidden-change-to-pull-requests/). 81 | To learn about how code shrinking keeps the binary as small as possible see 82 | ["Shrinking a Kotlin binary by 99.2%"](https://jakewharton.com/shrinking-a-kotlin-binary/). 83 | 84 | 85 | ## Usage 86 | 87 | The tool parses the output of Gradle's `dependencies` task. Specify `--configuration ` when 88 | running the task so that only a single tree will be shown. 89 | 90 | ``` 91 | $ ./gradlew :app:dependencies --configuration releaseRuntimeClasspath > old.txt 92 | $ # Update a dependency... 93 | $ ./gradlew :app:dependencies --configuration releaseRuntimeClasspath > new.txt 94 | $ ./dependency-tree-diff.jar old.txt new.txt 95 | ``` 96 | 97 | See `src/test/fixtures/` for example outputs and their expected diffs. 98 | 99 | ## Install 100 | 101 | **Mac OS** 102 | 103 | ``` 104 | $ brew install JakeWharton/repo/dependency-tree-diff 105 | ``` 106 | 107 | **Other** 108 | 109 | Download standalone JAR from 110 | [latest release](https://github.com/JakeWharton/dependency-tree-diff/releases/latest). 111 | On Linux and macOS you can `chmod +x` and execute the `.jar` directly. 112 | On Windows use `java -jar`. 113 | 114 | 115 | ## License 116 | 117 | Copyright 2020 Jake Wharton 118 | 119 | Licensed under the Apache License, Version 2.0 (the "License"); 120 | you may not use this file except in compliance with the License. 121 | You may obtain a copy of the License at 122 | 123 | http://www.apache.org/licenses/LICENSE-2.0 124 | 125 | Unless required by applicable law or agreed to in writing, software 126 | distributed under the License is distributed on an "AS IS" BASIS, 127 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 128 | See the License for the specific language governing permissions and 129 | limitations under the License. 130 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | 118 | 119 | # Determine the Java command to use to start the JVM. 120 | if [ -n "$JAVA_HOME" ] ; then 121 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 122 | # IBM's JDK on AIX uses strange locations for the executables 123 | JAVACMD=$JAVA_HOME/jre/sh/java 124 | else 125 | JAVACMD=$JAVA_HOME/bin/java 126 | fi 127 | if [ ! -x "$JAVACMD" ] ; then 128 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 129 | 130 | Please set the JAVA_HOME variable in your environment to match the 131 | location of your Java installation." 132 | fi 133 | else 134 | JAVACMD=java 135 | if ! command -v java >/dev/null 2>&1 136 | then 137 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 138 | 139 | Please set the JAVA_HOME variable in your environment to match the 140 | location of your Java installation." 141 | fi 142 | fi 143 | 144 | # Increase the maximum file descriptors if we can. 145 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 146 | case $MAX_FD in #( 147 | max*) 148 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 149 | # shellcheck disable=SC2039,SC3045 150 | MAX_FD=$( ulimit -H -n ) || 151 | warn "Could not query maximum file descriptor limit" 152 | esac 153 | case $MAX_FD in #( 154 | '' | soft) :;; #( 155 | *) 156 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 157 | # shellcheck disable=SC2039,SC3045 158 | ulimit -n "$MAX_FD" || 159 | warn "Could not set maximum file descriptor limit to $MAX_FD" 160 | esac 161 | fi 162 | 163 | # Collect all arguments for the java command, stacking in reverse order: 164 | # * args from the command line 165 | # * the main class name 166 | # * -classpath 167 | # * -D...appname settings 168 | # * --module-path (only if needed) 169 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 170 | 171 | # For Cygwin or MSYS, switch paths to Windows format before running java 172 | if "$cygwin" || "$msys" ; then 173 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 174 | 175 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 176 | 177 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 178 | for arg do 179 | if 180 | case $arg in #( 181 | -*) false ;; # don't mess with options #( 182 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 183 | [ -e "$t" ] ;; #( 184 | *) false ;; 185 | esac 186 | then 187 | arg=$( cygpath --path --ignore --mixed "$arg" ) 188 | fi 189 | # Roll the args list around exactly as many times as the number of 190 | # args, so each arg winds up back in the position where it started, but 191 | # possibly modified. 192 | # 193 | # NB: a `for` loop captures its iteration list before it begins, so 194 | # changing the positional parameters here affects neither the number of 195 | # iterations, nor the values presented in `arg`. 196 | shift # remove old arg 197 | set -- "$@" "$arg" # push replacement arg 198 | done 199 | fi 200 | 201 | 202 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 203 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 204 | 205 | # Collect all arguments for the java command: 206 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 207 | # and any embedded shellness will be escaped. 208 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 209 | # treated as '${Hostname}' itself on the command line. 210 | 211 | set -- \ 212 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 213 | -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ 214 | "$@" 215 | 216 | # Stop when "xargs" is not available. 217 | if ! command -v xargs >/dev/null 2>&1 218 | then 219 | die "xargs is not available" 220 | fi 221 | 222 | # Use "xargs" to parse quoted args. 223 | # 224 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 225 | # 226 | # In Bash we could simply go: 227 | # 228 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 229 | # set -- "${ARGS[@]}" "$@" 230 | # 231 | # but POSIX shell has neither arrays nor command substitution, so instead we 232 | # post-process each arg (as a line of input to sed) to backslash-escape any 233 | # character that might be a shell metacharacter, then use eval to reverse 234 | # that process (while maintaining the separation between arguments), and wrap 235 | # the whole thing up as a single "set" statement. 236 | # 237 | # This will of course break if any of these variables contains a newline or 238 | # an unmatched quote. 239 | # 240 | 241 | eval "set -- $( 242 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 243 | xargs -n1 | 244 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 245 | tr '\n' ' ' 246 | )" '"$@"' 247 | 248 | exec "$JAVACMD" "$@" 249 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------