Skip to content
This repository has been archived by the owner on Sep 8, 2019. It is now read-only.

Commit

Permalink
Added a build process to run analysis and generate documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
axelitus committed Jan 9, 2014
1 parent 81ceba0 commit 4956f18
Show file tree
Hide file tree
Showing 8 changed files with 482 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
vendor/
composer.lock

# Code Coverage
# Build
build/
log/
64 changes: 64 additions & 0 deletions build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Defaults
name=${phing.project.name}
root=${project.basedir}

# Source
src.dir=${root}/src

# Resources
res.dir=${root}/res

# Vendor
vendor.dir=${root}/vendor

# Phing
phing.exec=${vendor.dir}/phing/phing/bin/phing
phing.args=

# Build
build.dir=${root}/build
build.bin.dir=${build.dir}/${name}
build.doc.dir=${build.dir}/doc
build.log.dir=${build.dir}/log

# Composer
composer.exec=php composer.phar
composer.args=install --dev

# PHP Code Sniffer
phpcs.log.dir=${build.log.dir}/phpcs
phpcs.log.xml=${phpcs.log.dir}/phpcs-output.xml
phpcs.log.json=${phpcs.log.dir}/phpcs-output.json
phpcs.log.xslt=${res.dir}/phpcs.xslt
phpcs.log.html=${phpcs.log.dir}/phpcs-output.htm
phpcs.msg=Executing PHP Code Sniffer. The output is in the '${phpcs.log.dir}' directory.
phpcs.dir=${vendor.dir}/squizlabs/php_codesniffer
phpcs.exec=${phpcs.dir}/scripts/phpcs
phpcs.args=--standard=PSR2 --report-checkstyle=${phpcs.log.xml} --report-json=${phpcs.log.json} ${src.dir}

# PHP Mess Detector
phpmd.log.dir=${build.log.dir}/phpmd
phpmd.log.xml=${phpmd.log.dir}/phpmd-output.xml
phpmd.log.xslt=${res.dir}/phpmd.xslt
phpmd.log.html=${phpmd.log.dir}/phpmd-output.htm
phpmd.msg=Executing PHP Mess Detector. The output is in the '${phpmd.log.dir}' directory.
phpmd.dir=${vendor.dir}/phpmd
phpmd.exec=${phpmd.dir}/phpmd/src/bin/phpmd
phpmd.args=${src.dir} xml cleancode,codesize,controversial,design,naming,unusedcode --reportfile ${phpmd.log.xml}

# PHPUnit
phpunit.log.dir=${build.log.dir}/phpunit
phpunit.msg=Executing PHPUnit. The output is in the '${phpunit.log.dir}' directory.
phpunit.dir=${vendor.dir}/phpunit
phpunit.exec=${phpunit.dir}/phpunit/phpunit.php
phpunit.args=--configuration ${root}/phpunit.build.xml

# PHPDocumentor
phpdoc.log.dir=${build.log.dir}/phpdoc
phpdoc.msg=Executing PHPDocumentor. The output is in the '${phpdoc.log.dir}' directory.
phpdoc.dir=${vendor.dir}/phpdocumentor
phpdoc.exec=${phpdoc.dir}/phpdocumentor/bin/phpdoc.php
phpdoc.args=-d ${src.dir} -t ${phpdoc.log.dir}

# PHP Documentor

2 changes: 2 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
./vendor/phing/phing/bin/phing
68 changes: 68 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>

<project name="axelitus/base" basedir="." default="build">
<property file="./build.properties"/>

<!-- Clean build -->
<target name="build:clean" description="Cleans the previous build">
<delete dir="${build.dir}"/>
</target>

<!-- Prepare the build -->
<target name="build:prepare" depends="build:clean" description="Removes old build directories and creates new ones">
<!-- Create build directories -->
<mkdir dir="${build.bin.dir}"/>
<mkdir dir="${build.log.dir}"/>
<mkdir dir="${build.doc.dir}"/>
</target>

<!-- Install composer dependencies -->
<target name="build:composer" description="Installs the composer dependencies">
<exec command="${composer.exec} ${composer.args}" passthru="true"/>
</target>

<!-- PHP Code Sniffer -->
<target name="build:phpcs" description="Runs PHP Code Sniffer">
<exec command="${phing.exec} ${phing.args} script:phpcs" passthru="true"/>
</target>
<target name="script:phpcs">
<mkdir dir="${phpcs.log.dir}"/>
<echo msg="${phpcs.msg}"/>
<exec command="${phpcs.exec} ${phpcs.args}" passthru="true"/>
<xslt file="${phpcs.log.xml}" tofile="${phpcs.log.html}" style="${phpcs.log.xslt}"/>
</target>

<!-- PHP Mess Detector -->
<target name="build:phpmd" description="Runs PHP Mess Detector">
<exec command="${phing.exec} ${phing.args} script:phpmd" passthru="true"/>
</target>
<target name="script:phpmd">
<mkdir dir="${phpmd.log.dir}"/>
<echo msg="${phpmd.msg}"/>
<exec command="${phpmd.exec} ${phpmd.args}" passthru="true"/>
<xslt file="${phpmd.log.xml}" tofile="${phpmd.log.html}" style="${phpmd.log.xslt}"/>
</target>

<!-- PHPUnit -->
<target name="build:phpunit" description="Runs PHP Mess Detector">
<exec command="${phing.exec} ${phing.args} script:phpunit" passthru="true"/>
</target>
<target name="script:phpunit">
<mkdir dir="${phpunit.log.dir}"/>
<echo msg="${phpunit.msg}"/>
<exec command="${phpunit.exec} ${phpunit.args}" passthru="true"/>
</target>

<!-- PHPDocumentor -->
<target name="build:phpdoc" description="Runs PHP Mess Detector">
<exec command="${phing.exec} ${phing.args} script:phpdoc" passthru="true"/>
</target>
<target name="script:phpdoc">
<mkdir dir="${phpdoc.log.dir}"/>
<echo msg="${phpdoc.msg}"/>
<exec command="${phpdoc.exec} ${phpdoc.args}" passthru="true"/>
</target>

<!-- Build -->
<target name="build" depends="build:prepare, build:composer, build:phpcs, build:phpmd, build:phpunit, build:phpdoc"/>
</project>
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"php": ">=5.4.9"
},
"require-dev": {
"phing/phing": "2.6.*",
"phpunit/phpunit": "3.7.*",
"squizlabs/php_codesniffer": "1.5.*",
"phpmd/phpmd" : "1.5.*",
Expand Down
36 changes: 36 additions & 0 deletions phpunit.build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit
bootstrap="phpunit.bootstrap.php"
colors="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false">
<php>
<server name="tests_path">res/tests</server>
</php>
<testsuites>
<testsuite name="axelitus/base">
<directory suffix=".php">res/tests/axelitus/Base</directory>
</testsuite>
</testsuites>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src/axelitus</directory>
<exclude>
<directory suffix=".php">res/tests/axelitus/Base/Tests</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log type="log-junit" target="build/log/phpunit/phpunit.xml"/>
<log type="log-json" target="build/log/phpunit/phpunit.json"/>
<log type="log-tap" target="build/log/phpunit/phpunit.tap"/>
<log type="coverage-clover" target="build/log/phpunit/coverage.xml"/>
<log type="coverage-html" target="build/log/phpunit/coverage"/>
<log type="testdox-html" target="build/log/phpunit/testdoc.htm"/>
</logging>
</phpunit>
Loading

0 comments on commit 4956f18

Please sign in to comment.