I'm creating a build script for a large PHP application. I'm using an Ant script, being run by Jenkins.
I want to include tools such as PHP_CodeSniffer and PHPMD (PHP Mess Detector) in the build script, so I have code like this:
<target name="php-codesniffer">
<exec executable="phpcs" dir="${basedir}" output="${basedir}/build/logs/checkstyle.xml">
<arg line="--report=checkstyle --standard=PEAR ${basedir}/"/>
</exec>
</target>
<target name="phpmd">
<exec executable="phpmd" dir="${basedir}" output="${basedir}/build/logs/phpmd.xml">
<arg line="${basedir} xml codesize,unusedcode,naming"/>
</exec>
</target>
However both these tools take an excessively long period of time to run, even on small subsets of our code base, so I'm trying to find ways I can use them, but without the performance penalty.
My current thought is to run them only on files which have been modified in the current build, but I don't know Ant well enough to get it to do this.
So the question is how can I modify the above Ant targets such that the <exec>
calls only run for files which have been modified in the current build? (or alternatively in the last X minutes if Ant doesn't know about the current build).
Thanks for any help.