1

I am running an Applescript that runs Xcode 4, but the script ends no matter what, either if the build is successful or if it fails.

Is there any way that I can wait for Xcode to finish to build and get the result? In case of a success I can just end the Applescript with a success message, but if it fails I would like to get the logs that are printed in Xcode (where I get all the errors and details) and pass them to the script so they can be saved on a file.

Can someone point me to the right procedure to do this?

Philip Regan
  • 5,005
  • 2
  • 25
  • 39
  • I understand; but i am trying to look at the question and at the answer; your solution is correct for Xcode3, but it won't work on Xcode4 and I've marked correctly the question with the Xcode4 Tag, so to avoid confusion I didn't marked it with the checkmark since it does not fix the issue; but I can rate it since it is relevant and useful if you don't use Xcode4 but Xcode3. –  Aug 06 '11 at 00:29
  • Oh, I definitely don't deserve a checkmark here - I was plain wrong. I assumed Xcode 4 would work the same as Xcode 3, and it doesn't. But I'd say Philip Regan's answer probably deserves one. It may not fully solve the problem, but that's Apple's fault. To my mind, if no answer 100% solves the problem, the answer that gets you closest is the checkmark-answer. But it's absolutely still your decision. – Flambino Aug 06 '11 at 12:50
  • You have a good point here; I agree. BTW I gotta still find a way to run the build via Build command, so IF it will work i can test if your suggestion would work also on Xcode4; in that case you have nailed the question and deserve the checkmark –  Aug 06 '11 at 18:53

2 Answers2

0

Have you looked in the AppleScript dictionary for Xcode? Because when I look at the dictionary for Xcode 3.2, I see a command called build which takes an optional transcript argument.

build specifier : the object for the command
[static analysis boolean] : Perform static analysis along with the build.
[transcript boolean] : If given, then the full build transcript should be returned when the build finishes. Otherwise, a simple build status is returned.
[using build configuration type] : The build configuration type to use when building. If no build configuration type is given the active build configuration type is used.

I don't have an Xcode project that I can build to test this, but it would appear that you need to get the project you want to build and then call set build_results to (build the_project transcript true)

And even without the transcripts argument, you should get a build status back indicating whether the build succeeded.

Flambino
  • 18,507
  • 2
  • 39
  • 58
  • 1
    Thanks Flambino, but I use Xcode4, and sadly the build command won't work. I tried to set the project but in Xcode4 all the old code seems to not work properly, I am able to build just invoking the shortcut from the toolbar with a keystroke command. And this is where i am stuck now, since I have no clue how can i get the output out of Xcode console window. –  Aug 04 '11 at 23:02
0

Please see this question along with my answer, but essentially the build command in Xcode 4 does not work properly because of what looks to be an incomplete implementation on Apple's part. If the command actually returned a value, then Applescript would wait until it got a response before moving onto the next command.

Community
  • 1
  • 1
Philip Regan
  • 5,005
  • 2
  • 25
  • 39
  • Indeed i assume that all the problems are due the fact that there is an incomplete implementation from their side. The answer that you posted on the other post seems to go further than anything else I have tried; it still won't build (i get in the console -->missing value right after the build command); but at least is not giving me a set command error; so probably is the right way. Now how do i know what is the value of "theproject" and "thebuildconfigtype"? they look like enums but I can't tell on my project what would be the right number to use (and the dictionary don't help either) –  Aug 06 '11 at 00:36