<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>dispatchEvent()™ &#187; ant</title>
	<atom:link href="http://dispatchevent.org/tag/ant/feed/" rel="self" type="application/rss+xml" />
	<link>http://dispatchevent.org</link>
	<description>Collective thoughts on the Flash Platform, iOS, Unity, and any other technology we use.</description>
	<lastBuildDate>Mon, 23 Apr 2012 19:07:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 4 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-4/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-4/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 03:31:43 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[flashbuilder]]></category>
		<category><![CDATA[flexbilder]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=771</guid>
		<description><![CDATA[Part 1 Part 2 Part 3 Part 4 Now that you&#8217;ve been through 3 exhaustive tutorials on ant for flex, it&#8217;s time to use your knowledge you&#8217;ve gained to turn your back on the built-in Flex compiler and switch to ant for your builds. This part applies to FlexBuilder (and FlashBuilder) users only although it [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-1/">Part 1</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">Part 2</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a></li>
<li>Part 4</li>
</ul>
<p>Now that you&#8217;ve been through 3 exhaustive tutorials on ant for flex, it&#8217;s time to use your knowledge you&#8217;ve gained to turn your back on the built-in Flex compiler and switch to ant for your builds. This part applies to FlexBuilder (and FlashBuilder) users only although it may apply if you&#8217;re using some other eclipse-based plugin. If you&#8217;re using another program like TextMate or Flash CSx, you can skip this article.<br />
<span id="more-771"></span></p>
<h3>Replacing the default builder with your ant tasks</h3>
<p>The rest of this article will show you how to use your ant build script to perform the building actions found in FlashBuilder.</p>
<p>In FlashBuilder, the following building actions can be executed</p>
<ul>
<li><strong>Build Project &#8211; </strong>Occurs when the user manually builds the project.</li>
<li><strong>Build Automatically &#8211; </strong>When the option is checked in the Project menu, the code is automatically build when you save a file. Usually incrementally.</li>
<li><strong>Clean</strong> &#8211; &#8216;cleans&#8217; the project folder by doing a complete, non-incremental build and removing temporary files.</li>
</ul>
<p>These actions are all called by various actions and handled by one or more <em>builders</em>. In terms of the eclipse SDK, a builder is an XML file that describes how the various build actions will be executed. In FlashBuilder, all of these are set up to use the Flex &#8220;builder&#8221; by default. You can add new customized builders to supplement these build actions. You can also deactivate the default builder an just use your ant builds instead <strong>but you will lose the ability to see inline errors in your code</strong>.</p>
<p>In order for this to work however, you need to start out with some solid, well-tested ant tasks.</p>
<h4>Step 1 &#8211; Create the appropriate ant targets</h4>
<p>Create a target in your build.xml for each of the actions listed above. Call each target &#8220;build&#8221;, &#8220;autoBuild&#8221;, and &#8220;clean&#8221;. You can probably start with the &#8220;build&#8221; target and reuse it for the other two. To write an incremental build target (used for the build-automatically action) there is an example in<a href="http://dispatchevent.org/mims/ant-for-flex-part-2/"> Part 2</a> of this article.</p>
<p>Before moving on, please test your build script thoroughly to be sure there are no errors and that your files are compiling correctly.</p>
<p>Note, I&#8217;m not going to go into the details here about exactly how to write your ant script. If you&#8217;re considering switching to ant as your primary builder then A) your project has special needs that need to be addressed by a custom build script and I don&#8217;t know what those needs are and B) you need to know what you&#8217;re doing with ant before completely abandoning FlashBuilder&#8217;s defaults. I will say, save the fancy stuff for your release build targets and do incremental builds by default since you&#8217;ll be running these scripts quite a lot.</p>
<h4>Step 2 &#8211; Create a builder for your ant build script</h4>
<ol>
<li>Open the properties for the project you want to edit. <strong>Project -&gt; Properties</strong></li>
<li><strong>Select the Builders item</strong> in the left menu. You will see that the default builder &#8220;Flex&#8221; is already set up.</li>
<li><strong>Click the New&#8230; button</strong>. A dialog will come up with templates for the new builder.</li>
<li><strong>Choose the &#8220;Program&#8221; type</strong>. (On my configuration, I see an option for &#8220;Ant Builder&#8221; also which is what I should probably be using, however, I haven&#8217;t gotten it to work yet and it doesn&#8217;t seem to generate any specific errors when it fails so I gave up and went with Program. If you know how to fix this, let me know!)</li>
<li><strong>Name the builder &#8220;flexAntBuilder&#8221;</strong></li>
<li><strong>Set the location field to the ant binary you&#8217;re using.</strong> If you&#8217;re not sure where the binary is located, you can use the command <code>which ant</code> in the command line. Mine is at <code>/usr/bin/ant</code></li>
<li><strong>Set the Working directory to your project&#8217;s home directory</strong>. If you&#8217;re not sure, browse to it.</li>
<li><strong>In the arguments field, enter the name of the target you want to run. </strong>In this case <code>build</code>.</li>
<li><strong>Optional: Click on the Refresh tab.</strong> Here you can chose whether to refresh the files in your workspace when the build completes.</li>
<li><strong>Click on the Build Options tab. </strong>Here, under the &#8220;Run the Builder:&#8221; heading near the bottom, is where you&#8217;re going to set the properties that determine when this particular task is run. For the &#8216;build&#8217; target, <strong>uncheck everything except &#8220;During Manual Builds&#8221;.</strong>
<ul>
<li>For your &#8220;autoBuild&#8221; target, you&#8217;re going to uncheck everything except &#8220;During auto builds&#8221;</li>
<li>For your &#8220;clean&#8221; target, you&#8217;re going to uncheck everything except &#8220;After a clean&#8221;</li>
</ul>
</li>
<li><strong>Repeat steps 1-10 for the other two targets.</strong></li>
<li>When all targets are added,<strong> </strong><strong>optionally</strong><strong> uncheck the &#8220;flex&#8221; builder from the builders menu in your project properties to use the ant tasks exclusively.</strong> Now your ant scripts will be used instead of the flex builder.</li>
</ol>
<p>That&#8217;s it! Be sure to test things and make sure you&#8217;re not getting any errors.</p>
<h4>What to expect from here</h4>
<p>So you&#8217;ve unchained yourself from the system and are using your ant scripts to build your project. Congratulations, you&#8217;re a huge nerd! From this point on, changing the compile settings in the Project Properties dialog (like the build path) may be ineffective. You&#8217;ll need to make changes to your build path in the ant file.</p>
<p>The results from your builds will appear in the Console view. Here you can see the progress of builds and check for errors in the code. As I mentioned before, if you deactivate the flex builder you won&#8217;t get inline errors in your code any longer.</p>
<p>Finally, adding the new builders will create a new invisible folder in your project&#8217;s root folder called .externalToolBuilders where your builder definitions will be kept. You don&#8217;t need to do anything with this folder, but be aware that it&#8217;s there.</p>
<p>That concludes this 4 part epic post about ant tasks for flex! I hope you found it useful. If you have anything to add, please post comments!</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-4/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 3 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-3/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-3/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:31:16 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=763</guid>
		<description><![CDATA[Part 1 Part 2 Part 3 Part 4 This third installment talks about tips and tricks for using ant with version control systems. Defining external properties for each user Since not everyone&#8217;s machine is the same and letting everyone build a project is a major reason to use ant, it&#8217;s good to avoid hard coding [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-1/">Part 1</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">Part 2</a></li>
<li>Part 3</li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a></li>
</ul>
<p>This third installment talks about tips and tricks for using ant with version control systems.<br />
<span id="more-763"></span></p>
<h3>Defining external properties for each user</h3>
<p>Since not everyone&#8217;s machine is the same and letting everyone build a project is a major reason to use ant, it&#8217;s good to avoid hard coding paths to files within your build.xml file. As such, I use a lot of &lt;property&gt; tags to set up paths and such. But you also don&#8217;t want to have several people constantly editing your build.xml because it could get broken or out of sync. Oh no! What do we do!?</p>
<p>Luckily, ant lets you define a set of properties in an external file. This is a simple text file containing name=value pairs and commented using #. By default, the recommended filename is build.properties.  Here&#8217;s an example:<br />
<script src="http://gist.github.com/234318.js"></script></p>
<h4>build.properties and version control</h4>
<p>If you&#8217;re working with multiple people, you are probably using a version control system like svn. If you are and you want to avoid people accidentally checking in a build.properties file there are a couple of simple tricks. First, create a copy of build.properties and call it <em>built.properties.template</em> and check that into the repository. Then each user can make a local copy called build.properties. You can also add build.properties to the ignore list for your folder using SVN so that noone will accidentally check it in. Run <code>svn pe svn:ignore</code> and add build.properties to the list. Finally, if you need to make sure that your users have a local copy of  build.properties, <em>there&#8217;s a task for that!â„¢</em> <script src="http://gist.github.com/234320.js"></script></p>
<h3>Adding SVN tasks</h3>
<p>As I work with SVN quite a lot, I found that including SVN in my builds can be quite useful. For example you could:</p>
<ul>
<li>Update your working copy when doing a clean build.</li>
<li>Check in a release build automatically.</li>
<li>Export your source code without those pesky .svn files to be included in a zip file.</li>
<li>Include the revision number of the working copy as a constant definition in the code using <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_21.html#246171">conditional compiliation</a>.</li>
</ul>
<p>To do this, you&#8217;ll need to first download the SVN tasks for ant. They can be found on the <a href="http://subclipse.tigris.org/svnant.html">Tigris.org</a> website. Please note, that these tasks are a part of <a href="http://subclipse.tigris.org/">SubClipse</a>, which is a free interface for working with Subversion from within Eclipse. I don&#8217;t know if the tasks will work without subclispe, but if you haven&#8217;t used it, I&#8217;d definitely recommend trying it out anyway.  By the way, if you use CVS, there are already tasks included in ant.  Once they&#8217;re downloaded, add the task .jars to the libs/ant folder in your project. You&#8217;ll need to use another &lt;typedef&gt; tag in your build script to get these to work. Here&#8217;s an example snippet that simply runs an update on the working copy. You can see all the available commands in the <a href="http://subclipse.tigris.org/svnant/svn.html">svnant documentation</a>.  <script src="http://gist.github.com/234312.js"></script></p>
<p>That&#8217;s it for part 3. In <a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a>, I&#8217;ll talk about setting up a builder for your ant file in FlashBuilder.</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 2 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-2/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-2/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:20:37 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[build]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[tasks]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=760</guid>
		<description><![CDATA[Part 1 Part 2 Part 3 Part 4 In this part, I get more nitty-gritty about working with flex&#8217;s ant tasks. Using the flex ant tasks I spent quite a lot of time making tweaks to get my scripts to use the Flex tasks and hopefully, now you won&#8217;t have to. In the end, there&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-1/">Part 1</a></li>
<li>Part 2</li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a></li>
</ul>
<p>In this part, I get more nitty-gritty about working with flex&#8217;s ant tasks.<br />
<span id="more-760"></span></p>
<h3>Using the flex ant tasks</h3>
<p>I spent quite a lot of time making tweaks to get my scripts to use the Flex tasks and hopefully, now you won&#8217;t have to. In the end, <strong>there&#8217;s very little benefit to using the official Flex ant tasks over using a generic &lt;exec&gt; task</strong> (a type of ant task that simply runs an executable file with nested &lt;arg&gt; tags for command line arguments) <strong>and if you&#8217;re having trouble with them, I&#8217;d recommend abandoning the flex tasks and using $lt;exec&gt;</strong>. The main thing I had trouble with was getting the &lt;taskdef&gt; tag to work correctly.</p>
<p>For those new to ant, a &lt;taskdef&gt; tag is a required tag that defines a third-party ant task within the build.xml file. It associates a task name with a .jar file (compiled from the java code for the task). In the case of flex tasks, the java file is typically located within your flexbuilder sdk directory. On my mac, that&#8217;s here:</p>
<p>/Applications/Adobe\ Flash\ Builder\ Plug-in\ Beta\ 2/sdks/${SDK_VERSION}/ant/lib</p>
<p>Where ${SDK_VERSION} is your target sdk version (e.g. 4.0.0). There are a few ways to load additional tasks into your build.xml file. All of them require you to reference the .jar&#8217;s location somehow and then define a new task using &lt;taskdef&gt;.</p>
<ol>
<li><strong>Copy the .jar file for the task into ant&#8217;s lib directory.</strong> I don&#8217;t personally like this option because it makes it very difficult to switch between different versions of the sdk. Also, it requires all users of the script to copy the files on their local machines. (You can also add it to ~/<code>.ant/lib </code>to control the libraries on a user level)</li>
<li><strong>Reference the .jar file&#8217;s location using a command line argument -lib</strong>. Even worse than the first option since it requires each user to add the library manually every time the build script is run.</li>
<li><strong>Include the .jar&#8217;s location inside the build script.</strong> It took me a long time to figure this one out since I didn&#8217;t see it in the manual for ant, but it&#8217;s certainly my preferred method for adding tasks. It allows you to keep everything self contained within the build.xml so changing the location of the .jar is as simple as setting a property in the build script.</li>
</ol>
<p>When using the 3rd option, you then have the question of where is the best place to put the .jar files you want to link to. There are two options that make sense to me.</p>
<ol>
<li>The best place to put non-core tasks required by your build (for a Flex project) is in ${project_home}/libs/ant. This allows you to check your tasks into a repository along with your other referenced files (like .swc files).</li>
<li>Optionally, for the flex tasks you could reference the .jar file directly in the sdk folder. Use this option if the version number of the SDK doesn&#8217;t matter. If it does matter, use the first option. I use this option in my snippet below.</li>
</ol>
<h4>Linking to the official Flex ant tasks</h4>
<p>Here&#8217;s a sample of my flex task definition along with some path definitions that point to various parts of Flex. I said this was a no B.S. guide so if you paste this snippet into your build script, you should be able to use the Flex tasks.<br />
<script src="http://gist.github.com/233455.js?file=FlexAntTaskDefs.xml"></script></p>
<h4>Using the tasks</h4>
<p>Now we have the &lt;typedef&gt; in place and we can actually create a task to compile something. Again, I&#8217;m not going to go into all the details of what <a href="http://ant.apache.org/manual/using.html#targets">targets</a> are all about or go into all the details about the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_22.html">flex compilers</a>. There are plenty of other tutorials about that. Instead, I&#8217;ll show you a basic target to build an mxml file that is adequate for 95% of projects. Note: you may need to edit the properties defined in these scripts so that they point to the right paths for your project.</p>
<p><script src="http://gist.github.com/234291.js"></script> The toughest part about using these tasks is the seemingly arbitrary words that they expect for the attribute names of some tags (like using <em>path-element</em> in the &lt;source-path&gt; tag but <em>dir</em> in the &lt;library-path&gt; tag). Now the same but this time building a library SWC.  <script src="http://gist.github.com/234288.js"></script></p>
<h4>Making an incremental build</h4>
<p>By default, FlexBuilder uses incremental builds when compiling your source code (except for clean builds). This is a very useful feature of the compiler because it saves time by only compiling the parts of your code that have changed since the last build. You can create an incremental build simply using ant by defining a second task that adds a flag  for incremental building like so. Note that  allows you to run other targets from within a target.</p>
<p><script src="http://gist.github.com/234287.js"></script></p>
<h4>What about ASDocs?</h4>
<p>Even though there are tasks for asc, compc, mxmlc, and generating HTML wrappers, they didn&#8217;t bother to include an asdoc task (actually, they did in Flex SDK 4.0.0). But that&#8217;s okay! As I hinted at earlier, you can still use the  task to run this (as you can for all the other commands) and not only that, it&#8217;s way easier to set up than the official flex tasks! In fact, the only reason that I can think of to use the flex tasks is that they would automatically  use the windows or mac version of the executable depending on your platform. Here&#8217;s an example for asdoc.  <script src="http://gist.github.com/234294.js"></script></p>
<p>That concludes part 2. In <a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a>, I&#8217;ll talk about working with version control systems in ant.</p>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Using ant for Flex &#8211; a no B.S. guide &#8211; Part 1 of 4</title>
		<link>http://dispatchevent.org/mims/ant-for-flex-part-1/</link>
		<comments>http://dispatchevent.org/mims/ant-for-flex-part-1/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 01:15:52 +0000</pubDate>
		<dc:creator>Mims H Wright</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Greatest Hits]]></category>
		<category><![CDATA[Tips, Tricks, and Hacks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[flashbuilder]]></category>
		<category><![CDATA[flexbuilder]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[tasks]]></category>

		<guid isPermaLink="false">http://dispatchevent.org/?p=746</guid>
		<description><![CDATA[After spending hours wrangling with my ant build script and finally making everything work correctly, I am convinced of two things: ant is a very powerful tool for compiling code but it can also do so much more. The support for ant for flex online is abysmally frustrating. So, I&#8217;d love to share with you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dispatchevent.org/wp-content/uploads/2009/11/QueenAnt.jpg"><img class="alignnone size-full wp-image-784" title="ant" src="http://dispatchevent.org/wp-content/uploads/2009/11/QueenAnt.jpg" alt="About to burst with build targets" width="159" height="159" /></a></p>
<p>After spending hours wrangling with my ant build script and finally making everything work correctly, I am convinced of two things:</p>
<ol>
<li><a href="http://ant.apache.org/manual/index.html">ant</a> is a very powerful tool for compiling code but it can also do so much more.</li>
<li>The support for ant for flex online is abysmally frustrating.</li>
</ol>
<p>So, I&#8217;d love to share with you some of the tips I&#8217;ve picked up after tweaking my script to the point where it finally worked!</p>
<h3>Introducing ant</h3>
<p>First of all, let me introduce the basics of what ant is. I couldn&#8217;t really say it better than the thousands of nameless editors of <a href="http://en.wikipedia.org/wiki/Apache_Ant">WikiPedia</a>.</p>
<blockquote><p><strong>Apache Ant</strong> is a software tool for <a title="Build automation" href="http://en.wikipedia.org/wiki/Build_automation">automating software build</a> processes. It is similar to <a title="Make (software)" href="http://en.wikipedia.org/wiki/Make_%28software%29">Make</a> but is implemented using the <a title="Java (programming language)" href="http://en.wikipedia.org/wiki/Java_%28programming_language%29">Java</a> language, requires the Java platform, and is best suited to building Java projects.</p>
<p>The most immediately noticeable difference between Ant and Make is that Ant uses <a title="XML" href="http://en.wikipedia.org/wiki/XML">XML</a> to describe the build process and its dependencies, whereas Make has its Makefile format. By default the XML file is named <code>build.xml</code>.</p>
<p>Ant is an <a title="Apache Software Foundation" href="http://en.wikipedia.org/wiki/Apache_Software_Foundation">Apache</a> project. It is <a title="Open source software" href="http://en.wikipedia.org/wiki/Open_source_software">open source software</a>, and is released under the <a title="Apache Software License" href="http://en.wikipedia.org/wiki/Apache_Software_License">Apache Software License</a>.</p></blockquote>
<p>So in short, ant lets you use an XML based script to run a series of commands typically used to build software projects. It was originally designed to be &#8220;for Java, in Java&#8221; but it&#8217;s popularity and ease of use has created interest beyond the Java community. For flex, ant can be used for compiling ActionScript and Flex projects into SWFs, creating SWC files, generating documentation with ASDocs, and other actions associated with compiling.</p>
<p>There are a lot of great tutorials online that can cover the basics of how ant works so I&#8217;m not going to go into a general overview in this article. Instead, I&#8217;m going to try to focus on some of the practical aspects of getting a build set up when working with Flex. However, here are some links to the <a href="http://ant.apache.org/manual/">official ant documentation</a> some helpful tutorials for the basics:</p>
<p><a href="http://www.allapplabs.com/ant/ant_basics.htm">Ant Basics tutorial</a></p>
<p><a href="http://flexblog.faratasystems.com/2006/12/05/intro-to-building-and-deploying-flex-applications-with-ant">Another basics tutorial (this time for Flex)</a></p>
<p><a href="http://livedocs.adobe.com/flex/3/html/help.html?content=anttasks_1.html">Official Flex documentations</a></p>
<p><a href="http://wiki.apache.org/ant/AntTasks">Ant Folklore</a></p>
<p>After the jump, I&#8217;ll get into some of the ways that ant can be useful for Flash and Flex projects.<br />
<span id="more-746"></span> </p>
<h4>Applications for Flex users</h4>
<p>Is ant right for you? It depends. For most cases, using the standard Run and Debug functions in FlashBuilder or Flash will be completely sufficient. However, if you work on a large development team or on a project with a complicated build process, it might save the group a lot of headache. Here&#8217;s a list of situations where I think Flex ant tasks can be helpful.</p>
<ul>
<li>Whenever your project requires you to make adjustments to the standard build process. For example, when you need to add additional flags to your compiler string.</li>
<li>For Flex projects that are distributed widely, e.g. open source projects, where the configuration of the users&#8217; dev environment is unknown. Build scripts allow users of various versions of FlexBuilder, FDT, or Flex SDK users on different operating systems to all be able to compile a project with more or less the same settings.</li>
<li>If running or building your project requires you to configure options in the command line or to run a local server.</li>
<li>For building release versions of an app and for deploying your app. For example, compiling, zipping and copying an app to a server using FTP.</li>
<li>When you&#8217;re a total nerd and you want to use ant just so you can say you did it.</li>
</ul>
<h3>Beyond Compiling</h3>
<p>One of the main benefits of using ant is that I think many people are unaware of is that it can be  used for many things beyond running compilers. For example, in <a href="http://code.google.com/p/kitchensynclib/">KitchenSync</a>, I use a <a href="http://code.google.com/p/kitchensynclib/source/browse/trunk/build.xml">build script</a> to create a temp folder, compile a SWC file into the temp folder, create an SVN export of the source folder into the temp folder, zip the source and SWC and name it with the current version number, then delete the temp folder.</p>
<p>There are loads of <a href="http://ant.apache.org/manual/coretasklist.html">core tasks</a> that are already defined within the ant library. They handle all types of common actions in the command line. There are even additional <a href="http://ant.apache.org/manual/optionaltasklist.html">optional tasks</a> that add higher-level functionality like copying files to a server using SSH or validating an XML file. Finally, additional tasks can be added simply by creating a new Java class that is a subclass of <code>org.apache.tools.ant.Task</code>. You probably won&#8217;t do this yourself, but there are a number of third-party programs that have created &#8216;plug-in&#8217; tasks for ant such as SVN.</p>
<p>Once Flex projects became larger and more complex, many users began to look for more customizable options and began using ant. A couple of years back, Adobe released some official ant tasks which can now be found bundled in every version of the Flex SDK. However, as I said before the documentation of exactly how to get these tasks running is vague at best.</p>
<p>In <a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">part 2</a>, I&#8217;ll talk about the details of getting flex ant tasks running.</p>
<ul>
<li>Part 1</li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-2/">Part 2</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-3/">Part 3</a></li>
<li><a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Part 4</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://dispatchevent.org/mims/ant-for-flex-part-1/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

