Sync `misc/` scripts and hooks with upstream Godot
parent
1632322ce0
commit
82bc102581
|
@ -79,7 +79,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES Debug)
|
endif(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
|
|
||||||
# Disable conversion warning, truncation, unreferenced var, signed missmatch, different type
|
# Disable conversion warning, truncation, unreferenced var, signed mismatch, different type
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /wd4244 /wd4305 /wd4101 /wd4018 /wd4267 /wd4099")
|
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /wd4244 /wd4305 /wd4101 /wd4018 /wd4267 /wd4099")
|
||||||
|
|
||||||
# Todo: Check if needed.
|
# Todo: Check if needed.
|
||||||
|
|
|
@ -12,6 +12,8 @@ contributors to make sure they comply with our requirements.
|
||||||
`PATH`, or if you want to enable colored output with `pygmentize`.
|
`PATH`, or if you want to enable colored output with `pygmentize`.
|
||||||
- Pre-commit hook for `black`: Applies `black` to the staged Python files
|
- Pre-commit hook for `black`: Applies `black` to the staged Python files
|
||||||
before accepting a commit.
|
before accepting a commit.
|
||||||
|
- Pre-commit hook for `make_rst`: Checks the class reference syntax using
|
||||||
|
`make_rst.py`.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
@ -26,7 +28,7 @@ so they should work out of the box on Linux/macOS.
|
||||||
#### Windows
|
#### Windows
|
||||||
|
|
||||||
##### clang-format
|
##### clang-format
|
||||||
- Download LLVM for Windows (version 8 or later) from
|
- Download LLVM for Windows (version 13 or later) from
|
||||||
<https://releases.llvm.org/download.html>
|
<https://releases.llvm.org/download.html>
|
||||||
- Make sure LLVM is added to the `PATH` during installation
|
- Make sure LLVM is added to the `PATH` during installation
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
# specified filename. This should reproduce the results of the GNU version of
|
# specified filename. This should reproduce the results of the GNU version of
|
||||||
# readlink with the -f option.
|
# readlink with the -f option.
|
||||||
#
|
#
|
||||||
# Reference: http://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
|
# Reference: https://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac
|
||||||
canonicalize_filename () {
|
canonicalize_filename () {
|
||||||
local target_file="$1"
|
local target_file="$1"
|
||||||
local physical_directory=""
|
local physical_directory=""
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
# as this script. Hooks should return 0 if successful and nonzero to cancel the
|
# as this script. Hooks should return 0 if successful and nonzero to cancel the
|
||||||
# commit. They are executed in the order in which they are listed.
|
# commit. They are executed in the order in which they are listed.
|
||||||
#HOOKS="pre-commit-compile pre-commit-uncrustify"
|
#HOOKS="pre-commit-compile pre-commit-uncrustify"
|
||||||
HOOKS="pre-commit-clang-format pre-commit-black"
|
HOOKS="pre-commit-clang-format pre-commit-black pre-commit-make-rst"
|
||||||
###########################################################
|
###########################################################
|
||||||
# There should be no need to change anything below this line.
|
# There should be no need to change anything below this line.
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ DELETE_OLD_PATCHES=false
|
||||||
|
|
||||||
# File types to parse.
|
# File types to parse.
|
||||||
FILE_NAMES="SConstruct SCsub"
|
FILE_NAMES="SConstruct SCsub"
|
||||||
FILE_EXTS="py"
|
FILE_EXTS=".py"
|
||||||
|
|
||||||
# Use pygmentize instead of cat to parse diff with highlighting.
|
# Use pygmentize instead of cat to parse diff with highlighting.
|
||||||
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
|
# Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
|
||||||
|
@ -139,11 +139,11 @@ fi
|
||||||
while true; do
|
while true; do
|
||||||
if [ $terminal = "0" ] ; then
|
if [ $terminal = "0" ] ; then
|
||||||
if [ -x "$ZENITY" ] ; then
|
if [ -x "$ZENITY" ] ; then
|
||||||
ans=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage")
|
choice=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage")
|
||||||
if [ "$?" = "0" ] ; then
|
if [ "$?" = "0" ] ; then
|
||||||
yn="Y"
|
yn="Y"
|
||||||
else
|
else
|
||||||
if [ "$ans" = "Apply and stage" ] ; then
|
if [ "$choice" = "Apply and stage" ] ; then
|
||||||
yn="S"
|
yn="S"
|
||||||
else
|
else
|
||||||
yn="N"
|
yn="N"
|
||||||
|
@ -151,10 +151,10 @@ while true; do
|
||||||
fi
|
fi
|
||||||
elif [ -x "$XMSG" ] ; then
|
elif [ -x "$XMSG" ] ; then
|
||||||
$XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
$XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
||||||
ans=$?
|
choice=$?
|
||||||
if [ "$ans" = "100" ] ; then
|
if [ "$choice" = "100" ] ; then
|
||||||
yn="Y"
|
yn="Y"
|
||||||
elif [ "$ans" = "200" ] ; then
|
elif [ "$choice" = "200" ] ; then
|
||||||
yn="S"
|
yn="S"
|
||||||
else
|
else
|
||||||
yn="N"
|
yn="N"
|
||||||
|
@ -162,10 +162,10 @@ while true; do
|
||||||
elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then
|
elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then
|
||||||
winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")"
|
winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")"
|
||||||
$PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
$PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
||||||
ans=$?
|
choice=$?
|
||||||
if [ "$ans" = "100" ] ; then
|
if [ "$choice" = "100" ] ; then
|
||||||
yn="Y"
|
yn="Y"
|
||||||
elif [ "$ans" = "200" ] ; then
|
elif [ "$choice" = "200" ] ; then
|
||||||
yn="S"
|
yn="S"
|
||||||
else
|
else
|
||||||
yn="N"
|
yn="N"
|
||||||
|
|
|
@ -76,11 +76,11 @@ fi
|
||||||
|
|
||||||
# To get consistent formatting, we recommend contributors to use the same
|
# To get consistent formatting, we recommend contributors to use the same
|
||||||
# clang-format version as CI.
|
# clang-format version as CI.
|
||||||
RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="11"
|
RECOMMENDED_CLANG_FORMAT_MAJOR_MIN="12"
|
||||||
RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="12"
|
RECOMMENDED_CLANG_FORMAT_MAJOR_MAX="13"
|
||||||
|
|
||||||
if [ ! -x "$CLANG_FORMAT" ] ; then
|
if [ ! -x "$CLANG_FORMAT" ] ; then
|
||||||
message="Error: clang-format executable not found. Please install clang-format $RECOMMENDED_CLANG_FORMAT_MAJOR.x.x."
|
message="Error: clang-format executable not found. Please install clang-format $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX."
|
||||||
|
|
||||||
if [ ! -t 1 ] ; then
|
if [ ! -t 1 ] ; then
|
||||||
if [ -x "$ZENITY" ] ; then
|
if [ -x "$ZENITY" ] ; then
|
||||||
|
@ -108,7 +108,7 @@ CLANG_FORMAT_VERSION="$(clang-format --version | sed "s/[^0-9\.]*\([0-9\.]*\).*/
|
||||||
CLANG_FORMAT_MAJOR="$(echo "$CLANG_FORMAT_VERSION" | cut -d. -f1)"
|
CLANG_FORMAT_MAJOR="$(echo "$CLANG_FORMAT_VERSION" | cut -d. -f1)"
|
||||||
|
|
||||||
if [[ "$CLANG_FORMAT_MAJOR" -lt "$RECOMMENDED_CLANG_FORMAT_MAJOR_MIN" || "$CLANG_FORMAT_MAJOR" -gt "$RECOMMENDED_CLANG_FORMAT_MAJOR_MAX" ]]; then
|
if [[ "$CLANG_FORMAT_MAJOR" -lt "$RECOMMENDED_CLANG_FORMAT_MAJOR_MIN" || "$CLANG_FORMAT_MAJOR" -gt "$RECOMMENDED_CLANG_FORMAT_MAJOR_MAX" ]]; then
|
||||||
echo "Warning: Your clang-format binary is the wrong version ($CLANG_FORMAT_VERSION, expected between $RECOMMENDED_CLANG_FORMAT_MAJOR_MIN.x.x and $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX.x.x)."
|
echo "Warning: Your clang-format binary is the wrong version ($CLANG_FORMAT_VERSION, expected between $RECOMMENDED_CLANG_FORMAT_MAJOR_MIN and $RECOMMENDED_CLANG_FORMAT_MAJOR_MAX)."
|
||||||
echo " Consider upgrading or downgrading clang-format as formatting may not be applied correctly."
|
echo " Consider upgrading or downgrading clang-format as formatting may not be applied correctly."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ do
|
||||||
# +++ - timestamp
|
# +++ - timestamp
|
||||||
# to both lines working on the same file and having a/ and b/ prefix.
|
# to both lines working on the same file and having a/ and b/ prefix.
|
||||||
# Else it can not be applied with 'git apply'.
|
# Else it can not be applied with 'git apply'.
|
||||||
"$CLANG_FORMAT" -style=file "$file" | \
|
"$CLANG_FORMAT" -style=file "$file" --Wno-error=unknown | \
|
||||||
diff -u "$file" - | \
|
diff -u "$file" - | \
|
||||||
sed -e "1s|--- |--- a/|" -e "2s|+++ -|+++ b/$file|" >> "$patch"
|
sed -e "1s|--- |--- a/|" -e "2s|+++ -|+++ b/$file|" >> "$patch"
|
||||||
done
|
done
|
||||||
|
@ -179,11 +179,11 @@ fi
|
||||||
while true; do
|
while true; do
|
||||||
if [ $terminal = "0" ] ; then
|
if [ $terminal = "0" ] ; then
|
||||||
if [ -x "$ZENITY" ] ; then
|
if [ -x "$ZENITY" ] ; then
|
||||||
ans=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage")
|
choice=$($ZENITY --text-info --filename="$patch" --width=800 --height=600 --title="Do you want to apply that patch?" --ok-label="Apply" --cancel-label="Do not apply" --extra-button="Apply and stage")
|
||||||
if [ "$?" = "0" ] ; then
|
if [ "$?" = "0" ] ; then
|
||||||
yn="Y"
|
yn="Y"
|
||||||
else
|
else
|
||||||
if [ "$ans" = "Apply and stage" ] ; then
|
if [ "$choice" = "Apply and stage" ] ; then
|
||||||
yn="S"
|
yn="S"
|
||||||
else
|
else
|
||||||
yn="N"
|
yn="N"
|
||||||
|
@ -191,10 +191,10 @@ while true; do
|
||||||
fi
|
fi
|
||||||
elif [ -x "$XMSG" ] ; then
|
elif [ -x "$XMSG" ] ; then
|
||||||
$XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
$XMSG -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
||||||
ans=$?
|
choice=$?
|
||||||
if [ "$ans" = "100" ] ; then
|
if [ "$choice" = "100" ] ; then
|
||||||
yn="Y"
|
yn="Y"
|
||||||
elif [ "$ans" = "200" ] ; then
|
elif [ "$choice" = "200" ] ; then
|
||||||
yn="S"
|
yn="S"
|
||||||
else
|
else
|
||||||
yn="N"
|
yn="N"
|
||||||
|
@ -202,10 +202,10 @@ while true; do
|
||||||
elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then
|
elif [ \( \( "$OSTYPE" = "msys" \) -o \( "$OSTYPE" = "win32" \) \) -a \( -x "$PWSH" \) ]; then
|
||||||
winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")"
|
winmessage="$(canonicalize_filename "./.git/hooks/winmessage.ps1")"
|
||||||
$PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
$PWSH -noprofile -executionpolicy bypass -file "$winmessage" -file "$patch" -buttons "Apply":100,"Apply and stage":200,"Do not apply":0 -center -default "Do not apply" -geometry 800x600 -title "Do you want to apply that patch?"
|
||||||
ans=$?
|
choice=$?
|
||||||
if [ "$ans" = "100" ] ; then
|
if [ "$choice" = "100" ] ; then
|
||||||
yn="Y"
|
yn="Y"
|
||||||
elif [ "$ans" = "200" ] ; then
|
elif [ "$choice" = "200" ] ; then
|
||||||
yn="S"
|
yn="S"
|
||||||
else
|
else
|
||||||
yn="N"
|
yn="N"
|
||||||
|
|
|
@ -6,28 +6,20 @@ set -uo pipefail
|
||||||
|
|
||||||
# Apply black.
|
# Apply black.
|
||||||
echo -e "Formatting Python files..."
|
echo -e "Formatting Python files..."
|
||||||
PY_FILES=$(find \( -path "./.git" \
|
PY_FILES=$(git ls-files -- '*SConstruct' '*SCsub' '*.py' ':!:.git/*' ':!:thirdparty/*')
|
||||||
-o -path "./thirdparty" \
|
|
||||||
\) -prune \
|
|
||||||
-o \( -name "SConstruct" \
|
|
||||||
-o -name "SCsub" \
|
|
||||||
-o -name "*.py" \
|
|
||||||
\) -print)
|
|
||||||
black -l 120 $PY_FILES
|
black -l 120 $PY_FILES
|
||||||
|
|
||||||
git diff > patch.patch
|
diff=$(git diff --color)
|
||||||
|
|
||||||
# If no patch has been generated all is OK, clean up, and exit.
|
# If no patch has been generated all is OK, clean up, and exit.
|
||||||
if [ ! -s patch.patch ] ; then
|
if [ -z "$diff" ] ; then
|
||||||
printf "Files in this commit comply with the black style rules.\n"
|
printf "Files in this commit comply with the black style rules.\n"
|
||||||
rm -f patch.patch
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# A patch has been created, notify the user, clean up, and exit.
|
# A patch has been created, notify the user, clean up, and exit.
|
||||||
printf "\n*** The following differences were found between the code "
|
printf "\n*** The following differences were found between the code "
|
||||||
printf "and the formatting rules:\n\n"
|
printf "and the formatting rules:\n\n"
|
||||||
cat patch.patch
|
echo "$diff"
|
||||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||||
rm -f patch.patch
|
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -4,57 +4,36 @@
|
||||||
# This is the primary script responsible for fixing style violations.
|
# This is the primary script responsible for fixing style violations.
|
||||||
|
|
||||||
set -uo pipefail
|
set -uo pipefail
|
||||||
IFS=$'\n\t'
|
|
||||||
|
|
||||||
CLANG_FORMAT_FILE_EXTS=(".c" ".h" ".cpp" ".hpp" ".cc" ".hh" ".cxx" ".m" ".mm" ".inc" ".java" ".glsl")
|
# Loops through all code files tracked by Git.
|
||||||
|
git ls-files -- '*.c' '*.h' '*.cpp' '*.hpp' '*.cc' '*.hh' '*.cxx' '*.m' '*.mm' '*.inc' '*.java' '*.glsl' \
|
||||||
# Loops through all text files tracked by Git.
|
':!:.git/*' ':!:thirdparty/*' ':!:platform/android/java/lib/src/com/google/*' ':!:*-so_wrap.*' |
|
||||||
git grep -zIl '' |
|
while read -r f; do
|
||||||
while IFS= read -rd '' f; do
|
|
||||||
# Exclude some files.
|
|
||||||
if [[ "$f" == "thirdparty"* ]]; then
|
|
||||||
continue
|
|
||||||
# elif [[ "$f" == "gen"* ]]; then
|
|
||||||
# continue
|
|
||||||
elif [[ "$f" == "platform/android/java/lib/src/com/google"* ]]; then
|
|
||||||
continue
|
|
||||||
elif [[ "$f" == *"-so_wrap."* ]]; then
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
for extension in ${CLANG_FORMAT_FILE_EXTS[@]}; do
|
|
||||||
if [[ "$f" == *"$extension" ]]; then
|
|
||||||
# Run clang-format.
|
# Run clang-format.
|
||||||
clang-format -i "$f"
|
clang-format --Wno-error=unknown -i "$f"
|
||||||
|
|
||||||
# Fix copyright headers, but not all files get them.
|
# Fix copyright headers, but not all files get them.
|
||||||
if [[ "$f" == *"inc" ]]; then
|
if [[ "$f" == *"inc" ]]; then
|
||||||
continue 2
|
continue
|
||||||
elif [[ "$f" == *"glsl" ]]; then
|
elif [[ "$f" == *"glsl" ]]; then
|
||||||
continue 2
|
continue
|
||||||
elif [[ "$f" == *"theme_data.h" ]]; then
|
|
||||||
continue 2
|
|
||||||
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/input/InputManager"* ]]; then
|
elif [[ "$f" == "platform/android/java/lib/src/org/godotengine/godot/input/InputManager"* ]]; then
|
||||||
continue 2
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python misc/scripts/copyright_headers.py "$f"
|
python misc/scripts/copyright_headers.py "$f"
|
||||||
continue 2
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
|
|
||||||
git diff > patch.patch
|
diff=$(git diff --color)
|
||||||
|
|
||||||
# If no patch has been generated all is OK, clean up, and exit.
|
# If no patch has been generated all is OK, clean up, and exit.
|
||||||
if [ ! -s patch.patch ] ; then
|
if [ -z "$diff" ] ; then
|
||||||
printf "Files in this commit comply with the clang-format style rules.\n"
|
printf "Files in this commit comply with the clang-tidy style rules.\n"
|
||||||
rm -f patch.patch
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# A patch has been created, notify the user, clean up, and exit.
|
# A patch has been created, notify the user, clean up, and exit.
|
||||||
printf "\n*** The following differences were found between the code "
|
printf "\n*** The following changes have been made to comply with the formatting rules:\n\n"
|
||||||
printf "and the formatting rules:\n\n"
|
echo "$diff"
|
||||||
cat patch.patch
|
printf "\n*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
|
||||||
rm -f patch.patch
|
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
SKIP_LIST="./thirdparty,*.gen.*,*.po,*.pot,package-lock.json,./core/string/locales.h,./DONORS.md,./misc/scripts/codespell.sh"
|
||||||
|
IGNORE_LIST="ba,childs,curvelinear,expct,fave,findn,gird,inout,lod,nd,numer,ois,ro,statics,te,varn"
|
||||||
|
|
||||||
|
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}"
|
|
@ -20,6 +20,11 @@ while IFS= read -rd '' f; do
|
||||||
continue
|
continue
|
||||||
elif [[ "$f" == *"sln" ]]; then
|
elif [[ "$f" == *"sln" ]]; then
|
||||||
continue
|
continue
|
||||||
|
elif [[ "$f" == *".bat" ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "$f" == *".out" ]]; then
|
||||||
|
# GDScript integration testing files.
|
||||||
|
continue
|
||||||
elif [[ "$f" == *"patch" ]]; then
|
elif [[ "$f" == *"patch" ]]; then
|
||||||
continue
|
continue
|
||||||
elif [[ "$f" == *"pot" ]]; then
|
elif [[ "$f" == *"pot" ]]; then
|
||||||
|
@ -42,10 +47,10 @@ while IFS= read -rd '' f; do
|
||||||
perl -i -ple 's/\s*$//g' "$f"
|
perl -i -ple 's/\s*$//g' "$f"
|
||||||
done
|
done
|
||||||
|
|
||||||
git diff > patch.patch
|
diff=$(git diff --color)
|
||||||
|
|
||||||
# If no patch has been generated all is OK, clean up, and exit.
|
# If no patch has been generated all is OK, clean up, and exit.
|
||||||
if [ ! -s patch.patch ] ; then
|
if [ -z "$diff" ] ; then
|
||||||
printf "Files in this commit comply with the formatting rules.\n"
|
printf "Files in this commit comply with the formatting rules.\n"
|
||||||
rm -f patch.patch
|
rm -f patch.patch
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -54,7 +59,6 @@ fi
|
||||||
# A patch has been created, notify the user, clean up, and exit.
|
# A patch has been created, notify the user, clean up, and exit.
|
||||||
printf "\n*** The following differences were found between the code "
|
printf "\n*** The following differences were found between the code "
|
||||||
printf "and the formatting rules:\n\n"
|
printf "and the formatting rules:\n\n"
|
||||||
cat patch.patch
|
echo "$diff"
|
||||||
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\n"
|
||||||
rm -f patch.patch
|
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -47,7 +47,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
||||||
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES Debug)
|
endif(CMAKE_BUILD_TYPE MATCHES Debug)
|
||||||
|
|
||||||
# Disable conversion warning, trunkation, unreferenced var, signed missmatch
|
# Disable conversion warning, truncation, unreferenced var, signed mismatch
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /wd4244 /wd4305 /wd4101 /wd4018 /wd4267")
|
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /wd4244 /wd4305 /wd4101 /wd4018 /wd4267")
|
||||||
|
|
||||||
# Todo: Check if needed.
|
# Todo: Check if needed.
|
||||||
|
|
Loading…
Reference in New Issue