Skip to content

Instantly share code, notes, and snippets.

@eraserhd
Created September 25, 2011 20:37
Show Gist options
  • Save eraserhd/1241123 to your computer and use it in GitHub Desktop.
Save eraserhd/1241123 to your computer and use it in GitHub Desktop.
function! RunBuildCommand(cmd)
let l:BuildLog = "build/vim.log"
if bufname("%") != ""
silent write
endif
echo "Building... "
let l:StartTime = reltime()
exec "silent !" . a:cmd . " >" . l:BuildLog . " 2>&1"
" xcodebuild does NOT set exit code properly, so check the build log
exec "silent !grep -q '^\*\* BUILD FAILED' " . l:BuildLog
redraw!
if !v:shell_error
set errorformat=
\%f:%l:%c:{%*[^}]}:\ error:\ %m,
\%f:%l:%c:{%*[^}]}:\ fatal\ error:\ %m,
\%f:%l:%c:{%*[^}]}:\ warning:\ %m,
\%f:%l:%c:\ error:\ %m,
\%f:%l:%c:\ fatal\ error:\ %m,
\%f:%l:%c:\ warning:\ %m,
\%f:%l:\ Error:\ %m,
\%f:%l:\ error:\ %m,
\%f:%l:\ fatal\ error:\ %m,
\%f:%l:\ warning:\ %m
execute "cfile! " . l:BuildLog
else
echo "Building... OK - " . reltimestr(reltime(l:StartTime)) . " seconds"
endif
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment