Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Gradle wrapper files #4985

Merged
merged 1 commit into from
Jan 21, 2025

Conversation

runningcode
Copy link
Contributor

@runningcode runningcode commented Jan 17, 2025

Summary

Update Gradle wrapper files by running ./gradlew wrapper.

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@runningcode runningcode changed the title Update Gradle wrapper files and enable configuration cache Update Gradle wrapper files Jan 17, 2025
@jpelgrom
Copy link
Member

jpelgrom commented Jan 17, 2025

Looks like you're changing the line endings which is creating an unnecessarily large diff.

@runningcode
Copy link
Contributor Author

@jpelgrom thanks for pointing that out. For background information, the file is .bat which is a Windows/DOS batch file. The standard line endings for Windows/DOS are CRLF. This changes them to be CRLF.
I did this by simply running ./gradlew wrapper which is a command that ensures the integrity of the wrapper scripts. I didn’t manually change the line endings. You will get the same diff by running ./gradlew wrapper.
I can change them to reduce the diff if you like. Let me know how to proceed. :)

@JBassett
Copy link
Collaborator

You likely have the wrong GIT settings for line endings: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings

@jpelgrom
Copy link
Member

jpelgrom commented Jan 17, 2025

This changes them to be CRLF.

Ah, I see now it is stored as LF in the repo (can't check that on GitHub) and with the file being Windows-specific it makes sense to change it. But please mention changes like that - most often people don't pay attention when this happens. Simply updating the file and committing doesn't give this result for everyone because of Git line endings settings.

On this PR branch index is crlf
PS C:\home-assistant-android> git ls-files 'gradlew.bat' --eol
i/crlf  w/crlf  attr/                   gradlew.bat
On the main branch index is lf
PS C:\home-assistant-android> git ls-files 'gradlew.bat' --eol
i/lf    w/crlf  attr/                   gradlew.bat

gradle.properties Outdated Show resolved Hide resolved
@runningcode
Copy link
Contributor Author

I can add a .gitattributes file to the repo which will keep .bat files as CLRF. This is the standard practice in a lot of gradle repos. Example

@jpelgrom
Copy link
Member

OK, that sounds good, but now you've changed gradlew.bat to LF again? (as evidenced by the changed files no longer including gradlew.bat)

@runningcode
Copy link
Contributor Author

I’m not sure why it isn’t showing in the PR but locally on my computer it is still CRLF. I didn’t make any explicit changes to it.

$ file gradlew.bat
gradlew.bat: DOS batch file text, ASCII text, with CRLF line terminators

@jpelgrom
Copy link
Member

No, it's definitely LF now. The file on your file system may have different line endings, use the Git specific command! That reports i/lf.

PS C:\home-assistant-android> git fetch upstream pull/4985/head:pull-gradle2 
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 3 (delta 1), pack-reused 0 (from 0)
Unpacking objects: 100% (3/3), 401 bytes | 3.00 KiB/s, done.
From github.com:home-assistant/android
 * [new ref]           refs/pull/4985/head -> pull-gradle2
PS C:\home-assistant-android> git checkout pull-gradle2
Switched to branch 'pull-gradle2'
PS C:\home-assistant-android> git ls-files 'gradlew.bat' --eol
i/lf    w/crlf  attr/text eol=crlf      gradlew.bat

@runningcode
Copy link
Contributor Author

Thanks for that. I see the same output as you for git ls-files 'gradlew.bat' —eol so it seems the index is still incorrect here.

I tried a couple things including deleting the file with git rm and also git add —renormalize gradlew.bat and nothing seems to change here. Do you have an idea of what I should do?

@jpelgrom
Copy link
Member

Hmm yes and now it wants to mark all images as changed too. Something's not right because of the attribute file.

May I suggest only doing the first commit (so git reset HEAD~1 and then force push) which at least has gradlew.bat in CRLF, and then we can do the attributes stuff in another PR as that will also cause a lot of other CRLF -> LF changes?

@runningcode runningcode force-pushed the no/update-wrapper branch 3 times, most recently from ab8dc4a to f9ccf7c Compare January 21, 2025 12:31
@runningcode
Copy link
Contributor Author

Good idea @jpelgrom . Done. I’ll create a separate PR to add the .gitattributes.

@jpelgrom jpelgrom merged commit f08a672 into home-assistant:master Jan 21, 2025
4 checks passed
@runningcode runningcode deleted the no/update-wrapper branch January 21, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants