Xcode shell build phase, reporting of errors
Found this useful information, regarding Xcode error reporting for shell build phases. For example, if we were to include JSLint in PhoneGap iPhone, we could format the errors this way below so code where the errors occur are easily editable:
In shell build phases you can write to stderr using the following format:
<filename>:<linenumber>: error | warn | note : <message>\n
It’s the same format gcc uses to show errors. The filename:linenumber part can be omitted. Depending on the mode (error, warn, note), Xcode will show your message with a red or yellow badge.
If you include an absolute file path and a line number (if the error occurred in a file), double clicking the error in the build log lets Xcode open the file and jumps to the line, even if it is not part of the project. Very handy.
This is just the info I was looking for, but can’t quite
get it to work. I tried adding this line to my shell script: echo
“$file:1:error: Subtext parse error” It did generate a line of
output in the build log: BrokenItemDilemmaTwo.subtext:1:error:
Subtext parse errorn But it did not have the right format for xcode
to mark it red or count as an error. What was I doing wrong??
thanks!
Antoine
December 21, 2010 at 4:53 pm
Make sure you output the error line to stderr, not stdout.
shazron
December 23, 2010 at 10:31 pm
Could you go into more detail on how to integrate jslint into the xcode build process? A step by step guide would be great!
Don
January 17, 2011 at 5:42 pm
It seems to work if I do this in my script:
echo -e “MyFile.m:0: error : My Message\n” 1>&2
(note the spaces before and after ‘error’ and its subsequent colon). I can’t get Xcode to display anything besides the white exclamation icon in a red octagon though, no matter what mode I used.
shazron
May 16, 2011 at 6:26 pm
This produces a compiler warning with a yellow triangle and white exclamation point.
echo “MyFileName.m”:1: warning: “My warning message”
exit 0
RGB World
January 11, 2013 at 8:22 am