From 3b9102f98953f5331b44af74b1aa670128b08b62 Mon Sep 17 00:00:00 2001 From: Demian Katz <demian.katz@villanova.edu> Date: Tue, 3 Jul 2012 12:13:02 -0400 Subject: [PATCH] Added try..catch wrapper to ensure that test system shuts down even if there is a fatal error during testing. Moved documentation task last; no point in generating docs for a broken build, and this lets CI find problems faster. --- build.xml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/build.xml b/build.xml index 6aa56a8beb9..7d1cc1ff613 100644 --- a/build.xml +++ b/build.xml @@ -20,11 +20,32 @@ <!-- Main Target --> <target name="main" description="main target"> + <phingcall target="startup" /> + <trycatch property="exceptionmsg"> + <try> + <phingcall target="ci-tasks" /> + </try> + <catch> + <phingcall target="shutdown" /> + <fail>Unexpected error during continuous integration tasks -- ${exceptionmsg}</fail> + </catch> + </trycatch> + <phingcall target="shutdown" /> + </target> + + <!-- Continuous Integration Tasks --> + <target name="ci-tasks" description="continuous integration tasks"> <!-- Create dirs --> <mkdir dir="${builddir}/reports"/> <mkdir dir="${builddir}/reports/coverage"/> + <!-- PHP CodeSniffer --> + <exec command="phpcs --standard=PEAR --extensions=php --report=checkstyle ${srcdir}/module/VuFind/src > ${builddir}/reports/checkstyle.xml" escape="false" /> + + <!-- PHPUnit --> + <exec dir="${srcdir}/tests" command="VUFIND_LOCAL_DIR=${srcdir}/local phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/" passthru="true" checkreturn="true" /> + <!-- PHP API Documentation --> <phpdoc title="API Documentation" destdir="${builddir}/apidocs" @@ -36,12 +57,6 @@ </fileset> </phpdoc> - <!-- PHP CodeSniffer --> - <exec command="phpcs --standard=PEAR --extensions=php --report=checkstyle ${srcdir}/module/VuFind/src > ${builddir}/reports/checkstyle.xml" escape="false" /> - - <!-- PHPUnit --> - <exec dir="${srcdir}/tests" command="VUFIND_LOCAL_DIR=${srcdir}/local phpunit -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/" passthru="true" checkreturn="true" /> - </target> <!-- Install and Activate VuFind --> -- GitLab