build.xml 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!-- Ant build file for Swift Mailer (Standard Edition) -->
  2. <project name="Swift Mailer SE" default="bundle">
  3. <!-- Config settings -->
  4. <property name="path" value="." />
  5. <property name="builddir" value="${path}/build" />
  6. <property name="src.versionfile" value="${path}/VERSION" />
  7. <!-- Generate version info from VERSION file -->
  8. <loadfile property="bundle.name" srcFile="${src.versionfile}">
  9. <filterchain>
  10. <striplinebreaks />
  11. </filterchain>
  12. </loadfile>
  13. <!-- Generate version number -->
  14. <loadfile property="bundle.version" srcFile="${src.versionfile}">
  15. <filterchain>
  16. <striplinebreaks />
  17. <tokenfilter>
  18. <replacestring from="Swift-" to=""/>
  19. </tokenfilter>
  20. </filterchain>
  21. </loadfile>
  22. <property name="src.readmefile" value="${path}/README" />
  23. <property name="src.changesfile" value="${path}/CHANGES" />
  24. <property name="src.libdir" value="${path}/lib" />
  25. <property name="src.testsuite" value="${path}/test-suite" />
  26. <property name="src.tests" value="${path}/tests" />
  27. <property name="builddir.package" value="${builddir}/${bundle.name}" />
  28. <property name="runtests" value="" />
  29. <filelist id="src.licenses" dir="${path}">
  30. <file name="LICENSE" />
  31. </filelist>
  32. <fileset id="build.simpletest.unneeded"
  33. dir="${builddir.package}/test-suite/lib/simpletest">
  34. <include name="docs/" />
  35. <include name="tutorials/" />
  36. <include name="extensions/" />
  37. <include name="test/" />
  38. <include name="packages/" />
  39. </fileset>
  40. <!-- Bundle all files into a central location -->
  41. <target name="bundle" depends="prepare, clean, copy-classes">
  42. <copy file="${src.versionfile}" todir="${builddir.package}" />
  43. <copy file="${src.changesfile}" todir="${builddir.package}" />
  44. <copy todir="${builddir.package}">
  45. <filelist refid="src.licenses" />
  46. </copy>
  47. <copy file="${src.readmefile}" todir="${builddir.package}" />
  48. <move file="${builddir.package}/tests/acceptance.conf.php.default"
  49. tofile="${builddir.package}/tests/acceptance.conf.php" />
  50. <move file="${builddir.package}/tests/smoke.conf.php.default"
  51. tofile="${builddir.package}/tests/smoke.conf.php" />
  52. </target>
  53. <!-- Copy some *.default files to their required files if needed -->
  54. <target name="prepare">
  55. <copy file="${src.tests}/acceptance.conf.php.default"
  56. tofile="${src.tests}/acceptance.conf.php" />
  57. <copy file="${src.tests}/smoke.conf.php.default"
  58. tofile="${src.tests}/smoke.conf.php" />
  59. </target>
  60. <!-- Clean out the build directory -->
  61. <target name="clean">
  62. <delete includeemptydirs="true">
  63. <fileset dir="${builddir}" includes="**/*" />
  64. </delete>
  65. </target>
  66. <!-- Copy all classes from the class path to the bundle -->
  67. <target name="copy-classes">
  68. <copy todir="${builddir.package}/lib">
  69. <fileset dir="${src.libdir}" />
  70. <filterchain>
  71. <replacetokens>
  72. <token key="SWIFT_VERSION_NUMBER" value="${bundle.version}"/>
  73. </replacetokens>
  74. </filterchain>
  75. </copy>
  76. <copy todir="${builddir.package}/test-suite">
  77. <fileset dir="${src.testsuite}" />
  78. </copy>
  79. <copy todir="${builddir.package}/tests">
  80. <fileset dir="${src.tests}" />
  81. </copy>
  82. <delete includeemptydirs="true">
  83. <fileset refid="build.simpletest.unneeded" />
  84. </delete>
  85. </target>
  86. <!-- Package up the project as a gzip file -->
  87. <target name="package" depends="bundle">
  88. <tar destfile="${builddir.package}.tar.gz" compression="gzip" longfile="gnu">
  89. <fileset dir="${builddir}" />
  90. </tar>
  91. <delete includeemptydirs="true">
  92. <fileset dir="${builddir.package}" includes="**" />
  93. </delete>
  94. </target>
  95. <!-- Run the included unit tests -->
  96. <target name="test" depends="prepare, clean, copy-classes">
  97. <exec executable="php" failonerror="true">
  98. <env key="_" value="php" />
  99. <arg value="${builddir.package}/test-suite/run.php" />
  100. <arg value="${runtests}" />
  101. </exec>
  102. </target>
  103. </project>