Game Development Community

Ant script you can use to make your resources directory for XCode

by Ray Graham · in iTorque 2D · 03/07/2009 (5:39 pm) · 1 replies

Hi,

I don't know how many of you guys are familiar with Ant, but I wanted to share this little script that I made. The purpose of it is to copy the resources that you want to be put into your final XCode build of your game and ensure that those that you do not want are not in it -- i.e. source code files, debug/test levels, etc.

Copy this to a file called "build.xml" and place it in the "engine" directory (for example; it's not where I put it, but go ahead).

<project name="My Game" default="all" basedir=".">

<property name="src" value= "relative/path/to/tgb/root"/>
<property name="dest" value="xcode-resources"/>

<target name="clean">
<delete dir="${dest}"/>
</target>

<target name="init">
<mkdir dir="${dest}"/>
</target>

<target name="copy">
<copy todir="./${dest}">
<fileset dir="${src}">
<exclude name="**/*.cs"/>
<exclude name="**/*.t2dProj"/>
<exclude name="**/*.gui"/>
<exclude name="**/*.log"/>
</fileset>
</copy>
<copy todir="${dest}" file="${src}/main.cs"/>
<copy todir="${dest}/game/gameScripts" file="${src}/game/gameScripts/datablocks.cs"/>
</target>

<target name="all" depends="clean,init,copy"/>

</project>

In my game, I had to include datablocks.cs for some reason, but your game likely doesn't. So you can probably comment out that particular copy. I still don't know why I needed it.

Enjoy!

#1
03/07/2009 (5:40 pm)
And I have no idea how to nicely format code in the forums. :)