Permalink
Fetching contributors…
Cannot retrieve contributors at this time
86 lines (72 sloc) 2.76 KB
<?xml version="1.0"?>
<project name="memchaser" default="dev">
<property name="xpi.dir" value="./xpi"/>
<tstamp>
<format property="build.number" pattern="yyyyMMddHHmm"/>
</tstamp>
<condition property="cfx.binary" value="-b ${binary}">
<isset property="binary"/>
</condition>
<property name="cfx.binary" value=""/>
<target name="release" depends="version"
description="Builds a release version">
<property name="xpi.filename" value="${ant.project.name}-${build.version}.xpi"/>
<antcall target="package"/>
</target>
<target name="dev" depends="version"
description="Builds a development version">
<antcall target="package"/>
</target>
<target name="package" depends="clean, version">
<property name="xpi.filename" value="${ant.project.name}-${build.version}-${build.number}.xpi"/>
<mkdir dir="${xpi.dir}"/>
<move file="${build.filename}" tofile="${xpi.dir}/${xpi.filename}"/>
<echo>package.filename: ${xpi.dir}/${xpi.filename}</echo>
</target>
<target name="clean"
description="Clean-up XPI directory">
<delete dir="${xpi.dir}"/>
</target>
<target name="version" depends="build" unless="build.version"
description="Shows the current version">
<!-- we would need to depend on external libraries to read the version number
from package.json, so instead we extract the extension to a temporary location
and read the version from install.rdf before removing the temporary folder. -->
<unzip src="${build.filename}" dest="temp"/>
<xmlproperty file="temp/install.rdf" collapseAttributes="true"/>
<property name="build.version" value="${RDF.Description.em:version}"/>
<delete dir="temp"/>
<echo>build.version: ${build.version}</echo>
</target>
<target name="build">
<property name="build.filename" value="extension/${ant.project.name}.xpi"/>
<delete file="${build.filename}"/>
<exec executable="/bin/sh" dir="addon-sdk" failonerror="true">
<arg value="-c"/>
<arg value=". bin/activate;cd ../extension;cfx xpi"/>
</exec>
<echo>build.filename: ${build.filename}</echo>
</target>
<target name="run">
<exec executable="/bin/sh" dir="addon-sdk" failonerror="true">
<arg value="-c"/>
<arg value=". bin/activate;cd ../extension;cfx run ${cfx.binary}"/>
</exec>
</target>
<target name="test">
<exec executable="/bin/sh"
dir="addon-sdk"
resultproperty="test.result"
failonerror="true">
<arg value="-c"/>
<arg value=". bin/activate;cd ../extension;cfx test ${cfx.binary}"/>
</exec>
<fail message="Tests failed!">
<condition>
<not>
<equals arg1="${test.result}" arg2="0"/>
</not>
</condition>
</fail>
</target>
</project>