80 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
			
		
		
	
	
			80 lines
		
	
	
	
		
			2.2 KiB
		
	
	
	
		
			XML
		
	
	
	
	
	
| <?xml version="1.0" encoding="UTF-8"?>
 | |
| <project name="version" default="build">
 | |
|  <property name="php" value="php"/>
 | |
|  <property name="phpunit" value="phpunit"/>
 | |
| 
 | |
|  <target name="build" depends="prepare,lint,phpcs,phpunit"/>
 | |
| 
 | |
|  <target name="clean" description="Cleanup build artifacts">
 | |
|  </target>
 | |
| 
 | |
|  <target name="prepare" depends="clean,phpab" description="Prepare for build">
 | |
|  </target>
 | |
| 
 | |
|  <target name="phpab" description="Generate autoloader script">
 | |
|   <exec executable="phpab">
 | |
|    <arg value="--output" />
 | |
|    <arg path="src/autoload.php" />
 | |
|    <arg path="src" />
 | |
|   </exec>
 | |
|  </target>
 | |
| 
 | |
|  <target name="lint">
 | |
|   <apply executable="${php}" failonerror="true">
 | |
|    <arg value="-l" />
 | |
| 
 | |
|    <fileset dir="${basedir}/src">
 | |
|     <include name="**/*.php" />
 | |
|     <modified />
 | |
|    </fileset>
 | |
| 
 | |
|    <fileset dir="${basedir}/tests">
 | |
|     <include name="**/*.php" />
 | |
|     <modified />
 | |
|    </fileset>
 | |
|   </apply>
 | |
|  </target>
 | |
| 
 | |
|  <target name="phpcs" description="Find coding standard violations using PHP_CodeSniffer">
 | |
|   <exec executable="phpcs">
 | |
|    <arg value="--standard=PSR2" />
 | |
|    <arg value="--extensions=php" />
 | |
|    <arg value="--ignore=autoload.php" />
 | |
|    <arg path="${basedir}/src" />
 | |
|   </exec>
 | |
|  </target>
 | |
| 
 | |
|  <target name="phpunit" description="Run unit tests with PHPUnit">
 | |
|   <condition property="phpunit_cmd" value="${php} ${phpunit}" else="${phpunit}">
 | |
|    <not>
 | |
|     <equals arg1="${phpunit}" arg2="phpunit" />
 | |
|    </not>
 | |
|   </condition>
 | |
| 
 | |
|   <exec executable="${phpunit_cmd}" failonerror="true">
 | |
|    <arg value="--configuration" />
 | |
|    <arg path="${basedir}/build/phpunit.xml" />
 | |
|   </exec>
 | |
|  </target>
 | |
| 
 | |
|  <target name="pear">
 | |
|   <mkdir dir="${basedir}/build/SebastianBergmann/Version"/>
 | |
| 
 | |
|   <copy todir="${basedir}/build/SebastianBergmann/Version">
 | |
|    <fileset dir="${basedir}/src"/>
 | |
|   </copy>
 | |
| 
 | |
|   <copy file="ChangeLog.md" todir="${basedir}/build"/>
 | |
|   <copy file="LICENSE" todir="${basedir}/build"/>
 | |
|   <copy file="README.md" todir="${basedir}/build"/>
 | |
| 
 | |
|   <exec executable="pear" dir="${basedir}/build">
 | |
|    <arg value="package" />
 | |
|   </exec>
 | |
| 
 | |
|   <delete dir="${basedir}/build/SebastianBergmann"/>
 | |
|   <delete file="${basedir}/build/ChangeLog.md"/>
 | |
|   <delete file="${basedir}/build/LICENSE"/>
 | |
|   <delete file="${basedir}/build/README.md"/>
 | |
|  </target>
 | |
| </project>
 | 
