Search code examples
xcodebuildexternallogging

How to use an external build log in XCode


I was wondering if it is somehow possible to open an external build log (for example the result of a simple make script) in XCode to process the errors and warnings? In other words: can XCode be used as an Editor and still process an external build log?


Solution

  • I could suggest this approach, working for my similar aim: in "Build Phases" in Xcode add "Run script" action:

    TAGS="TODO:|FIXME:|WARNING"
    find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
    

    enter image description here

    This magically adds warnings to Build log

    enter image description here

    I hope you can tune up this script for your needs.