Makefile: on Windows, run unix2dos on generated files

The generators always produce UNIX line-ends. This creates false file
modifications with Git on Windows. Convert them to DOS line-ends to avoid
this.

This was already done for the Go code; this commit just copies the approach
to the Python and JavaScript generators.
This commit is contained in:
Sybren A. Stüvel 2022-07-16 11:12:41 +02:00
parent e2434b44f2
commit fee0717179

View File

@ -103,6 +103,11 @@ generate-py:
# The generator outputs files so that we can write our own tests. We don't, # The generator outputs files so that we can write our own tests. We don't,
# though, so it's better to just remove those placeholders. # though, so it's better to just remove those placeholders.
rm -rf addon/flamenco/manager/test rm -rf addon/flamenco/manager/test
# The generators always produce UNIX line-ends. This creates false file
# modifications with Git. Convert them to DOS line-ends to avoid this.
ifeq ($(OS),Windows_NT)
git status --porcelain | grep '^ M addon/flamenco/manager' | cut -d' ' -f3 | xargs unix2dos --keepdate
endif
generate-js: generate-js:
# The generator doesn't consistently overwrite existing files, nor does it # The generator doesn't consistently overwrite existing files, nor does it
@ -134,6 +139,11 @@ generate-js:
# which is listed in our `. # which is listed in our `.
mv web/_tmp-manager-api-javascript/src web/app/src/manager-api mv web/_tmp-manager-api-javascript/src web/app/src/manager-api
rm -rf web/_tmp-manager-api-javascript rm -rf web/_tmp-manager-api-javascript
# The generators always produce UNIX line-ends. This creates false file
# modifications with Git. Convert them to DOS line-ends to avoid this.
ifeq ($(OS),Windows_NT)
git status --porcelain | grep '^ M web/app/src/manager-api' | cut -d' ' -f3 | xargs unix2dos --keepdate
endif
version: version:
@echo "OS : ${OS}" @echo "OS : ${OS}"