Make UTF8 checks fail the build if they find anything.

Also fixes a comment typo in docker_run.sh.
This commit is contained in:
pentarctagon 2018-03-23 10:09:47 -05:00 committed by Pentarctagon
parent 344b5c56b9
commit c456d4b288
4 changed files with 23 additions and 15 deletions

View File

@ -1,13 +1,19 @@
#!/bin/bash
# Install isutf8 program (from package "moreutils" at least in linux mint)
# in order to use this script
# Install isutf8 program (from package "moreutils" at least in linux mint) in order to use this script.
#
# This script assumes that the current working directory is the root of the
# wesnoth repository.
set -e
find src/ -type f -print0 | xargs -0 isutf8 --
find data/ -not -name "*.png" -not -name "*.ogg" -not -name "*.jpg" -not -name "*.wav" -not -name "*.gif" -not -name "*.xcf" -type f -print0 | xargs -0 isutf8 --
find po/ -type f -print0 | xargs -0 isutf8 --
isutf8 changelog
isutf8 players_changelog
isutf8 RELEASE_NOTES
# This script assumes that the current working directory is the root of the wesnoth repository.
exit_code=0
find src/ -type f -print0 | xargs -0 isutf8 -- || exit_code=1
find data/ -not -name "*.png" -not -name "*.ogg" -not -name "*.jpg" -not -name "*.wav" -not -name "*.gif" -not -name "*.xcf" -type f -print0 | xargs -0 isutf8 -- || exit_code=1
find po/ -type f -print0 | xargs -0 isutf8 -- || exit_code=1
isutf8 changelog.md || exit_code=1
isutf8 players_changelog.md || exit_code=1
isutf8 RELEASE_NOTES || exit_code=1
if [ $exit_code != 0 ]; then
echo "Found invalid UTF8 file(s)!"
fi
exit $exit_code

View File

@ -72,7 +72,7 @@ else
exit $BUILD_RET
fi
# needed since docker returns the exit code of the final comman executed, so a failure needs to be returned if any unit tests fail
# needed since docker returns the exit code of the final command executed, so a failure needs to be returned if any unit tests fail
EXIT_VAL=0
if [ "$WML_TESTS" == "true" ]; then

View File

@ -21,8 +21,10 @@ if [ "$TRAVIS_OS_NAME" = "osx" ]; then
exit $BUILD_RET
else
ln -s $HOME/build-cache/ build
./utils/travis/check_utf8.sh
./utils/travis/utf8_bom_dog.sh
./utils/travis/check_utf8.sh || exit 1
./utils/travis/utf8_bom_dog.sh || exit 1
"$CXX" --version
scons wesnoth wesnothd campaignd boost_unit_tests build=release \
ctool="$CC" cxxtool="$CXX" cxx_std="$CXXSTD" \

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
if grep -qorHbm1 "^`echo -ne '\xef\xbb\xbf'`" po/ src/ data/ ; then
echo "Error, Found a UTF8 BOM:\n"
echo "Found UTF8 BOM(s)!"
grep -orHbm1 "^`echo -ne '\xef\xbb\xbf'`" po/ src/ data/
exit 1
fi