Skip to content

Check Gradle wrapper jar sha256 on Windows - #3137

Open
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-gradle-wrapper-sha256-windows
Open

Check Gradle wrapper jar sha256 on Windows#3137
rootkiller6788 wants to merge 1 commit into
google:mainfrom
rootkiller6788:fix-gradle-wrapper-sha256-windows

Conversation

@rootkiller6788

Copy link
Copy Markdown

Summary

The CI workflow uses sha256sum --check gradle-wrapper.jar.sha256sum to verify the committed wrapper JAR.
However, this step is guarded by if: matrix.os != 'windows-latest', so it has never run on Windows runners.

Root cause

On Windows, the .sha256sum file is checked out with CRLF line endings.
There is no dedicated rule for *.sha256sum in .gitattributes, so it falls back to the catch-all * text=auto. Combined with Windows’ default core.autocrlf=true, the file gets converted to CRLF.
As a result, sha256sum --check treats the trailing \r as part of the filename and attempts to look for gradle-wrapper.jar\r, producing the error:
sha256sum: 'gradle-wrapper.jar'$'\r': No such file or directory

Changes

  • Add *.sha256sum text eol=lf to .gitattributes to ensure the checksum file is always checked out with LF line endings across all platforms for byte-identical content.
  • Remove the if: matrix.os != 'windows-latest' condition so the verification step executes on Windows as well.

Verification

  • Confirm the committed JAR matches the recorded checksum (497c8c2a…).
  • Running sha256sum --check against the LF-versioned file outputs gradle-wrapper.jar: OK.

Closes #3103.

Fixes google#3103.

The "Check valid Gradle wrapper jar" step was skipped on
windows-latest because gradle-wrapper.jar.sha256sum was checked out
with CRLF line endings there (via `* text=auto` under core.autocrlf).
With a trailing \r in the filename, `sha256sum --check` fails to find
the file and the check cannot run on Windows.

Force LF for *.sha256sum in .gitattributes so the file is byte-for-byte
identical on every platform, and drop the `if: matrix.os !=
'windows-latest'` condition so the check also runs on Windows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: Check Gradle wrapper jar sha256 sum on Windows builds

1 participant