├── .editorconfig ├── .github ├── renovate.json └── workflows │ └── main.yml ├── .gitignore ├── LICENSE ├── Readme.md ├── action.yml ├── entrypoint.ps1 ├── entrypoint.sh └── testproject ├── .gitattributes ├── .gitignore ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{kt,kts}] 4 | max_line_length = 140 5 | indent_size = 4 6 | insert_final_newline = true 7 | ij_kotlin_allow_trailing_comma = true 8 | ij_kotlin_allow_trailing_comma_on_call_site = true 9 | ktlint_code_style = intellij_idea 10 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://docs.renovatebot.com/renovate-schema.json", 3 | "assignees": [ 4 | "mateuszkwiecinski" 5 | ], 6 | "extends": [ 7 | "config:recommended" 8 | ], 9 | "packageRules": [ 10 | { 11 | "matchUpdateTypes": [ 12 | "minor", 13 | "patch", 14 | "pin", 15 | "digest" 16 | ], 17 | "automerge": true 18 | } 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | on: 2 | pull_request: 3 | push: 4 | branches: 5 | - master 6 | 7 | concurrency: 8 | group: ${{ github.workflow }}-${{ github.ref }} 9 | cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} 10 | 11 | jobs: 12 | test-job: 13 | runs-on: ubuntu-latest 14 | name: Run dependency diff action 15 | steps: 16 | - uses: actions/checkout@v4 17 | with: 18 | fetch-depth: 0 19 | 20 | - uses: actions/setup-java@v4 21 | with: 22 | distribution: 'temurin' 23 | java-version: 23 24 | 25 | - name: Downgrade dependency version to see the diff 26 | run: sed -i -E 's/androidx.paging:paging-common-ktx:[[:digit:]]+.[[:digit:]]+.[[:digit:]]+/androidx.paging:paging-common-ktx:3.2.0/g' testproject/build.gradle 27 | 28 | - uses: gradle/actions/setup-gradle@v4 29 | 30 | - id: dependency-diff 31 | if: github.event_name == 'pull_request' 32 | uses: ./ 33 | with: 34 | configuration: runtimeClasspath 35 | build-root-directory: testproject 36 | project: "" 37 | debug: true 38 | 39 | - uses: actions/upload-artifact@v4 40 | if: github.event_name == 'pull_request' 41 | with: 42 | name: file-diff-test-1-output 43 | path: ${{ steps.dependency-diff.outputs.file-diff }} 44 | if-no-files-found: error 45 | 46 | - uses: actions/upload-artifact@v4 47 | if: github.event_name == 'pull_request' 48 | with: 49 | name: file-diff-test-1-dependencies-base 50 | path: ${{ steps.dependency-diff.outputs.file-dependencies-base }} 51 | if-no-files-found: error 52 | 53 | - uses: actions/upload-artifact@v4 54 | if: github.event_name == 'pull_request' 55 | with: 56 | name: file-diff-test-1-dependencies-head 57 | path: ${{ steps.dependency-diff.outputs.file-dependencies-head }} 58 | if-no-files-found: error 59 | 60 | - uses: peter-evans/find-comment@v3 61 | id: find_comment 62 | if: github.event_name == 'pull_request' 63 | with: 64 | issue-number: ${{ github.event.pull_request.number }} 65 | body-includes: Test1 66 | 67 | - uses: peter-evans/create-or-update-comment@v4 68 | if: ${{ steps.dependency-diff.outputs.text-diff != null || steps.find_comment.outputs.comment-id != null }} 69 | with: 70 | body: | 71 | Test1 72 | ```diff 73 | ${{ steps.dependency-diff.outputs.text-diff }} 74 | ``` 75 | 76 | output path: `${{ steps.dependency-diff.outputs.file-diff }}` 77 | base dependencies: `${{ steps.dependency-diff.outputs.file-dependencies-base }}` 78 | head dependencies: `${{ steps.dependency-diff.outputs.file-dependencies-head }}` 79 | edit-mode: replace 80 | comment-id: ${{ steps.find_comment.outputs.comment-id }} 81 | issue-number: ${{ github.event.pull_request.number }} 82 | token: ${{ secrets.GITHUB_TOKEN }} 83 | 84 | test-job-with-configuration-cache: 85 | runs-on: ubuntu-latest 86 | name: Test additional arguments 87 | steps: 88 | - uses: actions/checkout@v4 89 | with: 90 | fetch-depth: 0 91 | 92 | - uses: actions/setup-java@v4 93 | with: 94 | distribution: 'temurin' 95 | java-version: 23 96 | 97 | - name: Downgrade dependency version to see the diff 98 | run: sed -i -E 's/androidx.paging:paging-common-ktx:[[:digit:]]+.[[:digit:]]+.[[:digit:]]+/androidx.paging:paging-common-ktx:3.2.0/g' testproject/build.gradle 99 | 100 | - run: | 101 | mkdir -p ~/.gradle 102 | printf "org.gradle.unsafe.configuration-cache=true" > ~/.gradle/gradle.properties 103 | shell: bash 104 | 105 | - uses: gradle/actions/setup-gradle@v4 106 | 107 | - id: dependency-diff 108 | uses: ./ 109 | if: github.event_name == 'pull_request' 110 | with: 111 | configuration: runtimeClasspath 112 | lib-version: "1.2.1" 113 | build-root-directory: testproject 114 | additional-gradle-arguments: "--no-configuration-cache --stacktrace" 115 | project: "" 116 | 117 | - uses: actions/upload-artifact@v4 118 | if: github.event_name == 'pull_request' 119 | with: 120 | name: file-diff-test-2 121 | path: ${{ steps.dependency-diff.outputs.file-diff }} 122 | if-no-files-found: error 123 | 124 | - uses: peter-evans/find-comment@v3 125 | id: find_comment 126 | if: github.event_name == 'pull_request' 127 | with: 128 | issue-number: ${{ github.event.pull_request.number }} 129 | body-includes: Test2 130 | 131 | - uses: peter-evans/create-or-update-comment@v4 132 | if: ${{ steps.dependency-diff.outputs.text-diff != null || steps.find_comment.outputs.comment-id != null }} 133 | with: 134 | body: | 135 | Test2 136 | ```diff 137 | ${{ steps.dependency-diff.outputs.text-diff }} 138 | ``` 139 | edit-mode: replace 140 | comment-id: ${{ steps.find_comment.outputs.comment-id }} 141 | issue-number: ${{ github.event.pull_request.number }} 142 | token: ${{ secrets.GITHUB_TOKEN }} 143 | 144 | test-on-different-os: 145 | strategy: 146 | fail-fast: false 147 | matrix: 148 | os: [ macos-latest, windows-latest, ubuntu-latest] 149 | runs-on: ${{ matrix.os }} 150 | name: Execute on ${{ matrix.os }} runner 151 | steps: 152 | - uses: actions/checkout@v4 153 | with: 154 | fetch-depth: 0 155 | 156 | - uses: actions/setup-java@v4 157 | with: 158 | distribution: 'temurin' 159 | java-version: 23 160 | 161 | - name: Downgrade dependency version to see the diff (Unix) 162 | if: runner.os != 'Windows' && runner.os != 'macOS' 163 | run: sed -i -E 's/androidx.paging:paging-common-ktx:[[:digit:]]+.[[:digit:]]+.[[:digit:]]+/androidx.paging:paging-common-ktx:3.2.0/g' testproject/build.gradle 164 | 165 | - name: Downgrade dependency version to see the diff (macOS) 166 | if: runner.os == 'macOS' 167 | run: sed -i '' -E 's/androidx.paging:paging-common-ktx:[[:digit:]]+.[[:digit:]]+.[[:digit:]]+/androidx.paging:paging-common-ktx:3.2.0/g' testproject/build.gradle 168 | 169 | - name: Downgrade dependency version to see the diff (Windows) 170 | if: runner.os == 'Windows' 171 | run: | 172 | (Get-Content testproject/build.gradle) -replace 'androidx\.paging:paging-common-ktx:\d+\.\d+\.\d+', 'androidx.paging:paging-common-ktx:3.2.0' | Set-Content testproject/build.gradle 173 | shell: pwsh 174 | 175 | - uses: gradle/actions/setup-gradle@v4 176 | 177 | - run: ./gradlew dependencies 178 | working-directory: testproject 179 | 180 | - id: dependency-diff 181 | uses: ./ 182 | if: github.event_name == 'pull_request' 183 | with: 184 | configuration: runtimeClasspath 185 | build-root-directory: testproject 186 | project: "" 187 | debug: true 188 | additional-gradle-arguments: "--scan" 189 | 190 | - uses: actions/upload-artifact@v4 191 | if: github.event_name == 'pull_request' 192 | with: 193 | name: file-diff-test-on-${{ matrix.os }} 194 | path: ${{ steps.dependency-diff.outputs.file-diff }} 195 | if-no-files-found: error 196 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .kotlin 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright 2020 Mateusz Kwieciński 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # Dependency Tree Diff - GitHub Action 2 | 3 | ![.github/workflows/main.yml](https://github.com/usefulness/dependency-tree-diff-action/workflows/.github/workflows/main.yml/badge.svg) 4 | 5 | Simple GitHub Action wrapper for Jake Wharton's [Dependency Tree Diff](https://github.com/JakeWharton/dependency-tree-diff) tool. 6 | 7 | ## Usage 8 | The action only exposes _output_ containing the diff, so to effectively consume its output, it is highly recommended to use other GitHub Actions to customize your experience. 9 | 10 | #### Create Pull Request comment on dependency change 11 | [See it in action!](https://github.com/mateuszkwiecinski/github_browser/pull/31) 12 | Create `.github/workflows/dependency_diff.yml` 13 | 14 | ```yml 15 | name: Generate dependency diff 16 | 17 | on: 18 | pull_request: 19 | 20 | jobs: 21 | generate-diff: 22 | runs-on: ubuntu-latest 23 | 24 | steps: 25 | - uses: actions/checkout@v4 26 | 27 | - uses: actions/setup-java@v4 28 | with: 29 | distribution: 'temurin' 30 | java-version: 23 31 | 32 | - uses: gradle/actions/setup-gradle@v4 33 | 34 | - id: dependency-diff 35 | name: Generate dependency diff 36 | uses: usefulness/dependency-tree-diff-action@v2 37 | 38 | - uses: peter-evans/find-comment@v3 39 | id: find_comment 40 | with: 41 | issue-number: ${{ github.event.pull_request.number }} 42 | body-includes: Dependency diff 43 | 44 | - uses: peter-evans/create-or-update-comment@v4 45 | if: ${{ steps.dependency-diff.outputs.text-diff != null || steps.find_comment.outputs.comment-id != null }} 46 | with: 47 | body: | 48 | Dependency diff (customize your message here): 49 | ```diff 50 | ${{ steps.dependency-diff.outputs.text-diff }} 51 | ``` 52 | edit-mode: replace 53 | comment-id: ${{ steps.find_comment.outputs.comment-id }} 54 | issue-number: ${{ github.event.pull_request.number }} 55 | token: ${{ secrets.GITHUB_TOKEN }} 56 | ``` 57 | 58 | ## Customization 59 | All inputs with their default values: 60 | ```yml 61 | - id: dependency-diff 62 | uses: usefulness/dependency-tree-diff-action@v2 63 | with: 64 | configuration: 'releaseRuntimeClasspath' 65 | project: 'app' 66 | build-root-directory: . 67 | additional-gradle-arguments: '' 68 | lib-version: 'latest' 69 | ``` 70 | 71 | - **`configuration`** - Selected Gradle configuration, passed to `./gradlew dependencies --configuration xxx`. 72 | It should correspond to output artifact considered output of the project. 73 | - **`project`** - Gradle project which dependency tree diff should be generated for. 74 | Dependency diff for root projects can be configured using `project: ''`. 75 | For Android projects use the one that has `com.android.application` plugin applied. 76 | - **`build-root-directory`** - Relative path to folder containing gradle wrapper. 77 | Example usage: `build-root-directory: library` 78 | - **`additional-gradle-arguments`** - Additional arguments passed to internal Gradle invocation. Example: `"--no-configuration-cache"` or `"--stacktrace"` 79 | - **`lib-version`** - Overrides [dependency-tree-diff](https://github.com/JakeWharton/dependency-tree-diff) dependency version. Example: `"1.2.1"`, `"1.1.0"`, `"latest"` 80 | 81 |
82 |

83 | 84 | 🙏 Praise 🙏 be 🙏 to 🙏 Wharton 🙏 85 | 86 |

87 |
88 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Dependency tree diff for Gradle' 2 | description: "Generates human readable dependency diff between 2 commits, using Jake Wharton's dependency-tree-diff tool" 3 | inputs: 4 | configuration: 5 | description: 'Selected Gradle configuration, passed to `./gradlew dependencies --configuration xxx`. Should correspond to output artifact that is considered output of the project' 6 | required: true 7 | default: 'releaseRuntimeClasspath' 8 | project: 9 | description: 'Project' 10 | required: true 11 | default: 'app' 12 | build-root-directory: 13 | description: 'Build root directory' 14 | required: false 15 | default: '.' 16 | lib-version: 17 | description: 'Dependency diff library version' 18 | required: true 19 | default: 'latest' 20 | additional-gradle-arguments: 21 | description: 'Additional arguments passed to gradle commands' 22 | required: false 23 | default: '' 24 | debug: 25 | description: 'Enable debug logs' 26 | required: false 27 | default: 'false' 28 | outputs: 29 | text-diff: 30 | description: "Dependency diff" 31 | value: ${{ steps.diff-generator-unix.outputs.text-diff || steps.diff-generator-windows.outputs.text-diff }} 32 | file-diff: 33 | description: "Path to a file containing the raw diff output" 34 | value: ${{ steps.diff-generator-unix.outputs.file-diff || steps.diff-generator-windows.outputs.file-diff }} 35 | file-dependencies-head: 36 | description: "Path to a file containing dependencies dump from currently checked out ref" 37 | value: ${{ steps.diff-generator-unix.outputs.file-dependencies-head || steps.diff-generator-windows.outputs.file-dependencies-head }} 38 | file-dependencies-base: 39 | description: "Path to a file containing dependencies dump from `github.base_ref`" 40 | value: ${{ steps.diff-generator-unix.outputs.file-dependencies-base || steps.diff-generator-windows.outputs.file-dependencies-base }} 41 | branding: 42 | color: 'red' 43 | icon: 'check-square' 44 | runs: 45 | using: 'composite' 46 | steps: 47 | - id: diff-generator-unix 48 | if: runner.os != 'Windows' 49 | env: 50 | INPUT_PROJECT: ${{ inputs.project }} 51 | INPUT_CONFIGURATION: ${{ inputs.configuration }} 52 | INPUT_BASEREF: ${{ github.base_ref }} 53 | INPUT_BUILD_ROOT_DIR: ${{ inputs.build-root-directory }} 54 | INPUT_VERSION: ${{ inputs.lib-version }} 55 | INPUT_ADDITIONAL_GRADLE_ARGUMENTS: ${{ inputs.additional-gradle-arguments }} 56 | INPUT_DEBUG: ${{ inputs.debug }} 57 | GITHUB_TOKEN: ${{ github.token }} 58 | run: $GITHUB_ACTION_PATH/entrypoint.sh 59 | shell: bash 60 | 61 | - id: diff-generator-windows 62 | if: runner.os == 'Windows' 63 | env: 64 | INPUT_PROJECT: ${{ inputs.project }} 65 | INPUT_CONFIGURATION: ${{ inputs.configuration }} 66 | INPUT_BASEREF: ${{ github.base_ref }} 67 | INPUT_BUILD_ROOT_DIR: ${{ inputs.build-root-directory }} 68 | INPUT_VERSION: ${{ inputs.lib-version }} 69 | INPUT_ADDITIONAL_GRADLE_ARGUMENTS: ${{ inputs.additional-gradle-arguments }} 70 | INPUT_DEBUG: ${{ inputs.debug }} 71 | GITHUB_TOKEN: ${{ github.token }} 72 | run: "& \"$env:GITHUB_ACTION_PATH/entrypoint.ps1\"" 73 | shell: pwsh 74 | -------------------------------------------------------------------------------- /entrypoint.ps1: -------------------------------------------------------------------------------- 1 | param( 2 | [string]$InputProject = $env:INPUT_PROJECT, 3 | [string]$InputConfiguration = $env:INPUT_CONFIGURATION, 4 | [string]$InputBaseRef = $env:INPUT_BASEREF, 5 | [string]$InputBuildRootDir = $env:INPUT_BUILD_ROOT_DIR, 6 | [string]$InputVersion = $env:INPUT_VERSION, 7 | [string]$InputAdditionalGradleArguments = $env:INPUT_ADDITIONAL_GRADLE_ARGUMENTS, 8 | [string]$InputDebug = $env:INPUT_DEBUG, 9 | [string]$GithubToken = $env:GITHUB_TOKEN 10 | ) 11 | 12 | $ErrorActionPreference = "Stop" 13 | 14 | Set-Location $InputBuildRootDir 15 | 16 | $headers = @{ 17 | Authorization = "Bearer $GithubToken" 18 | } 19 | 20 | if ($InputVersion -eq "latest") { 21 | $latestRelease = Invoke-RestMethod -Uri "https://api.github.com/repos/JakeWharton/dependency-tree-diff/releases/latest" -Headers $headers 22 | $downloadUrl = $latestRelease.assets | Where-Object { $_.name -eq "dependency-tree-diff.jar" } | Select-Object -ExpandProperty browser_download_url 23 | Invoke-WebRequest -Uri $downloadUrl -Headers $headers -OutFile "dependency-tree-diff.jar" 24 | } else { 25 | $downloadUrl = "https://github.com/JakeWharton/dependency-tree-diff/releases/download/$InputVersion/dependency-tree-diff.jar" 26 | Invoke-WebRequest -Uri $downloadUrl -Headers $headers -OutFile "dependency-tree-diff.jar" 27 | } 28 | 29 | if ($InputProject -eq ":") { 30 | $InputProject = "" 31 | } 32 | 33 | if ($InputDebug -eq "true") { 34 | Write-Host "download finished" 35 | Write-Host "JAVA_HOME: $env:JAVA_HOME" 36 | java -version 37 | Get-Location 38 | } 39 | 40 | $currentHead = git rev-parse HEAD 41 | 42 | $cmd = "./gradlew.bat $InputAdditionalGradleArguments ${InputProject}:dependencies --configuration $InputConfiguration" 43 | Invoke-Expression $cmd | Out-File -FilePath "dependency-tree-diff_dependencies-head.txt" -Encoding UTF8 44 | git fetch --force origin "${InputBaseRef}:${InputBaseRef}" --no-tags 45 | git switch --force $InputBaseRef 46 | Invoke-Expression $cmd | Out-File -FilePath "dependency-tree-diff_dependencies-base.txt" -Encoding UTF8 47 | java -jar dependency-tree-diff.jar dependency-tree-diff_dependencies-base.txt dependency-tree-diff_dependencies-head.txt | Out-File -FilePath "dependency-tree-diff_output.txt" -Encoding UTF8 48 | 49 | if ($InputDebug -eq "true") { 50 | Write-Host "diff generated" 51 | Get-ChildItem -Force 52 | Resolve-Path "dependency-tree-diff_output.txt" 53 | Get-Location 54 | } 55 | 56 | $delimiter = -join ((1..40) | ForEach-Object { Get-Random -InputObject ([char[]]"0123456789abcdef") }) 57 | 58 | "text-diff<<$delimiter" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding UTF8 59 | Get-Content "dependency-tree-diff_output.txt" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding UTF8 60 | $delimiter | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding UTF8 61 | 62 | $outputPath = Resolve-Path "dependency-tree-diff_output.txt" 63 | $basePath = Resolve-Path "dependency-tree-diff_dependencies-base.txt" 64 | $headPath = Resolve-Path "dependency-tree-diff_dependencies-head.txt" 65 | 66 | "file-diff=$outputPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding UTF8 67 | "file-dependencies-base=$basePath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding UTF8 68 | "file-dependencies-head=$headPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding UTF8 69 | 70 | git switch --detach $currentHead 71 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash -el 2 | 3 | cd "$INPUT_BUILD_ROOT_DIR" 4 | 5 | if [ "$INPUT_VERSION" == "latest" ]; then 6 | curl -H "Authorization: Bearer $GITHUB_TOKEN" -s https://api.github.com/repos/JakeWharton/dependency-tree-diff/releases/latest \ 7 | | grep "/dependency-tree-diff.jar" \ 8 | | cut -d : -f 2,3 \ 9 | | tr -d \" \ 10 | | xargs curl -H "Authorization: Bearer $GITHUB_TOKEN" -L -s -o dependency-tree-diff.jar 11 | else 12 | curl -H "Authorization: Bearer $GITHUB_TOKEN" -L -s -o dependency-tree-diff.jar "https://github.com/JakeWharton/dependency-tree-diff/releases/download/$INPUT_VERSION/dependency-tree-diff.jar" 13 | fi 14 | 15 | if [ "$INPUT_PROJECT" == ":" ]; then 16 | INPUT_PROJECT="" 17 | fi 18 | 19 | if [ "$INPUT_DEBUG" == "true" ]; then 20 | echo "download finished" 21 | echo "$JAVA_HOME" 22 | java -version 23 | ls -al 24 | fi 25 | 26 | chmod +x dependency-tree-diff.jar 27 | 28 | current_head=$(git rev-parse HEAD) 29 | 30 | ./gradlew $INPUT_ADDITIONAL_GRADLE_ARGUMENTS "$INPUT_PROJECT":dependencies --configuration "$INPUT_CONFIGURATION" > dependency-tree-diff_dependencies-head.txt 31 | git fetch --force origin "$INPUT_BASEREF":"$INPUT_BASEREF" --no-tags 32 | git switch --force "$INPUT_BASEREF" 33 | ./gradlew $INPUT_ADDITIONAL_GRADLE_ARGUMENTS "$INPUT_PROJECT":dependencies --configuration "$INPUT_CONFIGURATION" > dependency-tree-diff_dependencies-base.txt 34 | java -jar dependency-tree-diff.jar dependency-tree-diff_dependencies-base.txt dependency-tree-diff_dependencies-head.txt > dependency-tree-diff_output.txt 35 | 36 | if [ "$INPUT_DEBUG" == "true" ]; then 37 | echo "diff generated" 38 | ls -al 39 | realpath dependency-tree-diff_output.txt 40 | pwd 41 | fi 42 | 43 | delimiter=$(openssl rand -hex 20) 44 | echo "text-diff<<$delimiter" >> $GITHUB_OUTPUT 45 | cat dependency-tree-diff_output.txt >> $GITHUB_OUTPUT 46 | echo "$delimiter" >> $GITHUB_OUTPUT 47 | 48 | echo "file-diff=$(realpath dependency-tree-diff_output.txt)" >> $GITHUB_OUTPUT 49 | echo "file-dependencies-base=$(realpath dependency-tree-diff_dependencies-base.txt)" >> $GITHUB_OUTPUT 50 | echo "file-dependencies-head=$(realpath dependency-tree-diff_dependencies-head.txt)" >> $GITHUB_OUTPUT 51 | 52 | git switch --detach "$current_head" 53 | -------------------------------------------------------------------------------- /testproject/.gitattributes: -------------------------------------------------------------------------------- 1 | # 2 | # https://help.github.com/articles/dealing-with-line-endings/ 3 | # 4 | # These are explicitly windows files and should use crlf 5 | *.bat text eol=crlf 6 | 7 | -------------------------------------------------------------------------------- /testproject/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore Gradle project-specific cache directory 2 | .gradle 3 | 4 | # Ignore Gradle build output directory 5 | build 6 | -------------------------------------------------------------------------------- /testproject/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("com.starter.library.kotlin") version "0.84.1" 3 | } 4 | 5 | kotlin { 6 | jvmToolchain(21) 7 | } 8 | 9 | dependencies { 10 | implementation("androidx.paging:paging-common-ktx:3.3.6") 11 | } 12 | -------------------------------------------------------------------------------- /testproject/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.parallel=true 2 | org.gradle.caching=true 3 | org.gradle.configuration-cache=true 4 | org.gradle.configuration-cache.parallel=true 5 | -------------------------------------------------------------------------------- /testproject/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/usefulness/dependency-tree-diff-action/409a129cc869dcd719fa870a43ace6050ea8df88/testproject/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /testproject/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /testproject/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 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 | CLASSPATH="\\\"\\\"" 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | -------------------------------------------------------------------------------- /testproject/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 | set CLASSPATH= 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /testproject/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | mavenCentral() 4 | gradlePluginPortal() 5 | } 6 | } 7 | 8 | plugins { 9 | id("com.gradle.develocity") version "4.0.2" 10 | } 11 | 12 | develocity { 13 | buildScan { 14 | termsOfUseUrl = "https://gradle.com/terms-of-service" 15 | termsOfUseAgree = "yes" 16 | 17 | if (System.getenv("CI")) { 18 | tag "CI" 19 | uploadInBackground = false 20 | } else { 21 | publishing { onlyIf { false } } 22 | uploadInBackground = true 23 | } 24 | } 25 | } 26 | 27 | dependencyResolutionManagement { 28 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 29 | repositories { 30 | mavenCentral() 31 | google() 32 | } 33 | } 34 | 35 | rootProject.name = 'com.starter.dependencydiff.test' 36 | --------------------------------------------------------------------------------