Re: Flagging errors from inside a Run Script build phase
Re: Flagging errors from inside a Run Script build phase
- Subject: Re: Flagging errors from inside a Run Script build phase
- From: Jonas Maebe <email@hidden>
- Date: Sat, 28 Jan 2006 10:29:02 +0100
On 27 Jan 2006, at 16:04, Dave McCaldon wrote:
But even with exit 0, Xcode somehow detects the error message from
rm when you try to remove a non-existent file. There's some magic
there, I just don't know what. I had hoped it would be one of:
* The word "ERROR" in the script output
* Anything written to stderr
Xcode must be hard coded to look for specific output,
That's true. I forgot to mention this in my first mail, but one of
these types of output Xcode looks for are error messages formatted in
exactly the same way as gcc's. Have a look at /Developer/Tools/
RunUnitTests, it uses this trick. Caveats:
* Radar 4343667: this trick only works for Run Script phases. If you
try to use it in a custom build rule script, all such generated error
messages are associated with a non-existant file at line 0
("projecttype:0") and cannot be double-clicked (which is ok in your
case I guess, but not if you use them for calling an external
compiler). A workaround is to echo the necessary info to compile to
a temporary file in the custom build rule script, and then to
introduce a Run Script phase which reads this file and does the
actual compilation.
However (radar 4389156) this is tricky because it is impossible to
insert a Run Script phase between a compilation and linking phase
(well, you can do it in the GUI, but the script will nevertheless
only run after the linking phase).
And a workaround for this is to make a new target with only a compile
phase (which does the information writing to a temp file as mentioned
earlier) followed by a Run Script phase which reads the temp file and
does the actual compiling (and no linking phase after that). Next,
make your main target dependent on this newly created target and
remove the compilation phase from it (since that's now done in the
dependent target), so it only has a linking phase (and copy
resources etc) left.
* If you do generate the messages in a Run Script phase, the errors
are also collected in the "errors" smart folder, but (radar 4389264):
a) all errors collected there (at least those from scripts) will
disappear from that folder once you double-click on o≤ne of them.
Workaround: go to the build transcript and double-click on the errors
there.
b) if you rerun the script, all errors will re-appear there, along
with any newly generated errors by the script (so in the worst case,
all errors now appear twice/thrice/...). Workaround to get rid of all
those duplicates: clean the project.
I don't remember if b) also applies if you didn't double-click any of
the generated errors.
Jonas
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden