Skip to content

Instantly share code, notes, and snippets.

@rodrigorm
Created March 16, 2011 12:52
Show Gist options
  • Save rodrigorm/872438 to your computer and use it in GitHub Desktop.
Save rodrigorm/872438 to your computer and use it in GitHub Desktop.
Ant build i'm using on CakePHP projects + Hudson CI
<project name="CakePHP" default="build">
<target name="clean">
<delete dir="build" />
</target>
<target name="prepare">
<mkdir dir="build/junit" />
<mkdir dir="build/logs" />
<chmod perm="a+rw">
<fileset dir="app/tmp" />
</chmod>
</target>
<target name="update-cake-core">
<sync todir="cake" verbose="true">
<fileset dir="cakephp/cake" />
</sync>
<chmod file="cake/console/cake" perm="u+x" />
</target>
<target name="simpletest" depends="install-simpletest" />
<target name="-check-simpletest-installed">
<available property="simpletest.exists" file="vendors/simpletest/reporter.php" />
</target>
<target name="install-simpletest" depends="-check-simpletest-installed" unless="simpletest.exists">
<exec dir="vendors" executable="wget" failonerror="true">
<arg line="http://sourceforge.net/projects/simpletest/files/simpletest/simpletest_1.0.1/simpletest_1.0.1.tar.gz/download -O simpletest_1.0.1.tar.gz" />
</exec>
<untar src="vendors/simpletest_1.0.1.tar.gz" dest="vendors" compression="gzip" />
<delete file="vendors/simpletest_1.0.1.tar.gz" />
</target>
<target name="simplehtmldom" depends="install-simplehtmldom" />
<target name="-check-simplehtmldom-installed">
<available property="simplehtmldom.exists" file="vendors/simplehtmldom/simple_html_dom.php" />
</target>
<target name="install-simplehtmldom" depends="-check-simplehtmldom-installed" unless="simplehtmldom.exists">
<exec dir="vendors" executable="git" failonerror="true">
<arg line="svn clone -s https://simplehtmldom.svn.sourceforge.net/svnroot/simplehtmldom -r182:HEAD simplehtmldom" />
</exec>
</target>
<target name="phpcpd" depends="prepare">
<exec executable="phpcpd" failonerror="false">
<arg line="--log-pmd build/logs/phpcpd.xml app/" />
</exec>
</target>
<target name="phpmd" depends="prepare">
<exec executable="phpmd" failonerror="false">
<arg line="app/ xml codesize,unusedcode,design --reportfile build/logs/pmd.xml" />
</exec>
</target>
<target name="migrate">
<exec executable="cake" failonerror="true">
<arg line="migration run all"/>
</exec>
<exec executable="cake" failonerror="true">
<arg line="migration run all -plugin favorites"/>
</exec>
<exec executable="cake" failonerror="true">
<arg line="migration run all -plugin tags"/>
</exec>
</target>
<target name="testsuite" depends="migrate, simpletest">
<exec executable="cake" failonerror="true">
<arg line="clover"/>
</exec>
</target>
<target name="selenium" depends="migrate, simpletest">
<exec executable="ruby" failonerror="true">
<env key="ROOT" value="${basedir}/app" />
<env key="BROWSERS" value="*firefox,*safari,*googlechrome" />
<arg line="plugins/ci/vendors/selenium_run_in_parallel.rb"/>
</exec>
</target>
<target name="build"
depends="clean, prepare, simplehtmldom, update-cake-core, migrate, testsuite, phpcpd, phpmd" />
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment