Xcode 3.x IDE for Processing development

I’ve been having a look at the Processing language (http://www.processing.org/). After using the Processing IDE for a while, I decided to try using the Xcode IDE instead of the Processing one. I’m a beginner with both Java and Processing, and I had a difficult time getting it to work. The only instructions I could find were for an older version of Xcode, and didn’t make sense with the new version. But I have it working now (at least as far as my testing can tell).

Here is what I’ve done:

  1. Create a new Java project in Xcode – I think I used Java Application or maybe Java Applet template.
  2. Copy core.jar from the processing library folder (/Applications/Processing 0135/lib/core.jar – in my case) into the lib folder in your Xcode project.  I couldn’t find any way to do this inside Xcode, I did it using Finder to copy the file.  The Xcode lib directory is automatically created in the directory you set for your Xcode project.
  3. Put the ‘data‘ sub-directory with your Processing applications resources (graphics and fonts) into the resources directory in your Xcode project.  It also works if you put it in the bin directory, but anything in there gets wiped out if you do a Clean before doing a build. I also did this outside of Xcode using Finder.
  4. I used the instructions from Chapter 14 of “Processing – Creative Coding and Computational Art” by Ira Greenberg on how to setup a Processing project inside the Java development environment. The Processing IDE is clever enough to run the same code if you want to move back into it. In the book he talks briefly about Java mode on page 162 and says that he will refer to it in more detail in Chapter 14. But the printed book I’ve got only goes up to Chapter 13. On the publishers site the book details page (http://www.friendsofed.com/book.html?isbn=159059617x) includes links to PDF versions of “Chapter 14: 3D Rendering in Java Mode” and an extra appendix – “Appendix C: Integrating Processing within Java”.  Both of which are very useful for trying to get Processing working in a Java IDE. Here is my first (very boring) test:

I’ve also set up a Subversion (SVN) repository and I’m using that from Xcode. I imported my project into SVN, deleted it and then checked it out from SVN. I’ve found the doing a Build -> Clean deletes the hidden SVN files and then you can’t commit the whole project because it thinks you don’t have those directories checked out. I’ve tried to find a fix for this but haven’t had any luck.

One suggestion I found while looking for a solution was to not have the build directory in the repository and to tell Xcode to use a directory outside the Project directory being managed by SVN. I’ve done this using Project -> Edit Project Settings. The Build Products location is set on the General tab.

But the Clean also removes the files from the jars, bin and dist directories which then can’t be committed to SVN.   I’d welcome any suggestions on how to fix this.

6 comments
  1. Generally, it’s not advisable to store any files in Subversion which can be recreated from source, such as the contents of build, bin, jar and dist directories. If you import the project to SVN straight after cleaning (i.e. without these folders), you should be able to check out a copy and work with it successfully. The folders will be created when you build, but you should not attempt to commit them to the repository. If you don’t want to see them listed when performing SVN operations, there is a command-line “svn ignore” option to tell SVN to take no notice of them.

  2. Thanks RUrob2. I’ve removed the build, bin, jar and dist directories from the SVN and then checked out a new copy. But trying to “Commit Project” still tries to work with the bin, jar and dist directories and fails. I’ve been looking at using svn:ignore, but can’t find a way to do it with Xcode. One way I’ve found suggest is to update the ~/.subversion/config to set the global-ignores parameter, but that doesn’t seem like a great idea as it might stop a legitimate file being backed up in the future. I tried it anyway, and it didn’t work.

    So it looks like in Xcode you can only commit individual files to SVN, which makes it a lot less useful than if you can commit all the changes in a project.

  3. There’s certainly no way to set svn:ignore from within Xcode: you have to use the command line, but at least it’s a once-only operation. There’s a reasonably clear and comprehensive explanation at:
    http://sdesmedt.wordpress.com/2006/12/10/how-to-make-subversion-ignore-files-and-folders/

    If you want to contact me directly, I’d be happy to have a closer look at what happens when you try and commit with the bin etc. directories. (I hope the website address I’ve entered on this form will show up.)

  4. Brenda, having looked at the details you sent me I think you’ve found a genuine bug, but there is an easy workaround.

    I tried creating a Java Application project using Xcode 3.0. I committed it before building, then checked out a copy and built, creating several directories including bin.

    I got the same error as you when I tried to commit by control-clicking on the project in the Groups & Files list. However, that’s not the way I usually commit. Instead, I use SCM – Commit Entire Project… from the menus. That seems to work OK.

    Note that I didn’t need to set svn:ignore to get the commit to work. The only advantage of svn:ignore is hiding the bin etc. directories from the svn status report (equivalent to menu command SCM – SCM Results).

  5. I did report it as a bug to Apple and after a bit of correspondence (they initially thought it was not a bug but an error in my use of SVN) they have matched it to another bug report which is being investigated by engineering. It is interesting that my report number is 5866673 and the one being worked on is 5907532. I think that this means that I won’t be able to track when they say it is fixed – the status of my report is already ‘closed’. Anyway, hopefully they will have it fixed soon.

Leave a Reply

Your email address will not be published.