build.xml 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <?xml version="1.0"?>
  2. <!--
  3. Doctrine 2 build file.
  4. -->
  5. <project name="Doctrine2" default="build" basedir=".">
  6. <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
  7. <property file="build.properties" />
  8. <!--
  9. Fileset for artifacts shared across all distributed packages.
  10. -->
  11. <fileset id="shared-artifacts" dir=".">
  12. <include name="LICENSE"/>
  13. </fileset>
  14. <!--
  15. Fileset for command line scripts
  16. -->
  17. <fileset id="bin-scripts" dir="./bin">
  18. <include name="doctrine"/>
  19. <include name="doctrine.php"/>
  20. <include name="doctrine.bat"/>
  21. </fileset>
  22. <!--
  23. Fileset for the sources of the Doctrine Common dependency.
  24. -->
  25. <fileset id="common-sources" dir="./lib/vendor/doctrine-common/lib">
  26. <include name="Doctrine/Common/**"/>
  27. </fileset>
  28. <!--
  29. Fileset for the sources of the Doctrine DBAL dependency.
  30. -->
  31. <fileset id="dbal-sources" dir="./lib/vendor/doctrine-dbal/lib">
  32. <include name="Doctrine/DBAL/**"/>
  33. </fileset>
  34. <!--
  35. Fileset for the sources of the Doctrine ORM.
  36. -->
  37. <fileset id="orm-sources" dir="./lib">
  38. <include name="Doctrine/ORM/**"/>
  39. </fileset>
  40. <!--
  41. Fileset for source of the Symfony YAML and Console components.
  42. -->
  43. <fileset id="symfony-sources" dir="./lib/vendor">
  44. <include name="Symfony/Component/**"/>
  45. </fileset>
  46. <!--
  47. Clean the directory for the next build.
  48. -->
  49. <target name="clean">
  50. <available file="./build.properties" property="build_properties_exist" value="true"/>
  51. <fail unless="build_properties_exist" message="The build.properties file is missing." />
  52. <delete dir="${build.dir}" includeemptydirs="true" />
  53. <delete dir="${dist.dir}" includeemptydirs="true" />
  54. <delete dir="${report.dir}" includeemptydirs="true" />
  55. </target>
  56. <!--
  57. Prepare the new build directories after cleaning
  58. -->
  59. <target name="prepare" depends="clean">
  60. <echo msg="Creating build directory: ${build.dir}" />
  61. <mkdir dir="${build.dir}" />
  62. <echo msg="Creating distribution directory: ${dist.dir}" />
  63. <mkdir dir="${dist.dir}" />
  64. <echo msg="Creating report directory: ${report.dir}" />
  65. <mkdir dir="${report.dir}" />
  66. <mkdir dir="${build.dir}/logs"/>
  67. <mkdir dir="${report.dir}/tests"/>
  68. </target>
  69. <!--
  70. Builds ORM package, preparing it for distribution.
  71. -->
  72. <target name="build-orm" depends="prepare">
  73. <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/ORM/Version.php" checkreturn="true"/>
  74. <copy todir="${build.dir}/doctrine-orm">
  75. <fileset refid="shared-artifacts"/>
  76. </copy>
  77. <copy todir="${build.dir}/doctrine-orm">
  78. <fileset refid="common-sources"/>
  79. <fileset refid="dbal-sources"/>
  80. <fileset refid="orm-sources"/>
  81. </copy>
  82. <copy todir="${build.dir}/doctrine-orm/Doctrine">
  83. <fileset refid="symfony-sources"/>
  84. </copy>
  85. <copy todir="${build.dir}/doctrine-orm/bin">
  86. <fileset refid="bin-scripts"/>
  87. </copy>
  88. <exec command="sed 's/${version}-DEV/${version}/' ${build.dir}/doctrine-orm/Doctrine/ORM/Version.php > ${build.dir}/doctrine-orm/Doctrine/ORM/Version2.php" passthru="true" />
  89. <exec command="mv ${build.dir}/doctrine-orm/Doctrine/ORM/Version2.php ${build.dir}/doctrine-orm/Doctrine/ORM/Version.php" passthru="true" />
  90. <delete dir="${build.dir}/doctrine-orm/Doctrine/Symfony/Component/Yaml/.git" includeemptydirs="true"/>
  91. <delete dir="${build.dir}/doctrine-orm/Doctrine/Symfony/Component/Console/.git" includeemptydirs="true"/>
  92. </target>
  93. <target name="build" depends="test, build-orm"/>
  94. <target name="package-phar" depends="build-orm">
  95. <pharpackage basedir="${build.dir}/doctrine-orm/" destfile="${dist.dir}/doctrine-orm-${version}.phar" clistub="${build.dir}/doctrine-orm/bin/doctrine.php" signature="sha512">
  96. <fileset dir="${build.dir}/doctrine-orm">
  97. <include name="**/**" />
  98. </fileset>
  99. <metadata>
  100. <element name="version" value="${version}" />
  101. <element name="authors">
  102. <element name="Guilherme Blanco"><element name="e-mail" value="guilhermeblanco@gmail.com" /></element>
  103. <element name="Benjamin Eberlei"><element name="e-mail" value="kontakt@beberlei.de" /></element>
  104. <element name="Jonathan H. Wage"><element name="e-mail" value="jonwage@gmail.com" /></element>
  105. <element name="Roman Borschel"><element name="e-mail" value="roman@code-factory.org" /></element>
  106. </element>
  107. </metadata>
  108. </pharpackage>
  109. </target>
  110. <!--
  111. Runs the full test suite.
  112. -->
  113. <target name="test" depends="prepare">
  114. <if><equals arg1="${test.phpunit_generate_coverage}" arg2="1" />
  115. <then>
  116. <property name="test.phpunit_coverage_file" value="${build.dir}/logs/clover.xml" />
  117. </then>
  118. <else>
  119. <property name="test.phpunit_coverage_file" value="false" />
  120. </else>
  121. </if>
  122. <nativephpunit
  123. testfile="./tests/Doctrine/Tests/AllTests.php" junitlogfile="${build.dir}/logs/testsuites.xml"
  124. testdirectory="./tests" coverageclover="${test.phpunit_coverage_file}" configuration="${test.phpunit_configuration_file}"
  125. />
  126. <phpunitreport infile="${build.dir}/logs/testsuites.xml" format="frames" todir="${report.dir}/tests" />
  127. <nativephpunit testfile="./tests/Doctrine/Tests/ORM/Performance/AllTests.php" testdirectory="./tests" haltonfailure="false" haltonerror="false" />
  128. <tstamp/>
  129. <copy file="${build.dir}/logs/testsuites.xml" tofile="${log.archive.dir}/latest/log.xml" overwrite="true"/>
  130. <if><equals arg1="${test.pmd_reports}" arg2="1" />
  131. <then>
  132. <exec command="${test.pdepend_exec} --jdepend-xml=${build.dir}/logs/jdepend.xml ./lib/Doctrine" />
  133. <exec command="${test.phpmd_exec} ./lib/Doctrine xml codesize --reportfile ${build.dir}/logs/phpmd.xml" />
  134. <copy file="${build.dir}/logs/jdepend.xml" tofile="${log.archive.dir}/latest/jdepend.xml" overwrite="true"/>
  135. <copy file="${build.dir}/logs/phpmd.xml" tofile="${log.archive.dir}/latest/phpmd.xml" overwrite="true"/>
  136. </then>
  137. </if>
  138. </target>
  139. <!--
  140. Builds distributable PEAR packages.
  141. -->
  142. <target name="build-packages" depends="build-orm">
  143. <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-orm">
  144. <name>DoctrineORM</name>
  145. <summary>Doctrine Object Relational Mapper</summary>
  146. <channel>pear.doctrine-project.org</channel>
  147. <description>The Doctrine ORM package is the primary package containing the object relational mapper.</description>
  148. <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
  149. <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
  150. <lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
  151. <lead user="beberlei" name="Benjamin Eberlei" email="kontakt@beberlei.de" />
  152. <license>LGPL</license>
  153. <version release="${version}" api="${version}" />
  154. <stability release="${stability}" api="${stability}" />
  155. <notes>-</notes>
  156. <dependencies>
  157. <php minimum_version="5.3.0" />
  158. <pear minimum_version="1.6.0" recommended_version="1.6.1" />
  159. <package name="DoctrineCommon" channel="pear.doctrine-project.org" minimum_version="${dependencies.common}" />
  160. <package name="DoctrineDBAL" channel="pear.doctrine-project.org" minimum_version="${dependencies.dbal}" />
  161. <package name="DoctrineSymfonyConsole" channel="pear.doctrine-project.org" minimum_version="2.0.0" />
  162. <package name="DoctrineSymfonyYaml" channel="pear.doctrine-project.org" minimum_version="2.0.0" />
  163. </dependencies>
  164. <dirroles key="bin">script</dirroles>
  165. <ignore>Doctrine/Common/</ignore>
  166. <ignore>Doctrine/DBAL/</ignore>
  167. <ignore>Symfony/Component/Yaml/</ignore>
  168. <ignore>Symfony/Component/Console/</ignore>
  169. <release>
  170. <install as="doctrine" name="bin/doctrine" />
  171. <install as="doctrine.php" name="bin/doctrine.php" />
  172. <install as="doctrine.bat" name="bin/doctrine.bat" />
  173. </release>
  174. <replacement path="bin/doctrine.bat" type="pear-config" from="@php_bin@" to="php_bin" />
  175. <replacement path="bin/doctrine.bat" type="pear-config" from="@bin_dir@" to="bin_dir" />
  176. </d51pearpkg2>
  177. <exec command="pear package" dir="${build.dir}/doctrine-orm" passthru="true" />
  178. <exec command="mv DoctrineORM-${version}.tgz ../../dist" dir="${build.dir}/doctrine-orm" passthru="true" />
  179. <tar destfile="dist/DoctrineORM-${version}-full.tar.gz" compression="gzip" basedir="${build.dir}">
  180. <fileset dir="${build.dir}">
  181. <include name="**/**" />
  182. <exclude name="logs/" />
  183. <exclude name="doctrine-orm/package.xml" />
  184. </fileset>
  185. </tar>
  186. </target>
  187. <target name="git-tag">
  188. <exec command="grep '${version}-DEV' ${project.basedir}/lib/Doctrine/ORM/Version.php" checkreturn="true"/>
  189. <exec command="sed 's/${version}-DEV/${version}/' ${project.basedir}/lib/Doctrine/ORM/Version.php > ${project.basedir}/lib/Doctrine/ORM/Version2.php" passthru="true" />
  190. <exec command="mv ${project.basedir}/lib/Doctrine/ORM/Version2.php ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
  191. <exec command="git add ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
  192. <exec command="git commit -m 'Release ${version}'" />
  193. <exec command="git tag -m 'Tag ${version}' -a ${version}" passthru="true" />
  194. </target>
  195. <target name="pirum-release">
  196. <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineORM-${version}.tgz" dir="." passthru="true" />
  197. <exec command="sudo pirum build ${project.pirum_dir}" passthru="true" />
  198. </target>
  199. <target name="distribute-download">
  200. <copy file="dist/DoctrineORM-${version}-full.tar.gz" todir="${project.download_dir}" />
  201. <copy file="${dist.dir}/doctrine-orm-${version}.phar" todir="${project.download_dir}" />
  202. </target>
  203. <target name="update-dev-version">
  204. <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/ORM/Version.php" checkreturn="true"/>
  205. <propertyprompt propertyName="next_version" defaultValue="${version}" promptText="Enter next version string (without -DEV)" />
  206. <exec command="sed 's/${version}/${next_version}-DEV/' ${project.basedir}/lib/Doctrine/ORM/Version.php > ${project.basedir}/lib/Doctrine/ORM/Version2.php" passthru="true" />
  207. <exec command="mv ${project.basedir}/lib/Doctrine/ORM/Version2.php ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
  208. <exec command="git add ${project.basedir}/lib/Doctrine/ORM/Version.php" passthru="true" />
  209. <exec command="git commit -m 'Bump Dev Version to ${next_version}-DEV'" passthru="true" />
  210. </target>
  211. <target name="release" depends="git-tag,build-packages,package-phar,distribute-download,pirum-release,update-dev-version" />
  212. <!--
  213. Builds distributable PEAR packages for the Symfony Dependencies
  214. -->
  215. <target name="release-symfony-dependencies" depends="build-orm">
  216. <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-orm">
  217. <name>DoctrineSymfonyConsole</name>
  218. <summary>Symfony Console Component</summary>
  219. <channel>pear.doctrine-project.org</channel>
  220. <description>A command line interface tool from the Symfony project. Packaged for shipping with Doctrine projects using ORM version numbers.</description>
  221. <lead user="fabpot" name="Fabien Potencier" email="fabien.potencier@symfony-project.com" />
  222. <license>NewBSD License</license>
  223. <version release="${version}" api="${version}" />
  224. <stability release="${stability}" api="${stability}" />
  225. <notes>-</notes>
  226. <dependencies>
  227. <php minimum_version="5.3.0" />
  228. <pear minimum_version="1.6.0" recommended_version="1.6.1" />
  229. </dependencies>
  230. <ignore>bin/</ignore>
  231. <ignore>Doctrine/Common/</ignore>
  232. <ignore>Doctrine/DBAL/</ignore>
  233. <ignore>Doctrine/ORM/</ignore>
  234. <ignore>Symfony/Component/Yaml/</ignore>
  235. </d51pearpkg2>
  236. <exec command="pear package" dir="${build.dir}/doctrine-orm" passthru="true" />
  237. <exec command="mv DoctrineSymfonyConsole-${version}.tgz ../../dist" dir="${build.dir}/doctrine-orm" passthru="true" />
  238. <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-orm">
  239. <name>DoctrineSymfonyYaml</name>
  240. <summary>Symfony Yaml Component</summary>
  241. <channel>pear.doctrine-project.org</channel>
  242. <description>A YAML Parser from the Symfony project. Packaged for shipping with Doctrine projects using ORM version numbers.</description>
  243. <lead user="fabpot" name="Fabien Potencier" email="fabien.potencier@symfony-project.com" />
  244. <license>NewBSD License</license>
  245. <version release="${version}" api="${version}" />
  246. <stability release="${stability}" api="${stability}" />
  247. <notes>-</notes>
  248. <dependencies>
  249. <php minimum_version="5.3.0" />
  250. <pear minimum_version="1.6.0" recommended_version="1.6.1" />
  251. </dependencies>
  252. <ignore>bin/</ignore>
  253. <ignore>Doctrine/Common/</ignore>
  254. <ignore>Doctrine/DBAL/</ignore>
  255. <ignore>Doctrine/ORM/</ignore>
  256. <ignore>Symfony/Component/Console/</ignore>
  257. </d51pearpkg2>
  258. <exec command="pear package" dir="${build.dir}/doctrine-orm" passthru="true" />
  259. <exec command="mv DoctrineSymfonyYaml-${version}.tgz ../../dist" dir="${build.dir}/doctrine-orm" passthru="true" />
  260. <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineSymfonyConsole-${version}.tgz" dir="." passthru="true" />
  261. <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineSymfonyYaml-${version}.tgz" dir="." passthru="true" />
  262. <exec command="sudo pirum build ${project.pirum_dir}" passthru="true" />
  263. </target>
  264. </project>