build.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?xml version="1.0"?>
  2. <!--
  3. Doctrine 2 build file.
  4. -->
  5. <project name="DoctrineMigrations" default="build" basedir=".">
  6. <property file="build.properties" />
  7. <!--
  8. Fileset for artifacts shared across all distributed packages.
  9. -->
  10. <fileset id="shared-artifacts" dir=".">
  11. <include name="LICENSE"/>
  12. </fileset>
  13. <!--
  14. Fileset for the sources of the Doctrine Common dependency.
  15. -->
  16. <fileset id="common-sources" dir="./lib/vendor/doctrine-common/lib">
  17. <include name="Doctrine/Common/**"/>
  18. </fileset>
  19. <!--
  20. Fileset for the sources of the Doctrine Migrations.
  21. -->
  22. <fileset id="migrations-sources" dir="./lib">
  23. <include name="Doctrine/DBAL/Migrations/**"/>
  24. </fileset>
  25. <!--
  26. Fileset for the sources of the Doctrine DBAL package.
  27. -->
  28. <fileset id="dbal-sources" dir="./lib/vendor/doctrine-dbal/lib">
  29. <include name="Doctrine/DBAL/**"/>
  30. </fileset>
  31. <!--
  32. Fileset for source of the Symfony YAML and Console components.
  33. -->
  34. <fileset id="symfony-sources" dir="./lib/vendor">
  35. <include name="Symfony/Components/**"/>
  36. </fileset>
  37. <!--
  38. Clean the directory for the next build.
  39. -->
  40. <target name="clean">
  41. <available file="./build.properties" property="build_properties_exist" value="true"/>
  42. <fail unless="build_properties_exist" message="The build.properties file is missing." />
  43. <delete dir="${build.dir}" includeemptydirs="true" />
  44. <delete dir="${dist.dir}" includeemptydirs="true" />
  45. <delete dir="${report.dir}" includeemptydirs="true" />
  46. </target>
  47. <!--
  48. Prepare the new build directories after cleaning
  49. -->
  50. <target name="prepare" depends="clean">
  51. <echo msg="Creating build directory: ${build.dir}" />
  52. <mkdir dir="${build.dir}" />
  53. <echo msg="Creating distribution directory: ${dist.dir}" />
  54. <mkdir dir="${dist.dir}" />
  55. <echo msg="Creating report directory: ${report.dir}" />
  56. <mkdir dir="${report.dir}" />
  57. <mkdir dir="${build.dir}/logs"/>
  58. <mkdir dir="${report.dir}/tests"/>
  59. </target>
  60. <!--
  61. Builds Migrations package, preparing it for distribution.
  62. -->
  63. <target name="build-migrations" depends="test">
  64. <copy todir="${build.dir}/migrations">
  65. <fileset refid="shared-artifacts"/>
  66. </copy>
  67. <copy todir="${build.dir}/migrations">
  68. <fileset refid="common-sources"/>
  69. <fileset refid="dbal-sources" />
  70. <fileset refid="migrations-sources"/>
  71. </copy>
  72. <copy todir="${build.dir}/migrations/Doctrine">
  73. <fileset refid="symfony-sources"/>
  74. </copy>
  75. <exec command="sed 's/${version}-DEV/${version}/' ${build.dir}/migrations/Doctrine/DBAL/Migrations/Version.php > ${build.dir}/migrations/Doctrine/DBAL/Migrations/Version2.php" passthru="true" />
  76. <exec command="mv ${build.dir}/migrations/Doctrine/DBAL/Migrations/Version2.php ${build.dir}/migrations/Doctrine/DBAL/Migrations/Version.php" passthru="true" />
  77. <pharpackage destfile="${build.dir}/doctrine-migrations.phar" basedir="${build.dir}/migrations" stub="./phar-cli-stub.php">
  78. <fileset dir="${build.dir}/migrations">
  79. <include name="**/**" />
  80. </fileset>
  81. <metadata>
  82. <element name="version" value="${version}" />
  83. <element name="authors">
  84. <element name="Johnathan H. Wage">
  85. <element name="e-mail" value="jonwage@gmail.com" />
  86. </element>
  87. </element>
  88. </metadata>
  89. </pharpackage>
  90. </target>
  91. <target name="build" depends="test, build-migrations"/>
  92. <!--
  93. Runs the full test suite.
  94. -->
  95. <target name="test" depends="prepare">
  96. <if><equals arg1="${test.phpunit_generate_coverage}" arg2="1" />
  97. <then>
  98. <property name="test.phpunit_coverage_file" value="${build.dir}/logs/clover.xml" />
  99. </then>
  100. <else>
  101. <property name="test.phpunit_coverage_file" value="false" />
  102. </else>
  103. </if>
  104. <exec command="phpunit --configuration ${test.phpunit_configuration_option} ${test.phpunit_coverage_option} --log-junit ${project.basedir}/${build.dir}/logs/testsuites.xml Doctrine/DBAL/Migrations/Tests/" dir="./tests" passthru="true" />
  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-migrations">
  121. <taskdef classname="phing.tasks.ext.d51PearPkg2Task" name="d51pearpkg2" />
  122. <d51pearpkg2 baseinstalldir="/" dir="${build.dir}/migrations">
  123. <name>DoctrineMigrations</name>
  124. <summary>Doctrine Database Migrations</summary>
  125. <channel>pear.doctrine-project.org</channel>
  126. <description>The Doctrine migrations offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is easy to use and a very powerful tool!</description>
  127. <lead user="jwage" name="Jonathan H. Wage" email="jonwage@gmail.com" />
  128. <license>LGPL</license>
  129. <version release="${version}" api="${version}" />
  130. <stability release="${stability}" api="${stability}" />
  131. <notes>-</notes>
  132. <dependencies>
  133. <php minimum_version="5.3.0" />
  134. <pear minimum_version="1.6.0" recommended_version="1.6.1" />
  135. </dependencies>
  136. </d51pearpkg2>
  137. <exec command="pear package" dir="${build.dir}/migrations" passthru="true" />
  138. <exec command="mv DoctrineMigrations-${version}.tgz ../../dist" dir="${build.dir}/migrations" passthru="true" />
  139. </target>
  140. </project>