[bcl] Add check for newline to gensources.sh (#4662)
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Fri, 7 Apr 2017 16:07:52 +0000 (18:07 +0200)
committerGitHub <noreply@github.com>
Fri, 7 Apr 2017 16:07:52 +0000 (18:07 +0200)
This has bitten us a bunch of times now so let's make sure
it doesn't happen again.

mcs/build/gensources.sh

index 14a0a01db59d07b4503b9a5d1ae8882e25442524..a501a5b816c206e2fc3e271f8cf2c998d85d614e 100644 (file)
@@ -29,6 +29,17 @@ process_includes() {
     rm -f $t
 }
 
+check_newline_eof() {
+       file=$1
+       if ! test -n "$file"; then return; fi
+       if ! test -z "$(tail -c 1 "$file")"; then echo "$file: missing newline at end of file."; exit 1; fi
+}
+
+check_newline_eof $incfile
+check_newline_eof $excfile
+check_newline_eof $extfile
+check_newline_eof $extexcfile
+
 rm -f $outfile.makefrag
 
 process_includes $incfile $outfile.inc