Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
221 lines (189 sloc) 8.89 KB
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<project name="YiiBooster" basedir="." default="dist"
description="Widget toolkit for the Yii web framework">
<!-- Changeable properties for this project are placed into the build.properties -->
<property file="./build/build.properties"/>
<!-- Main fileset containing files to be packaged for end-users. -->
<fileset id="sources" dir="${path.src}">
<include name="**"/>
</fileset>
<target name="all" depends="clean,check,doc,dist" />
<target name="check" depends="phploc, phpcpd, test, phpmd, phpcs, pdepend, codebrowser" />
<target name="doc" depends="apigen,annotated" />
<!-- Make an archive ready for distribution to end-users. -->
<target name="dist" depends="prepare-dist">
<propertyprompt useExistingValue="true" propertyName="project.version" defaultValue="beta"
promptText="What is the version of this release"/>
<property name="build.distfilename" value="${path.dist}/yiibooster-${project.version}.zip"/>
<echo msg="Packing the sources to ${build.distfilename} ..."/>
<zip destfile="${build.distfilename}">
<fileset refid="sources"/>
<fileset dir=".">
<include name="README.md"/>
<include name="INSTALL.md"/>
<include name="CHANGELOG.md"/>
<include name="LICENSE"/>
</fileset>
</zip>
</target>
<!-- Prepare the destination folder for distribution archive. -->
<target name="prepare-dist">
<echo msg="Recreating a distribution directory at ${path.dist}"/>
<delete dir="${path.dist}" includeemptydirs="true" failonerror="true" quiet="true"/>
<mkdir dir="${path.dist}"/>
</target>
<target name="prepare-reports-dir">
<if>
<not>
<available file="reports" type="dir" />
</not>
<then>
<echo msg="It seems we don't have `reports` directory, creating one..." />
<mkdir dir="reports" />
</then>
</if>
</target>
<target name="phploc" depends="prepare-reports-dir">
<exec executable="${path.composer.vendor}/bin/phploc" dir="." passthru="true">
<arg value="--verbose" />
<arg value="--progress" />
<arg value="--exclude" />
<arg value="assets" />
<arg value="--log-xml" />
<arg value="${path.reports}/phploc.xml" />
<!-- This "line" instead of "value" is extremely important, it allows us to specify several tokens as an argument -->
<arg line="${path.src} ${path.tests}" />
</exec>
</target>
<target name="prepare-docs-dir">
<if>
<not>
<available file="doc" type="dir" />
</not>
<then>
<echo msg="It seems we don't have `doc` directory, creating one..." />
<mkdir dir="doc" />
</then>
</if>
</target>
<!-- Make an API-level documentation -->
<target name="apigen" depends="prepare-docs-dir">
<exec executable="${path.composer.vendor}/bin/apigen" dir="." passthru="true">
<arg value="--config" />
<arg value="${path.build}/apigen.neon" />
<arg value="--destination" />
<arg line="${path.docs}/api" />
<arg value="--report" />
<arg line="${path.reports}/apigen.checkstyle.xml" />
</exec>
</target>
<!-- Make an annotated source code documentation (using Pinnocchio) -->
<target name="annotated" depends="prepare-docs-dir">
<echo msg="Running Pinnocchio over our source code base..."/>
<exec command="${path.composer.vendor}/bin/pinocchio --source=${path.src}/widgets --output=${path.docs}/annotated"
passthru="true"
returnProperty="annotated.return"/>
<if>
<not>
<equals arg1="${annotated.return}" arg2="0"/>
</not>
<then>
<echo msg="It seems you have a problem with your Pinnocchio setup."/>
<fail message="Error when trying to launch Pinnocchio."/>
</then>
<else>
<echo msg="Now you should be able to browse the annotated source code starting from ${path.docs}/annotated/index.html"/>
</else>
</if>
</target>
<!-- Run all tests -->
<target name="test" depends="prepare-reports-dir">
<echo msg="Running all existing tests..."/>
<!-- NO we will NOT use built-in "phpunit" task because it's pretty shitty compared to phpunit.xml -->
<exec executable="${path.composer.vendor}/bin/phpunit" passthru="true">
<arg value="--configuration"/>
<arg path="${path.tests}/phpunit.xml"/>
<arg value="--bootstrap"/>
<arg path="${path.tests}/bootstrap.php"/>
<!-- Logging setup -->
<arg value="--coverage-html"/>
<arg path="${path.reports}/coverage"/>
<arg value="--coverage-clover"/>
<arg path="${path.reports}/clover.xml"/>
<arg value="--testdox-text"/>
<arg path="${path.reports}/testdox.txt"/>
</exec>
</target>
<!-- We deliberately do not exclude anything to get duplication not necessarily in class definitions -->
<target name="phpcpd" depends="prepare-reports-dir">
<exec executable="${path.composer.vendor}/bin/phpcpd" dir="." passthru="true">
<arg value="--log-pmd" />
<arg value="${path.reports}/phpcpd.xml" />
<arg value="--min-lines" />
<arg value="4" />
<arg value="--fuzzy" />
<arg value="--progress" />
<arg line="${path.src}" />
</exec>
</target>
<!-- Checking the coding style within project with CodeSniffer. Intended to be used manually in console mode. -->
<target name="phpcs" depends="prepare-reports-dir">
<echo msg="Checking the code style..." />
<exec executable="${path.composer.vendor}/bin/phpcs" passthru="true">
<arg value="-p"/>
<arg value="--extensions=php" />
<arg value="--standard=${path.build}/ruleset.xml" />
<arg value="--tab-width=4" />
<arg value="--ignore=assets"/>
<arg value="--report-checkstyle=${path.reports}/checkstyle.xml" />
<arg path="${path.src}"/>
</exec>
</target>
<target name="phpmd" depends="prepare-reports-dir">
<exec executable="${path.composer.vendor}/bin/phpmd" dir="." passthru="true">
<arg value="--reportfile" />
<arg value="${path.reports}/phpmd.xml" />
<arg value="--exclude" />
<arg value="${path.src}/assets" />
<arg value="${path.src}" />
<arg value="xml" />
<arg value="${path.build}/phpmd.xml" />
</exec>
</target>
<target name="pdepend" depends="prepare-reports-dir">
<exec executable="${path.composer.vendor}/bin/pdepend" dir="." passthru="true">
<arg value="--ignore=assets" />
<!-- Note that this option is for INPUT file, not GENERATED one! -->
<arg value="--coverage-report=${path.reports}/clover.xml" />
<arg value="--summary-xml=${path.reports}/pdepend.xml" />
<arg value="--jdepend-chart=${path.reports}/jdepend.svg" />
<arg value="--overview-pyramid=${path.reports}/overview.svg" />
<arg value="${path.src}" />
</exec>
</target>
<!-- Generating the highlighted sources with the marks from Code Sniffer and Mess Detector (and code coverage, too) -->
<target name="codebrowser" depends="prepare-reports-dir">
<echo msg="Generating the browsable codebase..." />
<exec executable="${path.composer.vendor}/bin/phpcb" passthru="true">
<arg value="--log"/>
<arg path="${path.reports}"/>
<arg value="--output"/>
<arg path="${path.reports}/codebrowser/"/>
<arg value="--source"/>
<arg path="${path.src}"/>
</exec>
</target>
<!-- Prepare the destination folder for distribution archive. -->
<target name="prepare-dist">
<echo msg="Recreating a distribution directory at ${path.dist}"/>
<delete dir="${path.dist}" includeemptydirs="true" failonerror="true" quiet="true"/>
<mkdir dir="${path.dist}"/>
</target>
<target name="clean">
<echo msg="Purging all runtime directories"/>
<delete dir="${path.dist}" includeemptydirs="true" failonerror="false" quiet="false"/>
<delete dir="${path.reports}" includeemptydirs="true" failonerror="false" quiet="false"/>
<delete dir="${path.docs}" includeemptydirs="true" failonerror="false" quiet="false"/>
<echo msg="Now your codebase should be completely clean."/>
</target>
</project>
Something went wrong with that request. Please try again.