XCode Build Question

DesertPenguin
Unregistered
 
Post: #1
I am building my game with XCode.

When I build my target, the Copy Bundle Resources correctly copies my resources, like lua scripts or textures, into the bundle.

The problem is that if I only change my resources, I have to do a clean, then a build to get the new resources deployed. The project consists of 50 or so source code files, and a build takes more than 30 seconds.

Is there a way I can make XCode just execute the Copy Bundle Resources but not rebuild all the files. (e.g. avoid the clean?)

Thanks for any tips
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
Yes, Xcode is broken. There are other alternatives (my personal favorite being SCons for building and TextMate for editing), but if you want to stick with Xcode, your best bet is to make a custom shell script build phase to copy your resources.

Here's one from an [old] project of mine. Don't expect just to drop this in and have it work, but it should give you an idea of the kind of things you might have to do, anyway Smile

Code:
#!/usr/bin/env ruby

def execute(command)
    puts(command)
    system(command)
end

$resources_dir =
    "#{ENV['TARGET_BUILD_DIR']}/#{ENV['UNLOCALIZED_RESOURCES_FOLDER_PATH']}"
$source_dir = ENV['SOURCE_ROOT']

execute("mkdir -p '#{$resources_dir}'")

if ENV['BUILD_STYLE'] == 'Development' then
    if FileTest.exists?("#{$resources_dir}/Assets") then
        execute("rm -f '#{$resources_dir}/Assets'")
    end
    execute("ln -sf '#{$source_dir}/Resources/Assets' '#{$resources_dir}/Assets'")
else
    execute("cd Resources && tar -c --exclude-from ../FileExclusions.txt '.svn' Assets | tar -x --directory '#{$resources_dir}'")
end
Quote this message in a reply
DesertPenguin
Unregistered
 
Post: #3
Thanks for the quick reply.

And for the script.

And the fact it is in ruby is very appropriate, since I have been "exploring" both Ruby and Rails in my day job.

;-)
Quote this message in a reply
DesertPenguin
Unregistered
 
Post: #4
BTW - Can you give your impression of sCons? Is it worth learning? What about Rant?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
I personally love SCons. It's got its issues, but it's generally a very nice place to work.

I'd personally stay away from all build systems that don't have the full power of a scripting language in them. It's just something that makes life really easy if you have it, and really difficult if you don't.

That basically leave Cons, SCons and Rake... and rake can't do parallel builds, and Cons is superseded in every way by SCons Smile
Quote this message in a reply
DesertPenguin
Unregistered
 
Post: #6
Thanks for the feedback!

I wish there was an sCons which used Ruby instead of Python, but I guess I could bite the bullet and check out Python.

Have you looked at Rant at all?
http://rant.rubyforge.org/

It looks like it might be more of like sCons with Ruby, but it doesn't look like it has nearly as active of a community around it.

BTW - Is there any magic to building an app bundle from the command-line? I have been spoiled by xcode, and never really read much about it.

Also - Do you know if Apple has plans to improve XCode at all?

Thanks again for any feedback...
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #7
It looks like it's still a bit immature, to me -- in particular, no parallel builds mentioned in the documentation. Still, worth keeping an eye on.

There's no magic to building an app bundle, just put the right files in the right places. There's an SConstruct here you can steal if you like: http://onesadcookie.com/trac/browser/Astro/SConstruct

Of course Apple plans to "improve" Xcode -- take a look at their Leopard teaser site at some point to get an idea of what they're doing. Whether or not you think those improvements are important or not is up to you...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Question : Deploy xcode 3.1.3 to ios 5+ ? papaonn 6 5,831 Apr 12, 2012 08:37 PM
Last Post: MattDiamond
  xcode build optimizations NelsonMandella 5 6,816 Jul 24, 2009 06:39 AM
Last Post: Oddity007
  XCode doesn't realize a library has changed unless you force your project to build. XSTNX 6 5,679 Jun 8, 2009 10:25 AM
Last Post: XSTNX
  xcode build problem NelsonMandella 7 5,538 Apr 13, 2009 12:21 PM
Last Post: szymczyk
  Stupid xcode question: How do I turn off precompiled headers? SourceIT 2 7,178 Aug 30, 2008 12:53 PM
Last Post: SourceIT