I just committed an initial pass at an Xcode builder for CruiseControl. If you want to try it out you’ll need to get the latest code from svn. Right now the plugin is extremely rudimentary: it has only the single attribute ‘directory’ which is where it will invoke xcodebuild.
Here’s an example from config.xml for capturing the images below:
<project name="RaiseMan">
<listeners>
<currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
</listeners>
<modificationset quietperiod="30">
<svn localworkingcopy="${BookProjects}/${project.name}"/>
</modificationset>
<schedule interval="60">
<xcode directory="${BookProjects}/${project.name}"/>
</schedule>
<publishers>
<artifactspublisher dest="artifacts/${project.name}"
file="${BookProjects}/${project.name}/xcodebuild.cc.output"/>
</publishers>
</project>
Even though the plugin is very simple has all the basics. Like the Ant builder can monitor the build output while it’s happening from the dashboard, and you can see errors and warnings in the jsp reporting app and in email. But unlike the Ant builder you can also publish the build log as an artifact so that you an view it later as plain text.
Hope you like it!



18 Comments
The xcode builder is part of the CruiseControl 2.8.1 release. Since this blog post I’ve added a timeout attribute and a way to specify command-line args. Documentation here.
Hi. I like the new builder. Very handy.
However, I’ve noticed a couple of issues, and the CC website doesn’t make it clear how to report them. But I’ve found my way here, hoping to get your attention. Just email me at the provided address when you get this, and I’ll tell you what I’m seeing.
-M
I’m a committer on CruiseControl so you can always report issues on either the CruiseControl users mailing list or on the issue tracker.
And if by chance the issue is a problem using nested args, I committed a fix for that tonight that you can get by pulling the latest source.
When will an official CC release be made that includes the “args” support in the Xcode builder? I gather if I want to get this early I need to start with the current SVN repository. I’m not too keen on that for a production environment.
I’m trying out the execbuilder in the meantime.
I’m hoping to have the next CC release out by this weekend. Would have been out already if I hadn’t been delayed by hardware problems.
But on the good side, Time Capsule works! ;)
The new release is out and you can download it now.
Just set up CC for the first time, so I could try your Xcode support.
I have added 3 of my projects to the config.xml, but am finding that the ‘xcodebuild.cc.output’ file is not getting written into the folder specified by the ‘directory’ setting for each project.
In fact, each project appears to have the cc.output file written out to the folder of the FIRST project that CC built when launching it. This results in a failure at the end of builds, where the cc.output file can’t be found (it attempts to find it in the project folder but it’s actually in another project’s folder).
Has anyone else reported this to you? I will find and sign up for the appropriate mailing list and post there, but I just thought I’d leave feedback here in case that’s helpful.
Kind Regards.
Thanks for pointing out the bug. As I mentioned on the CC mailing list I’ve fixed it and you can get the source now and build it locally or just wait until 2.8.3 is released.
Does the Xcode builder pass on the standard CC builder properties to Xcode as env vars? If not, it should. In particular, I want ${svnrevision}, so my pre-build script in my Xcode project can use it to update the version #.
No, the Xcode builder isn’t passing any environment variables, though I agree it would be a good idea. Patches gratefully accepted. :)
I don’t know if it helps in your case but it will do property substitution with the command-line, so if there was some way to pass a value through xcodebuild on the command-line that would work.
This should be obvious, and I’ve looked at the source, but just to verify: neither the svn element in the modification set nor the xcode builder actually update the working copy.
I assume that typically with the ant builder, the build script has a target to update the working copy. So in this case we would need to add another step. I was thinking of using a compound builder to first have an exec task do the repository update, then run the xcode builder.
Is that more or less correct?
Thanks.
Hi Matt,
Yep, you got it.
Jtf
I’m having problems passing arguments through to xcodebuild. In my config.xml I have the following:
However the build doesn’t run properly and I see the following output on the Cruisecontrol console:
[cc]Aug-04 17:15:46 XcodeBuilder – starting build
[cc]Aug-04 17:15:46 ScriptRunner – unknown option: -project MyProject.xcodeproj
[cc]Aug-04 17:15:46 ScriptRunner – Usage: xcodebuild [-project ] [-activetarget] [-alltargets] [-target ]… [-parallelizeTargets] [-activeconfiguration] [-configuration ] [-sdk |] [-xcconfig ] [=]… []…
[cc]Aug-04 17:15:46 ScriptRunner – xcodebuild [-version [-sdk [|] [] ]
[cc]Aug-04 17:15:46 ScriptRunner – xcodebuild [-showsdks]
[cc]Aug-04 17:15:46 ScriptRunner – xcodebuild [-find -sdk |]
[cc]Aug-04 17:15:46 ScriptRunner – xcodebuild [-list]
[cc]Aug-04 17:15:46 XcodeBuilder – build finished with exit code 1
If I run xcodebuild manually with these arguments, the build works perfectly:
xcodebuild -project MyProject.xcodeproj -target LogicTests -sdk iphonesimulator4.0
I’m using CruiseControl 2.8.3 binary release.
Hi,
I just installed CC 2.8.4 and configured a xcode project. Although, the build itself goes through fine, it throws the error about missing xcodebuild.cc.output.
Is this a known issue or am I missing something ?
I see different stack traces in the logs:
[cc]Feb-03 01:10:32 ScriptRunner – setenv XCODE_APP_SUPPORT_DIR /Developer/Library/Xcode
java.io.FileNotFoundException: /Users/ratheesh/Desktop/work/MIS/projects/Prototype/xcodebuild.cc.output/xcodebuild.cc.output (No such file or directory)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.(FileOutputStream.java:177)
at net.sourceforge.cruisecontrol.util.BuildOutputLogger.consumeLine(BuildOutputLogger.java:88)
at net.sourceforge.cruisecontrol.util.CompositeConsumer.consumeLine(CompositeConsumer.java:67)
at net.sourceforge.cruisecontrol.util.StreamPumper.consumeLine(StreamPumper.java:141)
at net.sourceforge.cruisecontrol.util.StreamPumper.run(StreamPumper.java:128)
at java.lang.Thread.run(Thread.java:680)
And,
[cc]Feb-03 01:10:33 XcodeBuilder – error creating reader for file /Users/ratheesh/Desktop/work/MIS/projects/Prototype/xcodebuild.cc.output
java.io.FileNotFoundException: /Users/ratheesh/Desktop/work/MIS/projects/Prototype/xcodebuild.cc.output (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileReader.(FileReader.java:55)
at net.sourceforge.cruisecontrol.builders.XcodeBuilder$OutputFile.createReader(XcodeBuilder.java:228)
at net.sourceforge.cruisecontrol.builders.XcodeBuilder$OutputFile.hasMoreLines(XcodeBuilder.java:197)
at net.sourceforge.cruisecontrol.builders.XcodeBuilder.elementFromFile(XcodeBuilder.java:74)
at net.sourceforge.cruisecontrol.builders.XcodeBuilder.build(XcodeBuilder.java:46)
at net.sourceforge.cruisecontrol.Schedule.build(Schedule.java:169)
at net.sourceforge.cruisecontrol.Project.build(Project.java:227)
at net.sourceforge.cruisecontrol.Project.execute(Project.java:148)
at net.sourceforge.cruisecontrol.ProjectConfig.execute(ProjectConfig.java:408)
at net.sourceforge.cruisecontrol.ProjectWrapper.run(ProjectWrapper.java:69)
That isn’t a problem I’ve encountered before, but I haven’t been building XCode projects lately. The XCodeBuilder is trying to capture the output from XCode to look for the line ** BUILD FAILED **. If you’re getting that error it means that XCode has no build output… which is strange, at least from what I had seen when I created the plugin 2 years ago.
I recommend you try testing this by creating a compile error and then seeing if CruiseControl catches the problem. If it does, then I guess all is well. If not, then I’d see if perhaps XCode’s command-line behavior has change so that it is no longer producing the same output.
Jtf
I had to change a few things in 2.8.4 sources to get this to work.
1) For the first stack trace in my previous post:
In XCodeBuilder.runScript():
Changed
getBuildOutputConsumer(projectName, file.file, file.file.getName());
to
getBuildOutputConsumer(projectName, directory.toFile(), file.file.getName());
2) For the second stack trace, I found that ScriptRunner.runScript() deletes the output file before XCodeBuilder.elementFromFile() has a chance to read the output file.
So, I commented out the buildOutputConsumer.clear(); call towards the end of ScriptRunner.runScript(). And, added a delete call after XCodeBuilder.elementFromFile() is done.
Do those indicate some configuration issue on my end ? or a potential bug in 2.8.4 release ?
Thanks
Hi, I’m having exactly the same problem, even with the latest svn code from cruisecontrol.
I’ve added the 1st modification mentioned by Ratheesh, but the 2nd fails in some tests, so I can’t get the final binary.
There is a plan to fix this in the future?
Thanks
I saw the same problem as Ratheesh when I upgraded to 2.8.4. I ended up downgrading back to 2.8.3 because of the issue.
4 Trackbacks/Pingbacks
[...] is now a recently released Xcode builder for CruiseControl. However, we use Bamboo for CI for our Java and Ruby projects and are considering moving to [...]
[...] not found a lot on how to do continuous integration in iPhone development, but I did come across one interesting article by Jeffrey Fredrick that explained how to use Cruise Control on Xcode [...]
[...] is now a recently released Xcode builder for CruiseControl. However, we use Bamboo for CI for our Java and Ruby projects and are considering moving to [...]
[...] is now a recently released Xcode builder for CruiseControl. However, we use Bamboo for CI for our Java and Ruby projects and are considering moving to [...]
Post a Comment