|
1 | 1 | <project name="Symfony3-custom-coding-standard" default="test">
|
2 |
| - <property file="build.properties" /> |
3 |
| - <available property="composer.exists" file="${composer.path}" /> |
4 |
| - <available property="symlink.exists" file="${phpcs.symlink.path}" /> |
| 2 | + <property file="build.properties"/> |
5 | 3 |
|
6 |
| - <target name="test" depends="vendor,lint,phpunit" /> |
| 4 | + <available property="composer.exists" file="${composer.path}"/> |
| 5 | + <available property="symlink.exists" file="${phpcs.symlink.path}"/> |
7 | 6 |
|
8 |
| - <target name="vendor" description="Load composer repositories" depends="composer"> |
| 7 | + <target name="test" depends="vendor,lint,phpunit,phpcs"/> |
| 8 | + |
| 9 | + <target name="vendor" depends="composer" description="Load composer repositories"> |
9 | 10 | <exec executable="composer" failonerror="true">
|
10 |
| - <arg value="install" /> |
| 11 | + <arg value="install"/> |
11 | 12 | </exec>
|
12 | 13 | </target>
|
13 | 14 |
|
14 | 15 | <target name="composer" description="Download composer" unless="composer.exists">
|
15 |
| - <get src="${composer.url}" dest="${composer.path}" /> |
| 16 | + <get src="${composer.url}" dest="${composer.path}"/> |
16 | 17 | </target>
|
17 | 18 |
|
18 | 19 | <target name="lint" description="Perform syntax check">
|
19 | 20 | <apply executable="php" failonerror="true">
|
20 |
| - <arg value="-l" /> |
| 21 | + <arg value="-l"/> |
21 | 22 | <fileset dir="${basedir}">
|
22 |
| - <include name="**/*.php" /> |
23 |
| - <exclude name="vendor/**" /> |
| 23 | + <include name="**/*.php"/> |
| 24 | + <exclude name="vendor/**"/> |
24 | 25 | </fileset>
|
25 | 26 | </apply>
|
26 | 27 | </target>
|
27 | 28 |
|
28 |
| - <target name="phpunit" depends="symlink-this-coding-standard" description="Run unit tests with PHPUnit"> |
| 29 | + <target name="phpunit" depends="symlink-cs" description="Run unit tests with PHPUnit"> |
29 | 30 | <exec executable="phpunit" failonerror="true" >
|
30 |
| - <arg value="--verbose" /> |
31 |
| - <arg value="--filter=Symfony3Custom_*" /> |
32 |
| - <arg value="${phpcs.dir}/tests/AllTests.php" /> |
| 31 | + <arg value="--verbose"/> |
| 32 | + <arg value="--filter=Symfony3Custom_*"/> |
| 33 | + <arg value="${phpcs.dir}/tests/AllTests.php"/> |
| 34 | + </exec> |
| 35 | + </target> |
| 36 | + |
| 37 | + <target name="phpcs" depends="symlink-cs" description="Find coding standard violations using PHP Code Sniffer"> |
| 38 | + <exec executable="${phpcs.bin}" failonerror="true"> |
| 39 | + <arg value="--standard=Symfony3Custom"/> |
| 40 | + <arg value="--extensions=php"/> |
| 41 | + <arg value="--ignore=vendor/*"/> |
| 42 | + <arg value="--exclude=${phpcs.exclude.sniffs}"/> |
| 43 | + <arg path="${basedir}"/> |
33 | 44 | </exec>
|
34 | 45 | </target>
|
35 | 46 |
|
36 |
| - <target name="symlink-this-coding-standard" description="Symlink this coding standard" unless="symlink.exists"> |
37 |
| - <symlink link="${basedir}/${phpcs.symlink.path}" resource="${basedir}/Symfony3Custom"/> |
| 47 | + <target name="symlink-cs" description="Symlink this coding standard" unless="symlink.exists"> |
| 48 | + <symlink link="${phpcs.symlink.path}" resource="${basedir}/Symfony3Custom"/> |
38 | 49 | </target>
|
39 | 50 | </project>
|
0 commit comments