I'm not even sure this is possible, but I'll give it a shot.
Is it somehow possible (i.e. with a plugin) for Xcode to check if every File contains a valid license header, and if not stops compiling?
Thanks in advance.
I'm not even sure this is possible, but I'll give it a shot.
Is it somehow possible (i.e. with a plugin) for Xcode to check if every File contains a valid license header, and if not stops compiling?
Thanks in advance.
Here is the complete Setup! Note that this will produce Xcode erros too. :)
#!/bin/bash
searchString=`cat license.txt`
ERROR_COUNT=0
while read file
do
grep -F "${searchString}" $file > /dev/null
if [ $? -ne 0 ]; then
echo -e $file:1: error : No valid License Header found! 1>&2
ERROR_COUNT=1
fi
done < <(find . -type d \( -name "TTTAttributedLabel" -o -name "minizip" -o -name "SSZipArchive" \) -prune -o -type f \( -name "*.m" -o -name "*.h" -o -name "*.pch" \) -print)
exit $ERROR_COUNT
And here is how to setup the Script: Xcode: Running a script before every build that modifies source code directly
How to report Errors in Xcode: http://shazronatadobe.wordpress.com/2010/12/04/xcode-shell-build-phase-reporting-of-errors/
Well im not sure if this is the correct answer, but you could add a shell script to your build phase which could check the files in your project for the valid license header (via grep+regex).