开发者

Can I fully customise an Xcode 4 Run Script Build Phase error/warning within the Issues Navigator and Build Logs?

I read on a blog somewhere that you can integrate your own build scripts with Xcode's Issues Navigator and Build Logs GUIs by pr开发者_如何学Pythoninting messages to STDOUT using the following format:

FILENAME:LINE_NUMBER: WARNING_OR_ERROR: MSG

(Where WARNING_OR_ERROR is either warning or error)

e.g.

/path/to/proj/folder/somefile.ext:10: warning: There was a problem processing the file

Will show a Warning at line 10 of somefile.ext which reads "There was a problem processing the file". This does actually work (which is fantastic).

Is there any official documentation of this feature (I couldn't find any)?

In the Issues Navigator, I get a warning for the file somefile.ext, but the issue's title is "Shell Script Invocation Error" (my message appears underneath the title). Is there some way to set that heading, or am I stuck with that generic (and ugly) "Shell Script Invocation Error"?


It doesn't really answer your question as to whether you can customise the "Shell Script Invocation Error", but perl code doesn't get the nice error messages you describe, however if you include this perl module (or just the code from it) in your perl script, it does generate the nice error messages you talk about (still the same "Shell Script Invocation Error" title you mention). Just thought I'd share it for anyone using a perl script in Xcode and getting really lousy errors.

package XcodeErrors;

use strict;
use warnings;

$SIG{__WARN__} = sub
{
    my @loc = caller(0);
    print STDERR "$loc[1]:$loc[2]: warning: ", @_, "\n";
    return 1;
};

$SIG{__DIE__} = sub
{
    my @loc = caller(0);
    print STDERR "$loc[1]:$loc[2]: error: ", @_, "\n";
    exit 1;
};


1;


exit with 0 in your customized shell script will turn off "Shell Script Invocation Error"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜