build.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?xml version="1.0"?>
  2. <project name="DoctrineCommonCache" default="build" basedir=".">
  3. <property file="build.properties" />
  4. <target name="php">
  5. <exec executable="which" outputproperty="php_executable">
  6. <arg value="php" />
  7. </exec>
  8. </target>
  9. <target name="prepare">
  10. <mkdir dir="build" />
  11. </target>
  12. <target name="build" depends="check-git-checkout-clean,prepare,php,composer">
  13. <exec executable="${php_executable}">
  14. <arg value="build/composer.phar" />
  15. <arg value="archive" />
  16. <arg value="--dir=build" />
  17. </exec>
  18. </target>
  19. <target name="composer" depends="php,composer-check,composer-download">
  20. <exec executable="${php_executable}">
  21. <arg value="build/composer.phar" />
  22. <arg value="install" />
  23. </exec>
  24. </target>
  25. <target name="composer-check" depends="prepare">
  26. <available file="build/composer.phar" property="composer.present"/>
  27. </target>
  28. <target name="composer-download" unless="composer.present">
  29. <exec executable="wget">
  30. <arg value="-Obuild/composer.phar" />
  31. <arg value="http://getcomposer.org/composer.phar" />
  32. </exec>
  33. </target>
  34. <target name="make-release" depends="check-git-checkout-clean,prepare,php">
  35. <replace file="${project.version_file}" token="-DEV" value="" failOnNoReplacements="true" />
  36. <exec executable="${php_executable}" outputproperty="doctrine.current_version" failonerror="true">
  37. <arg value="-r" />
  38. <arg value="require_once '${project.version_file}';echo ${project.version_class}::VERSION;" />
  39. </exec>
  40. <exec executable="${php_executable}" outputproperty="doctrine.next_version" failonerror="true">
  41. <arg value="-r" />
  42. <arg value="$parts = explode('.', str_ireplace(array('-DEV', '-ALPHA', '-BETA'), '', '${doctrine.current_version}'));
  43. if (count($parts) != 3) {
  44. throw new \InvalidArgumentException('Version is assumed in format x.y.z, ${doctrine.current_version} given');
  45. }
  46. $parts[2]++;
  47. echo implode('.', $parts);
  48. " />
  49. </exec>
  50. <git-commit file="${project.version_file}" message="Release ${doctrine.current_version}" />
  51. <git-tag version="${doctrine.current_version}" />
  52. <replace file="${project.version_file}" token="${doctrine.current_version}" value="${doctrine.next_version}-DEV" />
  53. <git-commit file="${project.version_file}" message="Bump version to ${doctrine.next_version}" />
  54. </target>
  55. <target name="check-git-checkout-clean">
  56. <exec executable="git" failonerror="true">
  57. <arg value="diff-index" />
  58. <arg value="--quiet" />
  59. <arg value="HEAD" />
  60. </exec>
  61. </target>
  62. <macrodef name="git-commit">
  63. <attribute name="file" default="NOT SET"/>
  64. <attribute name="message" default="NOT SET"/>
  65. <sequential>
  66. <exec executable="git">
  67. <arg value="add" />
  68. <arg value="@{file}" />
  69. </exec>
  70. <exec executable="git">
  71. <arg value="commit" />
  72. <arg value="-m" />
  73. <arg value="@{message}" />
  74. </exec>
  75. </sequential>
  76. </macrodef>
  77. <macrodef name="git-tag">
  78. <attribute name="version" default="NOT SET" />
  79. <sequential>
  80. <exec executable="git">
  81. <arg value="tag" />
  82. <arg value="-m" />
  83. <arg value="v@{version}" />
  84. <arg value="v@{version}" />
  85. </exec>
  86. </sequential>
  87. </macrodef>
  88. </project>