Permalink
Fetching contributors…
Cannot retrieve contributors at this time
91 lines (76 sloc) 2.95 KB
<?xml version="1.0"?>
<project name="memchaser@quality.mozilla.org" 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=""/>
<condition property="cfx.verbose" value="--verbose">
<isset property="verbose"/>
</condition>
<property name="cfx.verbose" 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="jpm" dir="extension" failonerror="true">
<arg line="${cfx.verbose} xpi"/>
</exec>
<echo>build.filename: ${build.filename}</echo>
</target>
<target name="run">
<exec executable="jpm" dir="extension" failonerror="true">
<arg line="${cfx.binary} run"/>
</exec>
</target>
<target name="test">
<exec executable="jpm"
dir="extension"
resultproperty="test.result"
failonerror="true">
<!-- The "prefs" parameter should be removed
once ESR38 has been desupported.
See https://github.com/mozilla/memchaser/pull/241 -->
<arg line="--verbose ${cfx.binary} --prefs test/prefs_workaround.json test"/>
</exec>
<fail message="Tests failed!">
<condition>
<not>
<equals arg1="${test.result}" arg2="0"/>
</not>
</condition>
</fail>
</target>
</project>