Since I’ve made the switch to an FDT powered Eclipse as my primary editor I explored the potential use of Ant (another neato tool) to assist in the development of the projects I work on. I read the Ant definitive guide and found that its pretty simple to set up.
There’s a few tasks in specific I was looking for. I’ll be looking into sync, ideally it will look at the differences between local and remote directories, but I’ll have to hunt down some more
Create local backups.
You can automate the creation of backups; tar.gz’s or zips, through ant. Here’s a block of code to take a look at
target name="backup_local" depends="init" description="backup the current state of the local site" tar tarfile="${tarball.tar}" basedir="${basedir}" includes="**" excludes="archives/**, resources/**, .*, **.settings*, build.xml" / gzip zipfile="${tarball.tar.gz}" src="${tarball.tar}" / delete file="${tarball.tar}"/ /target
I setup a bunch of properties to allow some of these setting to be tweaked at the top of the build file. There are a bunch of excludes that I use to stop some of the files from being backed up.
Deployment on a live ftp server.
You’ll need to get ftp to work with ant in eclipse first. It will require commons-net.jar and Jakarta ORO JAR file java objects. first before you use the following kind of snippet.
target name="deploy" echo message="deployLocalDir : ${deployLocalDir}"/ echo message="deployServer : ${deployServer}"/ echo message="deployUserId : ${deployUserId}"/ echo message="deployRemoteDir : ${deployRemoteDir}"/ mkdir dir="${deployLocalDir}"/ ftp action="mkdir" server="${deployServer}" userid="${deployUserId}" password="${deployPwd}" remotedir="${deployRemoteDir}"/ ftp server="${deployServer}" remotedir="${deployRemoteDir}" userid="${deployUserId}" password="${deployPwd}" depends="yes" binary="no" separator="${remoteSeperator}" verbose="yes" fileset dir="${deployLocalDir}" include name="**"/ exclude name="**/.svn"/ exclude name="**/CVS/**"/ /fileset /ftp /target
I’ll have to check to make sure it removes the .svn and cvs files in addition to .DS_Store files, if they exist.
Compile swfs through fdt.
You’ll need to use an ant target like:
target name="compile" depends="init" description="--> compiles all the main swfs needed" fdt.flashCompile file="${localSourceDir}/${projectName}/index.fla" timeout="1000"/ /target
Dont forget to set the eclipse IDE to use the same JRE. (from fdt)
1. Run -> External Tools -> External Tools … 2. Select your Ant Build 3. Select the Tab “JRE” 4. Switch from “Seperate JRE” to “Run in the same JRE as the workspace”
Nate is currently a Senior Presentation Layer Architect at Razorfish Chicago. As an SPLA Nate: participates in technology leadership team and resource allocations, manage fulltime and contractor resources, represents technology for groups of brands across multiple clients, furthers development of standards within the office, architects project implementations and fosters community and mentoring.