Ant Build Files
4 posts • Page 1 of 1
Ant Build Files
In order to make it easier to get new projects up and running in a more traditional manner, and to make it easier to work with different development tools & IDEs, I've written a couple of Ant build files that may be of interest. They differ from those generated by the PBEManager in a couple of ways:
Now, you can use the standard project help command with Ant:
incidentally, to eliminate duplication as much as possible this reads the first line of the description from the pbeproj file. The idea is that any properties that are local to your environment go into this file, and it doesn't get checked in to version control. Also, if you're using a Mac or Linux based environment you can just set this up once and then link the file into each project (there may be a way to do this in recent versions of Windows as well, but I don't know how).
The version of the build file designed for applications adds targets to compile for web or Air, to package the Air app, and to run the Air app via the debug launcher.
In case somebody just dives in without looking at the project help first, I've added a more descriptive error message, like so:
There's still some duplication in that the dependencies which are already specified in the pbeproj file are duplicated in the compile targets, but I can't see an easy way around this given the that the Ant tasks that Adobe provide do not support resources. This is marked in comments in the files.
Areas that could be improved further:
Update: problems uploading the files to the forum, so they're linked from http://ianp.org/2009/05/ant-build-files ... tonengine/
- first off, I use 2 different build files, one for libraries and one for applications, this keeps the sizes down (3K/6K vs ~20K); and second
- I've added a project description with some useful information in, I feel that this is a better approach than forcing people to read through comments in build files.
Now, you can use the standard project help command with Ant:
- Code: Select all
BoxTwoDPhysics$ ant -projecthelp
Buildfile: build.xml
Components for using the Box2D physics library
Set up the localtion of your Flex SDK by adding a file called
'build.properties' containing FLEX_HOME=... .
To compile a debug build run 'ant'
To compile a debug build run 'ant -DDEBUG=true'
Main targets:
clean Remove all of the generated files.
compile Compile the SWC file.
docs Generate the API documentation.
Default target: compile
incidentally, to eliminate duplication as much as possible this reads the first line of the description from the pbeproj file. The idea is that any properties that are local to your environment go into this file, and it doesn't get checked in to version control. Also, if you're using a Mac or Linux based environment you can just set this up once and then link the file into each project (there may be a way to do this in recent versions of Windows as well, but I don't know how).
The version of the build file designed for applications adds targets to compile for web or Air, to package the Air app, and to run the Air app via the debug launcher.
In case somebody just dives in without looking at the project help first, I've added a more descriptive error message, like so:
- Code: Select all
BoxTwoDPhysics$ ant
Buildfile: build.xml
-preinit:
-init:
BUILD FAILED
/Users/ianp/Workspaces/a3d/BoxTwoDPhysics/build.xml:28: Missing Flex SDK!
Either FLEX_HOME is not set, or it points to a missing directory.
Set the FLEX_HOME parameter by adding it to the build.properties file
(you may need to create this file if it is not already present);
otherwise, you may specify it by using '-DFLEX_HOME=...' when you
invoke ant.
Total time: 0 seconds
There's still some duplication in that the dependencies which are already specified in the pbeproj file are duplicated in the compile targets, but I can't see an easy way around this given the that the Ant tasks that Adobe provide do not support resources. This is marked in comments in the files.
Areas that could be improved further:
- read the dependencies from the pbeproj files
- work out how to pass resources in to the mxmlc and compc tasks as mentioned above, there is a FlexFileSet type defined in the SDK, but just adding it with a typedef doesn't seem to work.
Update: problems uploading the files to the forum, so they're linked from http://ianp.org/2009/05/ant-build-files ... tonengine/
-
ianp - Posts: 6
- Joined: Fri May 22, 2009 8:33 pm
Re: Ant Build Files
Hey - realized I haven't replied to this one. Great work, ian! I'm going to be revisiting the build system (probably post-Grunts), and I will definitely be looking into this.
Ben Garney PushButton Labs
-
bengarney - Employee
- Posts: 1519
- Joined: Wed Jan 14, 2009 7:21 pm
- Location: Eugene, OR
Re: Ant Build Files
While we're on the topic of ant build files, I noticed the output of the PBEManager (r189) Ant batch files refer to Ant.exe, which just results in a CLI error. Removal of the .exe in the Build.bat and Clean.bat batch files results in desired behavior when using said batch files
.
-
hatboyzero - Posts: 14
- Joined: Sun Jun 28, 2009 3:23 am
Re: Ant Build Files
Gotta say it again - great work, Ian! 
I am folding parts of this into the engine proper - you can see my notes on the process at this thread.
I am folding parts of this into the engine proper - you can see my notes on the process at this thread.
Ben Garney PushButton Labs
-
bengarney - Employee
- Posts: 1519
- Joined: Wed Jan 14, 2009 7:21 pm
- Location: Eugene, OR
4 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest