<?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; flashbuilder</title>
	<atom:link href="http://dispatchevent.org/tag/flashbuilder/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>Tue, 07 Feb 2012 19:22:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</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 &#8230; <a href="http://dispatchevent.org/mims/ant-for-flex-part-4/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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 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[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 &#8230; <a href="http://dispatchevent.org/mims/ant-for-flex-part-1/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></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>

