build.xml 9.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <?xml version="1.0"?>
  2. <!--
  3. Doctrine 2 build file.
  4. -->
  5. <project name="Doctrine DBAL" 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-dbal"/>
  19. <include name="doctrine-dbal.php"/>
  20. </fileset>
  21. <!--
  22. Fileset for the sources of the Doctrine Common dependency.
  23. -->
  24. <fileset id="common-sources" dir="./lib/vendor/doctrine-common/lib">
  25. <include name="Doctrine/Common/**"/>
  26. </fileset>
  27. <!--
  28. Fileset for the sources of the Doctrine DBAL package.
  29. -->
  30. <fileset id="dbal-sources" dir="./lib">
  31. <include name="Doctrine/DBAL/**"/>
  32. </fileset>
  33. <!--
  34. Fileset for source of the Symfony YAML and Console components.
  35. -->
  36. <fileset id="symfony-sources" dir="./lib/vendor">
  37. <include name="Symfony/Component**"/>
  38. </fileset>
  39. <!--
  40. Clean the directory for the next build.
  41. -->
  42. <target name="clean">
  43. <available file="./build.properties" property="build_properties_exist" value="true"/>
  44. <fail unless="build_properties_exist" message="The build.properties file is missing." />
  45. <delete dir="${build.dir}" includeemptydirs="true" />
  46. <delete dir="${dist.dir}" includeemptydirs="true" />
  47. <delete dir="${report.dir}" includeemptydirs="true" />
  48. </target>
  49. <!--
  50. Prepare the new build directories after cleaning
  51. -->
  52. <target name="prepare" depends="clean">
  53. <echo msg="Creating build directory: ${build.dir}" />
  54. <mkdir dir="${build.dir}" />
  55. <echo msg="Creating distribution directory: ${dist.dir}" />
  56. <mkdir dir="${dist.dir}" />
  57. <echo msg="Creating report directory: ${report.dir}" />
  58. <mkdir dir="${report.dir}" />
  59. <mkdir dir="${build.dir}/logs"/>
  60. <mkdir dir="${report.dir}/tests"/>
  61. </target>
  62. <!--
  63. Builds DBAL package, preparing it for distribution.
  64. -->
  65. <target name="build-dbal" depends="prepare">
  66. <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/DBAL/Version.php" checkreturn="true"/>
  67. <copy todir="${build.dir}/doctrine-dbal">
  68. <fileset refid="shared-artifacts"/>
  69. </copy>
  70. <copy todir="${build.dir}/doctrine-dbal">
  71. <fileset refid="common-sources"/>
  72. <fileset refid="dbal-sources"/>
  73. </copy>
  74. <copy todir="${build.dir}/doctrine-dbal/Doctrine">
  75. <fileset refid="symfony-sources"/>
  76. </copy>
  77. <copy todir="${build.dir}/doctrine-dbal/bin">
  78. <fileset refid="bin-scripts"/>
  79. </copy>
  80. <exec command="sed 's/${version}-DEV/${version}/' ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version.php > ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version2.php" passthru="true" />
  81. <exec command="mv ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version2.php ${build.dir}/doctrine-dbal/Doctrine/DBAL/Version.php" passthru="true" />
  82. </target>
  83. <target name="build" depends="test,build-dbal"/>
  84. <!--
  85. Runs the full test suite.
  86. -->
  87. <target name="test" depends="prepare">
  88. <if><equals arg1="${test.phpunit_generate_coverage}" arg2="1" />
  89. <then>
  90. <property name="test.phpunit_coverage_option" value="--coverage-clover ${build.dir}/logs/clover.xml" />
  91. </then>
  92. <else>
  93. <property name="test.phpunit_coverage_option" value="" />
  94. </else>
  95. </if>
  96. <if><equals arg1="${test.phpunit_configuration_file}" arg2="" />
  97. <then>
  98. <property name="test.phpunit_configuration_option" value="" />
  99. </then>
  100. <else>
  101. <property name="test.phpunit_configuration_option" value="--configuration ${test.phpunit_configuration_file}" />
  102. </else>
  103. </if>
  104. <exec command="phpunit ${test.phpunit_configuration_option} ${test.phpunit_coverage_option} --log-junit ../${build.dir}/logs/testsuites.xml Doctrine/Tests/AllTests.php" dir="./tests" />
  105. <phpunitreport infile="${build.dir}/logs/testsuites.xml" format="frames" todir="${report.dir}/tests" />
  106. <tstamp/>
  107. <copy file="${build.dir}/logs/testsuites.xml" tofile="${log.archive.dir}/latest/log.xml" overwrite="true"/>
  108. <if><equals arg1="${test.pmd_reports}" arg2="1" />
  109. <then>
  110. <exec command="${test.pdepend_exec} --jdepend-xml=${build.dir}/logs/jdepend.xml ./lib/Doctrine" />
  111. <exec command="${test.phpmd_exec} ./lib/Doctrine xml codesize --reportfile ${build.dir}/logs/phpmd.xml" />
  112. <copy file="${build.dir}/logs/jdepend.xml" tofile="${log.archive.dir}/latest/jdepend.xml" overwrite="true"/>
  113. <copy file="${build.dir}/logs/phpmd.xml" tofile="${log.archive.dir}/latest/phpmd.xml" overwrite="true"/>
  114. </then>
  115. </if>
  116. </target>
  117. <!--
  118. Builds distributable PEAR packages.
  119. -->
  120. <target name="build-packages" depends="build-dbal">
  121. <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/doctrine-dbal">
  122. <name>DoctrineDBAL</name>
  123. <summary>Doctrine Database Abstraction Layer</summary>
  124. <channel>pear.doctrine-project.org</channel>
  125. <description>The Doctrine DBAL package is the database abstraction layer used to power the ORM package.</description>
  126. <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
  127. <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
  128. <lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
  129. <lead user="beberlei" name="Benjamin Eberlei" email="kontakt@beberlei.de" />
  130. <license>LGPL</license>
  131. <version release="${version}" api="${version}" />
  132. <stability release="${stability}" api="${stability}" />
  133. <notes>-</notes>
  134. <dependencies>
  135. <php minimum_version="5.3.2" />
  136. <pear minimum_version="1.6.0" recommended_version="1.6.1" />
  137. <package name="DoctrineCommon" channel="pear.doctrine-project.org" minimum_version="${dependencies.common}" />
  138. <!-- Doctrine Symfony Console PEAR package is generated in ORM build.xml process -->
  139. <package name="DoctrineSymfonyConsole" channel="pear.doctrine-project.org" minimum_version="${dependencies.sfconsole}" />
  140. </dependencies>
  141. <dirroles key="bin">script</dirroles>
  142. <ignore>Doctrine/Common/</ignore>
  143. <ignore>Doctrine/Symfony/</ignore>
  144. <release>
  145. <install as="doctrine-dbal" name="bin/doctrine-dbal" />
  146. <install as="doctrine-dbal.php" name="bin/doctrine-dbal.php" />
  147. </release>
  148. </d51pearpkg2>
  149. <exec command="pear package" dir="${build.dir}/doctrine-dbal" passthru="true" />
  150. <exec command="mv DoctrineDBAL-${version}.tgz ../../dist" dir="${build.dir}/doctrine-dbal" passthru="true" />
  151. <tar destfile="dist/DoctrineDBAL-${version}-full.tar.gz" compression="gzip" basedir="${build.dir}">
  152. <fileset dir="${build.dir}">
  153. <include name="**/**" />
  154. <exclude name="logs/" />
  155. </fileset>
  156. </tar>
  157. </target>
  158. <target name="git-tag">
  159. <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/DBAL/Version.php" checkreturn="true"/>
  160. <exec command="git tag -a ${version}" passthru="true" />
  161. </target>
  162. <target name="pirum-release">
  163. <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineDBAL-${version}.tgz" dir="." passthru="true" />
  164. <exec command="sudo pirum build ${project.pirum_dir}" passthru="true" />
  165. </target>
  166. <target name="distribute-download">
  167. <copy file="dist/DoctrineDBAL-${version}-full.tar.gz" todir="${project.download_dir}" />
  168. </target>
  169. <target name="update-dev-version">
  170. <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/DBAL/Version.php" checkreturn="true"/>
  171. <propertyprompt propertyName="next_version" defaultValue="${version}" promptText="Enter next version string (without -DEV)" />
  172. <exec command="sed 's/${version}-DEV/${next_version}-DEV/' ${project.basedir}/lib/Doctrine/DBAL/Version.php > ${project.basedir}/lib/Doctrine/DBAL/Version2.php" passthru="true" />
  173. <exec command="mv ${project.basedir}/lib/Doctrine/DBAL/Version2.php ${project.basedir}/lib/Doctrine/DBAL/Version.php" passthru="true" />
  174. <exec command="git add ${project.basedir}/lib/Doctrine/DBAL/Version.php" passthru="true" />
  175. <exec command="git commit -m 'Bump Dev Version to ${next_version}'" passthru="true" />
  176. </target>
  177. <target name="release" depends="git-tag,build-packages,distribute-download,pirum-release,update-dev-version" />
  178. </project>