build.xml 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="version" default="setup">
  3. <target name="setup" depends="clean,install-tools,generate-autoloader"/>
  4. <target name="clean" unless="clean.done" description="Cleanup build artifacts">
  5. <delete dir="${basedir}/tools"/>
  6. <delete dir="${basedir}/vendor"/>
  7. <delete file="${basedir}/src/autoload.php"/>
  8. <property name="clean.done" value="true"/>
  9. </target>
  10. <target name="prepare" unless="prepare.done" depends="clean" description="Prepare for build">
  11. <property name="prepare.done" value="true"/>
  12. </target>
  13. <target name="-tools-installed">
  14. <available file="${basedir}/tools" property="tools-installed" type="dir"/>
  15. </target>
  16. <target name="install-tools" unless="tools-installed" depends="-tools-installed" description="Install tools with Phive">
  17. <exec executable="phive" taskname="phive">
  18. <arg value="install"/>
  19. <arg value="--trust-gpg-keys" />
  20. <arg value="4AA394086372C20A,2A8299CE842DD38C" />
  21. </exec>
  22. </target>
  23. <target name="generate-autoloader" depends="install-tools" description="Generate autoloader using PHPAB">
  24. <exec executable="${basedir}/tools/phpab" taskname="phpab">
  25. <arg value="--output"/>
  26. <arg path="${basedir}/src/autoload.php"/>
  27. <arg path="${basedir}/src"/>
  28. </exec>
  29. </target>
  30. <target name="test" depends="generate-autoloader" description="Run tests">
  31. <exec executable="${basedir}/tools/phpunit" taskname="phpunit"/>
  32. </target>
  33. </project>