Permalink
Browse files

Make builds fail if there are unwanted trailing spaces

  • Loading branch information...
1 parent e5a50e0 commit 0ebca1a79c42d7837579f65f5fdbc5c47b06476a @SteveSanderson SteveSanderson committed Apr 13, 2012
View
10 build/build-linux
@@ -1,6 +1,11 @@
#!/bin/sh
-tools/check-trailing-space-linux
+handle_fail() {
+ echo; echo "Build failed"
+ exit 1
+}
+
+tools/check-trailing-space-linux || handle_fail
OutDebugFile='output/knockout-latest.debug.js'
OutMinFile='output/knockout-latest.js'
@@ -36,4 +41,5 @@ Version=`cat fragments/version.txt`
sed -i~ -e "s/##VERSION##/$Version/g" $OutDebugFile $OutMinFile
# Delete the odd files left behind on Mac
-rm -f output/*.js~
+rm -f output/*.js~
+echo; echo "Build succeeded"
View
11 build/build-windows.bat
@@ -1,6 +1,7 @@
@echo off
call tools/check-trailing-space-windows.bat
+if %errorlevel% NEQ 0 goto Fail
set OutDebugFile=output\knockout-latest.debug.js
set OutMinFile=output\knockout-latest.js
@@ -41,4 +42,12 @@ del %OutMinFile%.temp
@rem Inject the version number string
set /p Version= <fragments\version.txt
cscript tools\searchReplace.js "##VERSION##" %VERSION% %OutDebugFile% %OutMinFile% >nul
-cscript tools\searchReplace.js "\r\n" "\n" %OutDebugFile% %OutMinFile% >nul
+cscript tools\searchReplace.js "\r\n" "\n" %OutDebugFile% %OutMinFile% >nul
+
+echo.
+echo Build succeeded
+exit /b 0
+
+:Fail
+echo.
+echo Build failed
View
4 build/tools/check-trailing-space-linux
@@ -10,7 +10,7 @@ then
echo "The following files have trailing spaces that need to be cleaned up:"
echo ""
cat $OutTrailingSpaceListFile
- echo ""
-else
rm $OutTrailingSpaceListFile
+ exit 1
fi
+rm $OutTrailingSpaceListFile
View
3 build/tools/check-trailing-space-windows.bat
@@ -13,6 +13,7 @@ goto :TrailingSpaceOkay
echo The following files have trailing spaces that need to be cleaned up:
echo.
type %OutTrailingSpaceListFile%
-echo.
+del %OutTrailingSpaceListFile%
+exit /b 1
:TrailingSpaceOkay

0 comments on commit 0ebca1a

Please sign in to comment.