weblinks/build.xml

116 lines
4.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project name="Weblinks" default="make" basedir=".">
<tstamp>
<format property="build.date" pattern="%Y-%m-%d" />
</tstamp>
<property file="build.ini" />
<target name="help">
<echo>Use `$ phing -l` to list the available targets.</echo>
</target>
<target name="make-dev" description="Builds the extension release package for development testing." depends="rebuild-extension-archives">
<echo msg="Deleting old development build." />
<delete quiet="yes" includeemptydirs="true">
<fileset dir="releases">
<include name="pkg_${package}_dev.zip" />
</fileset>
</delete>
<echo msg="Making the development ${package} package ." />
<zip destfile="releases/pkg_${package}_dev.zip">
<fileset dir="build">
<include name="**" />
</fileset>
</zip>
</target>
<target name="make" description="Builds the extension release package for a version." depends="rebuild-extension-archives">
<echo msg="Making the ${package} package for version ${version}." />
<zip destfile="releases/pkg_${package}_${version}.zip">
<fileset dir="build">
<include name="**" />
</fileset>
</zip>
</target>
<target name="rebuild-extension-archives" description="Rebuilds the archive (zip) files for each extension.">
<mkdir dir="build" />
<mkdir dir="releases" />
<echo msg="Cleaning build directory." />
<delete quiet="yes" includeemptydirs="true">
<fileset dir="*">
<include name="build" />
</fileset>
</delete>
<echo msg="Creating extension archives (zip files)." />
<foreach param="extension" target="build-archive">
<fileset dir="src">
<include name="com_*" />
<include name="mod_*" />
<include name="plg_*" />
<include name="tpl_*" />
</fileset>
</foreach>
<copy todir="build" >
<fileset dir="src">
<include name="language/**" />
<include name="pkg_${package}.xml" />
</fileset>
</copy>
</target>
<target name="build-archive" description="Builds an archive for a single extension.">
<zip destfile="build/${extension}.zip" basedir="src/${extension}" />
</target>
<target name="replace-deploy-version" description="Replaces the `__DEPLOY_VERSION__` markers with a designated tag and commits the changes.">
<echo>Replacing "__DEPLOY_VERSION__" with "${version}".</echo>
<reflexive>
<fileset dir=".">
<include pattern="*.md" />
<include pattern="src/**/*.php" />
</fileset>
<filterchain>
<replaceregexp>
<regexp pattern="__DEPLOY_VERSION__" replace="${version}"/>
</replaceregexp>
</filterchain>
</reflexive>
</target>
<target name="tag" description="Tags the repository using git.">
<gitcommit repository="." message="Tagging release `${version}`." allFiles="true" />
<gittag repository="." name="${version}" annotate="true" message="${version}" />
<!--<gitpush repository="." all="true" />-->
<echo>Push tags manually with `$ git push --tags origin`.</echo>
</target>
<target name="set-version" description="Sets the &lt;version&gt; tag in all XML files with the version from the build.ini file.">
<phingcall target="replace-xml">
<property name="tag" value="version" />
<property name="tagValue" value="${version}" />
</phingcall>
</target>
<target name="replace-xml" description="[PRIVATE] Sets an XML tag with a new value.">
<echo message="Replacing '${tag}' tag with '${tagValue}'."/>
<reflexive>
<fileset dir=".">
<include pattern="src/**/*.xml" />
</fileset>
<filterchain>
<replaceregexp>
<regexp pattern="&lt;${tag}&gt;(.*?)&lt;/${tag}&gt;"
replace="&lt;${tag}&gt;${tagValue}&lt;/${tag}&gt;"/>
</replaceregexp>
</filterchain>
</reflexive>
</target>
</project>