Skip to content

Commit

Permalink
Updated phing/phing to 3.0 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
sturkel89 authored Jul 8, 2024
1 parent 1fa81d4 commit a51e814
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 20 deletions.
60 changes: 41 additions & 19 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
<property name="srcdir" value="${project.basedir}" override="true" />
<property name="skip_phpdoc" value="false" />
<property name="sh" value="/bin/sh" />
<property name="phpdoc_version" value="3.3.1" />
<property name="phpunit_command" value="${srcdir}/vendor/bin/phpunit" />

Expand Down Expand Up @@ -40,40 +41,51 @@
</target>

<!-- Report rule violations with PHPMD (mess detector) -->
<target name="phpmd">
<exec command="${srcdir}/vendor/bin/phpmd ${srcdir}/src xml ${srcdir}/tests/phpmd.xml --exclude ${srcdir}/tests --reportfile ${builddir}/reports/phpmd.xml" />
</target>

<!-- PHP_Depend code analysis -->
<target name="pdepend">
<exec command="${srcdir}/vendor/bin/pdepend --jdepend-xml=${builddir}/reports/jdepend.xml --jdepend-chart=${builddir}/reports/dependencies.svg --overview-pyramid=${builddir}/reports/pdepend-pyramid.svg ${srcdir}/src" />
<target name="phpmd">
<exec executable="${srcdir}/vendor/bin/phpmd">
<arg line="${srcdir}/src xml ${srcdir}/tests/phpmd.xml --exclude ${srcdir}/tests --reportfile ${builddir}/reports/phpmd.xml" />
</exec>
</target>

<!-- PHP CodeSniffer -->
<target name="phpcbf">
<exec command="${srcdir}/vendor/bin/phpcbf --standard=${srcdir}/tests/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
<exec executable="${srcdir}/vendor/bin/phpcbf" escape="false" passthru="true" checkreturn="true">
<arg line="--standard=${srcdir}/tests/phpcs.xml" />
</exec>
</target>
<target name="phpcs">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/tests/phpcs.xml --report=checkstyle &gt; ${builddir}/reports/checkstyle.xml" escape="false" />
<exec executable="${srcdir}/vendor/bin/phpcs" escape="false">
<arg line="--standard=${srcdir}/tests/phpcs.xml --report=checkstyle &gt; ${builddir}/reports/checkstyle.xml" />
</exec>
</target>
<target name="phpcs-console">
<exec command="${srcdir}/vendor/bin/phpcs --standard=${srcdir}/tests/phpcs.xml" escape="false" passthru="true" checkreturn="true" />
<exec executable="${srcdir}/vendor/bin/phpcs" escape="false" passthru="true" checkreturn="true" >
<arg line=" --standard=${srcdir}/tests/phpcs.xml" />
</exec>
</target>

<!-- Phpstan -->
<target name="phpstan-checkstyle">
<exec command="${srcdir}/vendor/bin/phpstan --configuration=${srcdir}/tests/phpstan.neon --memory-limit=2G --error-format=checkstyle analyse &gt; ${builddir}/reports/phpstan-checkstyle.xml" escape="false" passthru="true" checkreturn="true" />
<exec executable="${srcdir}/vendor/bin/phpstan" escape="false" passthru="true" checkreturn="true">
<arg line="--configuration=${srcdir}/tests/phpstan.neon --memory-limit=2G --error-format=checkstyle analyse &gt; ${builddir}/reports/phpstan-checkstyle.xml" />
</exec>
</target>
<target name="phpstan-console">
<exec command="${srcdir}/vendor/bin/phpstan --configuration=${srcdir}/tests/phpstan.neon --memory-limit=2G analyse" escape="false" passthru="true" checkreturn="true" />
<exec executable="${srcdir}/vendor/bin/phpstan" escape="false" passthru="true" checkreturn="true">
<arg line="--configuration=${srcdir}/tests/phpstan.neon --memory-limit=2G analyse" />
</exec>
</target>

<!-- php-cs-fixer (first task applies fixes, second task simply checks if they are needed) -->
<target name="php-cs-fixer">
<exec command="${srcdir}/vendor/bin/php-cs-fixer fix --config=${srcdir}/tests/vufind.php-cs-fixer.php --verbose" passthru="true" escape="false" />
<exec executable="${srcdir}/vendor/bin/php-cs-fixer" passthru="true" escape="false">
<arg line="fix --config=${srcdir}/tests/vufind.php-cs-fixer.php --verbose" />
</exec>
</target>
<target name="php-cs-fixer-dryrun">
<exec command="${srcdir}/vendor/bin/php-cs-fixer fix --config=${srcdir}/tests/vufind.php-cs-fixer.php --dry-run --verbose --diff" passthru="true" escape="false" checkreturn="true" />
<exec executable="${srcdir}/vendor/bin/php-cs-fixer" passthru="true" escape="false" checkreturn="true">
<arg line="fix --config=${srcdir}/tests/vufind.php-cs-fixer.php --dry-run --verbose --diff" />
</exec>
</target>

<!-- PHP API Documentation -->
Expand Down Expand Up @@ -106,30 +118,40 @@
</fileset>
</phpdoc2>
-->
<exec command="php ${srcdir}/vendor/bin/phpDocumentor-${phpdoc_version}.phar --cache-folder=${builddir}/docs_cache --title=&quot;VuFindHarvest API Documentation&quot; -t ${builddir}/apidocs -d ${srcdir}/src" passthru="true" />
<exec executable="php" passthru="true">
<arg line="${srcdir}/vendor/bin/phpDocumentor-${phpdoc_version}.phar --cache-folder=${builddir}/docs_cache --title=&quot;VuFindHarvest API Documentation&quot; -t ${builddir}/apidocs -d ${srcdir}/src" />
</exec>
</then>
</if>
</target>

<!-- PHPUnit -->
<target name="phpunit" description="Run tests">
<exec dir="${srcdir}" command="${phpunit_command} -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" />
<exec dir="${srcdir}" executable="${sh}" passthru="true" checkreturn="true">
<arg line="-c &apos;${phpunit_command} -dzend.enable_gc=0 --log-junit ${builddir}/reports/phpunit.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/&apos;" />
</exec>
</target>

<!-- PHPUnit without logging output -->
<target name="phpunitfast" description="Run tests">
<exec dir="${srcdir}" command="${phpunit_command} -dzend.enable_gc=0" passthru="true" checkreturn="true" />
<exec dir="${srcdir}" executable="${sh}" passthru="true" checkreturn="true">
<arg line="-c &apos;${phpunit_command} -dzend.enable_gc=0&apos;" />
</exec>
</target>

<!-- Set up dependencies -->
<target name="startup" description="set up dependencies">
<exec command="composer install" />
<exec executable="composer">
<arg line="install" />
</exec>
</target>

<!-- Clean up -->
<target name="shutdown" description="clean up file system">
<delete dir="${srcdir}/vendor" includeemptydirs="true" failonerror="true" />
<delete file="${srcdir}/composer.lock" failonerror="true" />
<exec command="git reset --hard" />
<exec executable="git">
<arg line="reset --hard" />
</exec>
</target>
</project>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"phpmd/phpmd": "2.15.0",
"phpstan/phpstan": "1.10.59",
"phpunit/phpunit": "10.5.11",
"phing/phing": "2.17.4",
"phing/phing": "3.0",
"squizlabs/php_codesniffer": "3.9.0"
},
"autoload": {
Expand Down

0 comments on commit a51e814

Please sign in to comment.