build.xml 7.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. <include name="COPYRIGHT"/>
  14. <include name="CHANGELOG"/>
  15. </fileset>
  16. <!--
  17. Fileset for the sources of the Doctrine Common package.
  18. -->
  19. <fileset id="common-sources" dir="./lib">
  20. <include name="Doctrine/Common/**"/>
  21. </fileset>
  22. <!--
  23. Clean the directory for the next build.
  24. -->
  25. <target name="clean">
  26. <available file="./build.properties" property="build_properties_exist" value="true"/>
  27. <fail unless="build_properties_exist" message="The build.properties file is missing." />
  28. <delete dir="${build.dir}" includeemptydirs="true" />
  29. <delete dir="${dist.dir}" includeemptydirs="true" />
  30. <delete dir="${report.dir}" includeemptydirs="true" />
  31. </target>
  32. <!--
  33. Prepare the new build directories after cleaning
  34. -->
  35. <target name="prepare" depends="clean">
  36. <echo msg="Creating build directory: ${build.dir}" />
  37. <mkdir dir="${build.dir}" />
  38. <echo msg="Creating distribution directory: ${dist.dir}" />
  39. <mkdir dir="${dist.dir}" />
  40. <echo msg="Creating report directory: ${report.dir}" />
  41. <mkdir dir="${report.dir}" />
  42. <mkdir dir="${build.dir}/logs"/>
  43. <mkdir dir="${report.dir}/tests"/>
  44. </target>
  45. <!--
  46. Builds Common package, preparing it for distribution.
  47. -->
  48. <target name="build-common">
  49. <copy todir="${build.dir}/common">
  50. <fileset refid="shared-artifacts"/>
  51. </copy>
  52. <copy todir="${build.dir}/common">
  53. <fileset refid="common-sources"/>
  54. </copy>
  55. </target>
  56. <target name="build" depends="prepare,build-common"/>
  57. <!--
  58. Runs the full test suite.
  59. -->
  60. <target name="test" depends="prepare">
  61. <if><equals arg1="${test.phpunit_generate_coverage}" arg2="1" />
  62. <then>
  63. <property name="test.phpunit_coverage_file" value="${build.dir}/logs/clover.xml" />
  64. </then>
  65. <else>
  66. <property name="test.phpunit_coverage_file" value="false" />
  67. </else>
  68. </if>
  69. <nativephpunit
  70. testfile="./tests/Doctrine/Tests/AllTests.php" junitlogfile="${build.dir}/logs/testsuites.xml"
  71. testdirectory="./tests" coverageclover="${test.phpunit_coverage_file}" configuration="${test.phpunit_configuration_file}"
  72. />
  73. <phpunitreport infile="${build.dir}/logs/testsuites.xml" format="frames" todir="${report.dir}/tests" />
  74. <tstamp/>
  75. <copy file="${build.dir}/logs/testsuites.xml" tofile="${log.archive.dir}/latest/log.xml" overwrite="true"/>
  76. <if><equals arg1="${test.pmd_reports}" arg2="1" />
  77. <then>
  78. <exec command="${test.pdepend_exec} --jdepend-xml=${build.dir}/logs/jdepend.xml ./lib/Doctrine" />
  79. <exec command="${test.phpmd_exec} ./lib/Doctrine xml codesize --reportfile ${build.dir}/logs/phpmd.xml" />
  80. <copy file="${build.dir}/logs/jdepend.xml" tofile="${log.archive.dir}/latest/jdepend.xml" overwrite="true"/>
  81. <copy file="${build.dir}/logs/phpmd.xml" tofile="${log.archive.dir}/latest/phpmd.xml" overwrite="true"/>
  82. </then>
  83. </if>
  84. </target>
  85. <!--
  86. Builds distributable PEAR packages.
  87. -->
  88. <target name="build-packages" depends="build">
  89. <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/common">
  90. <name>DoctrineCommon</name>
  91. <summary>Doctrine Common PHP Extensions</summary>
  92. <channel>pear.doctrine-project.org</channel>
  93. <description>The Doctrine Common package contains shared code between the other packages.</description>
  94. <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
  95. <lead user="guilhermeblanco" name="Guilherme Blanco" email="guilhermeblanco@gmail.com" />
  96. <lead user="romanb" name="Roman Borschel" email="roman@code-factory.org" />
  97. <lead user="beberlei" name="Benjamin Eberlei" email="kontakt@beberlei.de" />
  98. <license>LGPL</license>
  99. <version release="${version}" api="${version}" />
  100. <stability release="${stability}" api="${stability}" />
  101. <notes>-</notes>
  102. <dependencies>
  103. <php minimum_version="5.3.0" />
  104. <pear minimum_version="1.6.0" recommended_version="1.6.1" />
  105. </dependencies>
  106. </d51pearpkg2>
  107. <exec command="pear package" dir="${build.dir}/common" passthru="true" />
  108. <exec command="mv DoctrineCommon-${version}.tgz ../../dist" dir="${build.dir}/common" passthru="true" />
  109. <tar destfile="dist/DoctrineCommon-${version}-full.tar.gz" compression="gzip" basedir="${build.dir}">
  110. <fileset dir="${build.dir}">
  111. <include name="**/**" />
  112. <exclude name="logs/" />
  113. </fileset>
  114. </tar>
  115. </target>
  116. <target name="git-tag">
  117. <exec command="grep '${version}-DEV' ${project.basedir}/lib/Doctrine/Common/Version.php" checkreturn="true"/>
  118. <exec command="sed 's/${version}-DEV/${version}/' ${project.basedir}/lib/Doctrine/Common/Version.php > ${project.basedir}/lib/Doctrine/Common/Version2.php" passthru="true" />
  119. <exec command="mv ${project.basedir}/lib/Doctrine/Common/Version2.php ${project.basedir}/lib/Doctrine/Common/Version.php" passthru="true" />
  120. <exec command="git commit -a -m 'Release ${version}'" />
  121. <exec command="git tag -m 'Tag ${version}' -a ${version}" passthru="true" />
  122. </target>
  123. <target name="pirum-release">
  124. <exec command="sudo pirum add ${project.pirum_dir} ${project.basedir}/dist/DoctrineCommon-${version}.tgz" dir="." passthru="true" />
  125. <exec command="sudo pirum build ${project.pirum_dir}" passthru="true" />
  126. </target>
  127. <target name="distribute-download">
  128. <copy file="dist/DoctrineCommon-${version}-full.tar.gz" todir="${project.download_dir}" />
  129. </target>
  130. <target name="update-dev-version">
  131. <exec command="grep '${version}' ${project.basedir}/lib/Doctrine/Common/Version.php" checkreturn="true"/>
  132. <propertyprompt propertyName="next_version" defaultValue="${version}" promptText="Enter next version string (without -DEV)" />
  133. <exec command="sed 's/${version}/${next_version}-DEV/' ${project.basedir}/lib/Doctrine/Common/Version.php > ${project.basedir}/lib/Doctrine/Common/Version2.php" passthru="true" />
  134. <exec command="mv ${project.basedir}/lib/Doctrine/Common/Version2.php ${project.basedir}/lib/Doctrine/Common/Version.php" passthru="true" />
  135. <exec command="git add ${project.basedir}/lib/Doctrine/Common/Version.php" passthru="true" />
  136. <exec command="git commit -m 'Bump Dev Version to ${next_version}'" passthru="true" />
  137. </target>
  138. <target name="release" depends="git-tag,build-packages,distribute-download,pirum-release,update-dev-version" />
  139. </project>