New Ant Script for Firefox Add Ons
![]()
After trying a half dozen different methods for building Firefox add-ons, I have settled on a single ant script I put together. The following ant script (build.xml file) will create a directory, copy all files into it, delete irrelevant files, zip up the file, name it with an .xpi extension, and delete the temporary folder it made to do all of this. All of this typically takes less than five seconds, most of which is file copying. Just place the following into a file named build.xml, and place that file in the root folder of your project (change the word flipclock to the name you wish for your add-on):
<project name=”flipclock” default=”build” basedir=”.”>
<description>Build .xpi file by Christopher Ditto for distribution/installation of a Firefox extension.</description>
<!– set global properties for this build –>
<property name=”app.name” value=”flipclock” />
<property name=”build.dir” value=”${basedir}/build”/>
<target name=”build” description=”Generate the distribution”>
<delete dir=”${build.dir}” />
<copy todir=”${build.dir}”>
<fileset dir=”${basedir}” includes=”**/*.*” excludes=”build,.svn,.project,**/*.bat,**/*.psd,**/.tmp*,**/.svn,build.xml,*.xpi” />
</copy>
<zip destfile=”${app.name}.xpi” basedir=”${build.dir}”/>
<delete dir=”${build.dir}” />
</target>
</project>
Your console output should resemble:
