Xcode build phases

This is just a short brain-dump what to put in each and every project's build phases:

Show all TODO: and FIXME: comments as warnings

Based on another blog article of Jeffrey Sambells, put this as a run script build phase into your build process:

TAGS="TODO:|FIXME:|@todo|@fixme|HACK:|@hack"  
echo "searching ${SRCROOT} for ${TAGS}"  
find "${SRCROOT}/Source" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | sed -e 's/\([^ ]*[0-9][0-9]*:\)\(.*\)/\1 warning: \2/'  

My changes include the doxygen @ tags and replace the invocation of perl with a better working version in sed script.

Automatically build documentation

Install the awesome appledoc to build better documentation than doxygen might do (all with the same comment markup ;) )

Best install not via homebrew but via the install-script in the git repo (as you will get no templates in a homebrew install)

Add a new custom target, name it documentation and add this script to the build phases:

cd "${SRCROOT}"  
if [ -x /usr/local/bin/appledoc ] ; then  
    /usr/local/bin/appledoc . 2>&1 |sed -e '/warning: Ignoring/d' >&2
else  
    echo "error: appledoc not installed" >&2
    exit 1
fi  

You'll need a config-file named AppledocSettings.plist in your $(SRCROOT):

<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">  
<plist version="1.0">  
<dict>  
    <key>--ignore</key>
    <array>
        <string>directory/to/ignore</string>
    </array>
    <key>--project-name</key>
    <string>fancy-project</string>
    <key>--project-company</key>
    <string>example</string>
    <key>--company-id</key>
    <string>com.example</string>
    <key>--create-docset</key>
    <false/>
    <key>--install-docset</key>
    <false/>
    <key>--verbose</key>
    <string>2</string>
    <key>--logformat</key>
    <string>xcode</string>
    <key>--input</key>
    <array>
        <string>./path/to/source</string>
    </array>
    <key>--output</key>
    <string>./docs</string>
    <key>--merge-categories</key>
    <true/>
    <key>--warn-undocumented-object</key>
    <true/>
    <key>--warn-undocumented-member</key>
    <true/>
    <key>--warn-missing-arg</key>
    <true/>
</dict>  
</plist>  

Johannes Schriewer

iOS and Linux developer. Tinkers with electronics and 3D-Printers, loves low-level stuff.

Augsburg, Germany, Planet Earth