Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Apache Ant tagets for Composer commands.
<?xml version="1.0" encoding="UTF-8"?>
<project name="Composer Targets" default="build">
<property name="builddir" value="${basedir}/build"/>
<property name="composer" value="${builddir}/composer.phar"/>
<target name="php-check">
<condition property="php" value="php">
<not>
<isset property="${php}"/>
</not>
</condition>
</target>
<target name="prepare">
<mkdir dir="${builddir}" />
</target>
<target name="composer-check" depends="prepare">
<available file="${composer}" property="composer.present"/>
</target>
<target name="composer-download" depends="composer-check" unless="composer.present">
<property name="composer.noselfupdate" value="true"/>
<get src="https://getcomposer.org/composer.phar" dest="${composer}"/>
</target>
<target name="composer-selfupdate" depends="php-check,composer-download" unless="composer.noselfupdate">
<exec executable="${php}">
<arg value="${composer}"/>
<arg value="self-update"/>
<arg value="--quiet"/>
</exec>
</target>
<target name="composer" depends="composer-selfupdate" unless="composer.noupdate" description="Run composer update">
<exec executable="${php}">
<arg value="${composer}"/>
<arg value="update"/>
</exec>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment