build.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="Phergie" default="core">
  3. <tstamp>
  4. <format property="DSTAMP" pattern="%Y-%m-%d" />
  5. </tstamp>
  6. <taskdef name="phergiepkg" classname="PhergiePackageTask" />
  7. <taskdef name="phpdocumentor" classname="phing.tasks.ext.phpdoc.PhpDocumentorTask" />
  8. <available file="./build.properties" property="have_properties_file" />
  9. <property name="clean" value="true" />
  10. <target name="input">
  11. <if>
  12. <equals arg1="${have_properties_file}" arg2="true" />
  13. <then>
  14. <property file="./build.properties" />
  15. </then>
  16. <else>
  17. <input propertyname="build.srcdir" defaultvalue="./" message="Source directory" />
  18. <input propertyname="build.dstdir" defaultvalue="./" message="Destination directory" />
  19. <input propertyname="build.version.release" message="Release version" />
  20. <input propertyname="build.version.api" message="API version" />
  21. <input propertyname="build.stability.release" defaultvalue="stable" message="Release stability" validArgs="snapshot,devel,alpha,beta,stable" />
  22. <input propertyname="build.stability.api" defaultvalue="stable" message="API stability" validArgs="snapshot,devel,alpha,beta,stable" />
  23. <input propertyname="build.notes" message="Release notes" />
  24. <input propertyname="build.phpdep" defaultvalue="5.2.0" message="PHP version required" />
  25. <input propertyname="build.pearinstallerdep" defaultvalue="1.9.0" message="PEAR installer version required" />
  26. </else>
  27. </if>
  28. <fileset dir="${build.srcdir}" id="core">
  29. <include name="phergie.php" />
  30. <include name="phergie.bat" />
  31. <include name="LICENSE" />
  32. <include name="Settings.php.dist" />
  33. <include name="Phergie/Autoload.php" />
  34. <include name="Phergie/Bot.php" />
  35. <include name="Phergie/Config/Exception.php" />
  36. <include name="Phergie/Config.php" />
  37. <include name="Phergie/Connection/Exception.php" />
  38. <include name="Phergie/Connection/Handler.php" />
  39. <include name="Phergie/Connection.php" />
  40. <include name="Phergie/Db/Exception.php" />
  41. <include name="Phergie/Db/Manager.php" />
  42. <include name="Phergie/Db/Sqlite.php" />
  43. <include name="Phergie/Driver/Abstract.php" />
  44. <include name="Phergie/Driver/Exception.php" />
  45. <include name="Phergie/Driver/Streams.php" />
  46. <include name="Phergie/Event/Abstract.php" />
  47. <include name="Phergie/Event/Command.php" />
  48. <include name="Phergie/Event/Exception.php" />
  49. <include name="Phergie/Event/Handler.php" />
  50. <include name="Phergie/Event/Request.php" />
  51. <include name="Phergie/Event/Response.php" />
  52. <include name="Phergie/Exception.php" />
  53. <include name="Phergie/Hostmask/Exception.php" />
  54. <include name="Phergie/Hostmask.php" />
  55. <include name="Phergie/Plugin/Abstract.php" />
  56. <include name="Phergie/Plugin/Exception.php" />
  57. <include name="Phergie/Plugin/Handler.php" />
  58. <include name="Phergie/Ui/Abstract.php" />
  59. <include name="Phergie/Ui/Console.php" />
  60. </fileset>
  61. </target>
  62. <target name="core" depends="input">
  63. <property name="build.tmpdir" value="Phergie-${build.version.release}" />
  64. <property name="build.tarball" value="${build.dstdir}${build.tmpdir}.tgz" />
  65. <delete file="${build.tarball}" quiet="true" />
  66. <mkdir dir="${build.tmpdir}" />
  67. <copy todir="${build.tmpdir}">
  68. <fileset refid="core" />
  69. </copy>
  70. <reflexive file="${build.tmpdir}/Phergie/Bot.php">
  71. <filterchain>
  72. <replaceregexp>
  73. <regexp
  74. pattern="const VERSION = '[^']+';"
  75. replace="const VERSION = '${build.version.release}';"
  76. />
  77. </replaceregexp>
  78. </filterchain>
  79. </reflexive>
  80. <phergiepkg name="Phergie" dir="${build.tmpdir}">
  81. <fileset refid="core" />
  82. <option name="baseinstalldir" value="/" />
  83. <option name="outputdirectory" value="${build.dstdir}" />
  84. <option name="channel" value="pear.phergie.org" />
  85. <option name="summary" value="Phergie core library" />
  86. <option name="description" value="The Phergie package provides all files necessary to run a basic IRC bot." />
  87. <option name="apiversion" value="${build.version.api}" />
  88. <option name="apistability" value="${build.stability.api}" />
  89. <option name="releaseversion" value="${build.version.release}" />
  90. <option name="releasestability" value="${build.stability.release}" />
  91. <option name="phpdep" value="${build.phpdep}" />
  92. <option name="pearinstallerdep" value="${build.pearinstallerdep}" />
  93. <option name="license" value="http://phergie.org/license New BSD License" />
  94. <option name="packagetype" value="php" />
  95. <option name="notes" value="${build.notes}" />
  96. <mapping name="replacements">
  97. <element>
  98. <element key="path" value="phergie.php" />
  99. <element key="type" value="pear-config" />
  100. <element key="from" value="/usr/bin/env php" />
  101. <element key="to" value="php_bin" />
  102. </element>
  103. <element>
  104. <element key="path" value="phergie.bat" />
  105. <element key="type" value="pear-config" />
  106. <element key="from" value="@php_bin@" />
  107. <element key="to" value="php_bin" />
  108. </element>
  109. <element>
  110. <element key="path" value="phergie.bat" />
  111. <element key="type" value="pear-config" />
  112. <element key="from" value="@bin_dir@" />
  113. <element key="to" value="bin_dir" />
  114. </element>
  115. </mapping>
  116. <mapping name="exceptions">
  117. <element key="phergie.php" value="script" />
  118. <element key="phergie.bat" value="script" />
  119. </mapping>
  120. <mapping name="releases">
  121. <element>
  122. <element key="installconditions">
  123. <element key="os" value="windows" />
  124. </element>
  125. <element key="filelist">
  126. <element key="install">
  127. <element key="phergie.php" value="phergie" />
  128. </element>
  129. </element>
  130. </element>
  131. <element>
  132. <element key="filelist">
  133. <element key="install">
  134. <element key="phergie.php" value="phergie" />
  135. </element>
  136. <element key="ignore">
  137. <element value="phergie.bat" />
  138. </element>
  139. </element>
  140. </element>
  141. </mapping>
  142. <mapping name="deps">
  143. <element>
  144. <element key="type" value="ext" />
  145. <element key="name" value="pcre" />
  146. </element>
  147. <element>
  148. <element key="type" value="ext" />
  149. <element key="name" value="reflection" />
  150. </element>
  151. </mapping>
  152. </phergiepkg>
  153. <phingcall target="build" />
  154. <phingcall target="clean" />
  155. </target>
  156. <target name="plugin" depends="input">
  157. <if>
  158. <equals arg1="${have_properties_file}" arg2="true" />
  159. <then>
  160. <property file="./build.properties" />
  161. </then>
  162. <else>
  163. <input propertyname="build.plugin" message="Short plugin name" />
  164. <input propertyname="build.summary" message="Plugin summary" />
  165. <input propertyname="build.description" message="Plugin description" />
  166. </else>
  167. </if>
  168. <property name="build.class" value="Phergie_Plugin_${build.plugin}" />
  169. <property name="build.tmpdir" value="${build.class}-${build.version.release}" />
  170. <property name="build.tarball" value="${build.dstdir}${build.tmpdir}.tgz" />
  171. <fileset dir="${build.srcdir}" id="plugin">
  172. <include name="Phergie/Plugin/${build.plugin}.php" />
  173. <include name="Phergie/Plugin/${build.plugin}/**" />
  174. </fileset>
  175. <delete file="${build.tarball}" quiet="true" />
  176. <mkdir dir="${build.tmpdir}" />
  177. <copy todir="${build.tmpdir}">
  178. <fileset refid="plugin" />
  179. </copy>
  180. <phergiepkg name="${build.class}" dir="${build.tmpdir}">
  181. <fileset refid="plugin" />
  182. <option name="baseinstalldir" value="/" />
  183. <option name="outputdirectory" value="${build.dstdir}" />
  184. <option name="channel" value="pear.phergie.org"/>
  185. <option name="summary" value="${build.summary}"/>
  186. <option name="description" value="${build.description}"/>
  187. <option name="apiversion" value="${build.version.api}"/>
  188. <option name="apistability" value="${build.stability.api}"/>
  189. <option name="releaseversion" value="${build.version.release}"/>
  190. <option name="releasestability" value="${build.stability.release}"/>
  191. <option name="phpdep" value="${build.phpdep}" />
  192. <option name="pearinstallerdep" value="${build.pearinstallerdep}" />
  193. <option name="license" value="http://phergie.org/license New BSD License"/>
  194. <option name="packagetype" value="php"/>
  195. <option name="notes" value="${build.notes}"/>
  196. </phergiepkg>
  197. <phingcall target="build" />
  198. <phingcall target="clean" />
  199. </target>
  200. <target name="docs" depends="input">
  201. <property name="build.tmpdir" value="Phergie_Docs-${build.version.release}" />
  202. <property name="build.tarball" value="${build.dstdir}${build.tmpdir}.tgz" />
  203. <delete file="${build.tarball}" quiet="true" />
  204. <mkdir dir="${build.tmpdir}" />
  205. <phpdocumentor title="API Documentation"
  206. destdir="${build.tmpdir}/api"
  207. output="HTML:Smarty:PHP">
  208. <fileset refid="core" />
  209. <projdocfileset dir=".">
  210. <include name="LICENSE" />
  211. </projdocfileset>
  212. </phpdocumentor>
  213. <phergiepkg name="Phergie_Docs" dir="${build.tmpdir}">
  214. <fileset dir="${build.tmpdir}">
  215. <include name="api**" />
  216. </fileset>
  217. <option name="baseinstalldir" value="/" />
  218. <option name="outputdirectory" value="${build.dstdir}" />
  219. <option name="channel" value="pear.phergie.org" />
  220. <option name="summary" value="Phergie core library documentation" />
  221. <option name="description" value="The Phergie_Docs package provides documentation for the Phergie core libraries." />
  222. <option name="apiversion" value="${build.version.api}" />
  223. <option name="apistability" value="${build.stability.api}" />
  224. <option name="releaseversion" value="${build.version.release}" />
  225. <option name="releasestability" value="${build.stability.release}" />
  226. <option name="phpdep" value="${build.phpdep}" />
  227. <option name="pearinstallerdep" value="${build.pearinstallerdep}" />
  228. <option name="license" value="http://phergie.org/license New BSD License" />
  229. <option name="packagetype" value="php" />
  230. <option name="notes" value="${build.notes}" />
  231. <mapping name="exceptions">
  232. <element key="api" value="doc" />
  233. </mapping>
  234. </phergiepkg>
  235. <phingcall target="build" />
  236. <phingcall target="clean" />
  237. </target>
  238. <target name="build">
  239. <tar destfile="${build.tarball}" compression="gzip">
  240. <fileset dir="${build.dstdir}">
  241. <include name="${build.tmpdir}**" />
  242. <include name="package.xml" />
  243. </fileset>
  244. </tar>
  245. </target>
  246. <target name="clean">
  247. <if>
  248. <istrue value="${clean}" />
  249. <then>
  250. <delete dir="${build.tmpdir}" />
  251. <delete file="${build.dstdir}package.xml" />
  252. </then>
  253. </if>
  254. </target>
  255. </project>