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

fix: Added CR LF to LF Conversion for gradlew #2738

Merged
merged 9 commits into from Mar 26, 2021

Conversation

CoshUS
Copy link
Contributor

@CoshUS CoshUS commented Mar 18, 2021

Which issue(s) does this change fix?

#2551

Why is this change necessary?

SAM CLI quick start Java gradle projects fail to build on Windows with --use-container or with image type.
Windows git clone will change gradlew line endings to \r\n which will not be recognized by Unix sh.

How does it address the issue?

Replace all \r\n in gradlew to \n after cookiecutter.
Simply replacing when the repo is cloned will not work as cookiecutter also changes line endings.

What side effects does this change have?

Checklist

  • Add input/output type hints to new functions/methods
  • Write design document (Do I need to write a design document?)
  • Write unit tests
  • Write/update functional tests
  • Write/update integration tests
  • make pr passes
  • make update-reproducible-reqs if dependencies were changed
  • Write documentation

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hoffa
Copy link
Contributor

hoffa commented Mar 18, 2021

Windows git clone will change gradlew line endings to \r\n

Is this documented behavior?

@CoshUS
Copy link
Contributor Author

CoshUS commented Mar 18, 2021

Windows git clone will change gradlew line endings to \r\n

Is this documented behavior?

git config --global core.autocrlf true
https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

The Windows git installer also prompts the users during installation on how newlines should be handled. The default is commit with \n and pull with \r\n.

@CoshUS CoshUS force-pushed the fix/windows-init-line-ending branch from ff589d8 to 3e869cd Compare March 18, 2021 23:22
@vilunet
Copy link

vilunet commented Mar 19, 2021

excellent, thanks for fixing this.

samcli/lib/init/__init__.py Outdated Show resolved Hide resolved
samcli/lib/init/__init__.py Outdated Show resolved Hide resolved
@CoshUS CoshUS changed the title Added CR LF to LF Conversion for gradlew fix: Added CR LF to LF Conversion for gradlew Mar 22, 2021
samcli/lib/utils/osutils.py Show resolved Hide resolved
@CoshUS CoshUS requested review from sriram-mv and hoffa March 24, 2021 17:27
Base automatically changed from develop to elbayaaa-develop March 25, 2021 21:28
Base automatically changed from elbayaaa-develop to develop March 25, 2021 21:38
@CoshUS CoshUS dismissed sriram-mv’s stale review March 26, 2021 18:26

Change has been addressed.

@CoshUS CoshUS merged commit aa80614 into aws:develop Mar 26, 2021
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.

None yet

5 participants