Advertisement
Guest User

Untitled

a guest
Jul 17th, 2013
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 85.36 KB | None | 0 0
  1. <?xml version="1.0"?>
  2.  
  3. <!--
  4. $RCSfile: build.xml,v $
  5. $Revision: 13668 $
  6. $Date: 2013-05-28 17:15:05 +0200 (Wt, 28 maj 2013) $
  7.  
  8. This software is published under the terms of the Apache License, Version 2.0,
  9. a copy of which is included in this distribution.
  10. -->
  11.  
  12. <!--
  13. Build Requirements:
  14.  
  15. * Ant 1.6 or 1.7 (including optional tasks)
  16. * JDK 1.5 or higher
  17. * jUnit in your Ant or Java classpath
  18. -->
  19.  
  20. <project name="Openfire XMPP Server" default="openfire" basedir="..">
  21.  
  22. <description>
  23. Openfire build script.
  24. </description>
  25.  
  26. <!-- ======================================================================================= -->
  27. <!-- GLOBAL TASKDEFs -->
  28. <!-- ======================================================================================= -->
  29.  
  30. <taskdef resource="net/sf/antcontrib/antcontrib.properties">
  31. <classpath>
  32. <pathelement location="${basedir}/build/lib/ant-contrib.jar"/>
  33. </classpath>
  34. </taskdef>
  35. <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask">
  36. <classpath>
  37. <pathelement location="${basedir}/build/lib/xmltask.jar"/>
  38. </classpath>
  39. </taskdef>
  40. <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task">
  41. <classpath>
  42. <pathelement location="${basedir}/build/lib/pack200task.jar"/>
  43. </classpath>
  44. </taskdef>
  45. <taskdef name="unpack200" classname="com.sun.tools.apache.ant.pack200.Unpack200Task">
  46. <classpath>
  47. <pathelement location="${basedir}/build/lib/pack200task.jar"/>
  48. </classpath>
  49. </taskdef>
  50. <typedef name="srcinc" classname="com.jivesoftware.tools.selector.IncludeSourceSelector" >
  51. <classpath>
  52. <pathelement location="${basedir}/build/lib/ant-jive-edition.jar"/>
  53. <pathelement location="${basedir}/build/lib/qdox.jar"/>
  54. </classpath>
  55. </typedef>
  56.  
  57.  
  58. <!-- ======================================================================================= -->
  59. <!-- GLOBAL PROPERTIES -->
  60. <!-- ======================================================================================= -->
  61.  
  62. <property name="version.major" value="3"/>
  63. <property name="version.minor" value="8"/>
  64. <property name="version.revision" value="3"/>
  65. <property name="version.extra" value="alpha"/> <!-- For 'beta' or 'alpha' -->
  66. <property name="dist.prefix" value="openfire"/>
  67.  
  68. <property file="${basedir}/build/build.properties"/>
  69.  
  70. <property name="src.dir" value="${basedir}/src"/>
  71. <property name="src.java.dir" value="${src.dir}/java"/>
  72. <property name="src.i18n.dir" value="${src.dir}/i18n"/>
  73. <property name="src.test.dir" value="${src.dir}/test"/>
  74. <property name="src.test.java.dir" value="${src.test.dir}/java"/>
  75. <property name="docs.dir" value="${basedir}/documentation"/>
  76. <property name="web.dir" value="${src.dir}/web"/>
  77. <property name="spank.dir" value="${src.dir}/spank"/>
  78. <property name="lib.build.dir" value="${basedir}/build/lib"/>
  79. <property name="lib.build.installer.dir" value="${basedir}/build/installer"/>
  80. <property name="lib.merge.dir" value="${lib.build.dir}/merge"/>
  81. <property name="lib.dist.dir" value="${lib.build.dir}/dist"/>
  82. <property name="lib.web.dir" value="${web.dir}/WEB-INF/lib"/>
  83. <property name="i18n.basename" value="openfire_i18n"/>
  84. <property name="i18n.default.locale" value="en"/>
  85.  
  86. <property name="work.dir" value="${basedir}/work"/>
  87. <property name="temp.build.dir" value="${work.dir}/tempbuild"/>
  88. <property name="target.i18n.dir" value="${temp.build.dir}/i18n"/>
  89.  
  90. <property name="target.dir" value="${basedir}/target"/>
  91. <property name="target.openfireHome" value="${target.dir}/openfire"/>
  92.  
  93. <property name="compile.dir" value="${work.dir}/classes"/>
  94. <property name="jar.name" value="openfire.jar"/>
  95. <property name="jar.starter.name" value="startup.jar"/>
  96. <property name="jar.dest.dir" value="${work.dir}/lib"/>
  97. <property name="resources.dir" value="${src.dir}/resources"/>
  98. <property name="pack200.enabled" value="true"/>
  99.  
  100. <property name="overlay.dir" value="${basedir}/custom"/>
  101. <property name="overlay.src.dir" value="${overlay.dir}/source"/>
  102. <property name="overlay.web.dir" value="${overlay.dir}/webapp"/>
  103. <property name="overlay.properties.file" value="overlay.properties"/>
  104. <property name="overlay.compile.dir" value="${work.dir}/overlay/classes"/>
  105.  
  106. <property name="javadoc.src.dir" value="${src.dir}/javadoc"/>
  107. <property name="javadoc.dest.dir" value="${work.dir}/javadoc"/>
  108. <property name="jspc.jsp.src.dir" value="${work.dir}/jspc/jsp"/>
  109. <property name="jspc.dest.dir" value="${work.dir}/jspc"/>
  110. <property name="jspc.java.dest.dir" value="${work.dir}/jspc/java"/>
  111. <property name="jspc.classes.dest.dir" value="${work.dir}/jspc/classes"/>
  112. <property name="jspc.jar.name" value="admin-jsp.jar"/>
  113.  
  114. <property name="test.dest.dir" value="${work.dir}/test"/>
  115. <property name="test.classes.dest.dir" value="${test.dest.dir}/classes"/>
  116. <property name="test.results.dest.dir" value="${test.dest.dir}/results"/>
  117.  
  118. <property name="plugin.src.dir" value="${src.dir}/plugins"/>
  119. <property name="plugin.dev.dir" value=""/>
  120. <!-- Set by a developer as alt plugin location -->
  121. <property name="plugin.dev.dest.dir" value="${work.dir}/plugins-dev"/>
  122. <property name="plugin.dest.dir" value="${work.dir}/plugins"/>
  123. <property name="nonrelease.plugin.dir" value="${basedir}/plugins-tmp"/>
  124. <property name="webapp.dest.dir" value="${work.dir}/webapp"/>
  125.  
  126. <property name="release.dest.dir" value="${target.dir}/release"/>
  127. <property name="package.dest.dir" value="${release.dest.dir}"/>
  128. <property name="overwrite" value="false"/>
  129. <property name="deploy.jar.dir" value="${jar.dest.dir}"/>
  130. <property name="anttools.src.dir" value="${src.dir}/tools"/>
  131. <property name="anttools.target.dir" value="${work.dir}/tools"/>
  132. <property name="copy.dbscripts" value="true"/>
  133. <property name="overwrite" value="true"/>
  134.  
  135. <property name="installer.install4j.home" value="/home/j2ee-bamboo/install4j.4.0.5"/>
  136. <property name="installer.src" value="${basedir}/build/installer"/>
  137. <property name="installer.dest.dir" value="${release.dest.dir}"/>
  138. <property name="installer.install4j.srcfile" value="${installer.src}/openfire.install4j"/>
  139. <property name="installer.app_name" value="Openfire"/>
  140. <property name="installer.app_short_name" value="openfire"/>
  141. <property name="installer.product_name" value="openfire"/>
  142. <property name="installer.application_id" value="6886-9911-0474-3571"/>
  143. <property name="installer.unix_install_dir" value="openfire"/>
  144. <property name="installer.windows_install_dir" value="Openfire"/>
  145. <property name="installer.publisher" value="Ignite Realtime RTC Community"/>
  146. <property name="installer.publisher_url" value="www.igniterealtime.org"/>
  147. <property name="installer.file_prefix" value="${installer.app_short_name}"/>
  148. <property name="installer.release_root_path" value="${release.dest.dir}"/>
  149.  
  150. <property name="license.file.path" value="${docs.dir}/dist"/>
  151.  
  152. <!-- For auto-running and debugging -->
  153. <property name="debug" value="false"/>
  154.  
  155. <!-- ======================================================================================= -->
  156. <!-- PATHs / PATTERNSETs / FILTERSETs -->
  157. <!-- ======================================================================================= -->
  158.  
  159. <path id="javadoc.dependencies">
  160. <fileset dir="${lib.build.dir}" includes="*.jar" excludes="junit.jar"/>
  161. <fileset dir="${lib.merge.dir}" includes="*.jar"/>
  162. <fileset dir="${lib.dist.dir}"
  163. includes="servlet.jar, mail.jar, activation.jar, jdic.jar, bouncycastle.jar"/>
  164. </path>
  165.  
  166. <path id="compile.dependencies">
  167. <path refid="javadoc.dependencies"/>
  168. </path>
  169.  
  170. <path id="jspc.dependencies">
  171. <path refid="compile.dependencies"/>
  172. <fileset dir="${lib.web.dir}" includes="*.jar"/>
  173. </path>
  174.  
  175. <path id="test.dependencies">
  176. <path refid="compile.dependencies"/>
  177. <fileset dir="${jar.dest.dir}" includes="openfire.jar"/>
  178. <fileset dir="${lib.build.dir}" includes="junit.jar"/>
  179. <fileset dir="${lib.dist.dir}" includes="slf4j-log4j12.jar"/>
  180. <!-- <fileset dir="${ant.home}/lib" includes="clover.jar" /> -->
  181. </path>
  182.  
  183. <path id="plugin.dependencies">
  184. <path refid="javadoc.dependencies"/>
  185. <fileset dir="${jar.dest.dir}" includes="openfire.jar"/>
  186. </path>
  187.  
  188. <patternset id="compile.sources">
  189. <include name="**/*.java"/>
  190. </patternset>
  191.  
  192. <patternset id="test.sources">
  193. <include name="**/*Test.java"/>
  194. </patternset>
  195.  
  196. <patternset id="web.sources">
  197. <include name="**/*.jsp"/>
  198. <include name="**/*.jar"/>
  199. <include name="**/*.tld"/>
  200. <include name="**/*.jspf"/>
  201. <include name="**/*.html"/>
  202. <include name="**/*.css"/>
  203. <include name="**/*.gif"/>
  204. <include name="**/*.png"/>
  205. <include name="**/favicon.ico"/>
  206. <include name="**/*.js"/>
  207. </patternset>
  208.  
  209. <!-- ======================================================================================= -->
  210. <!-- TARGETs -->
  211. <!-- ======================================================================================= -->
  212.  
  213. <!-- init ================================================================================== -->
  214. <target name="init">
  215.  
  216. <!-- Check for min build requirements -->
  217.  
  218. <condition property="ant.not.ok" value="true">
  219. <not>
  220. <or>
  221. <contains string="${ant.version}" substring="1.6"/>
  222. <contains string="${ant.version}" substring="1.7"/>
  223. <contains string="${ant.version}" substring="1.8"/>
  224. <contains string="${ant.version}" substring="1.9"/>
  225. </or>
  226. </not>
  227. </condition>
  228. <condition property="java.not.ok" value="true">
  229. <not>
  230. <or>
  231. <contains string="${ant.java.version}" substring="1.5"/>
  232. <contains string="${ant.java.version}" substring="1.6"/>
  233. <contains string="${ant.java.version}" substring="1.7"/>
  234. </or>
  235. </not>
  236. </condition>
  237. <fail if="ant.not.ok" message="Must use Ant 1.6.x or 1.7.x to build Openfire"/>
  238. <fail if="java.not.ok" message="Must use JDK 1.5.x or higher to build Openfire"/>
  239.  
  240. <tstamp/>
  241. <tstamp>
  242. <format property="builddate" pattern="MM/dd/yyyy"/>
  243. </tstamp>
  244. <tstamp>
  245. <format property="dailybuild.tstamp" pattern="yyyy-MM-dd" locale="en"/>
  246. </tstamp>
  247.  
  248. <mkdir dir="${work.dir}"/>
  249. <mkdir dir="${overlay.compile.dir}"/>
  250.  
  251. <!-- Setup the full version property correctly -->
  252. <if>
  253. <equals arg1="${version.extra}" arg2=""/>
  254. <then>
  255. <property name="version"
  256. value="${version.major}.${version.minor}.${version.revision}"/>
  257. <property name="version.filename"
  258. value="${version.major}_${version.minor}_${version.revision}"/>
  259. </then>
  260. <else>
  261. <property name="version"
  262. value="${version.major}.${version.minor}.${version.revision}.${version.extra}"/>
  263. <property name="version.filename"
  264. value="${version.major}_${version.minor}_${version.revision}_${version.extra}"/>
  265. </else>
  266. </if>
  267. </target>
  268.  
  269. <!-- compile =============================================================================== -->
  270. <target name="compile" depends="init" description="Compiles Openfire app code">
  271. <mkdir dir="${compile.dir}"/>
  272. <javac
  273. destdir="${compile.dir}"
  274. includeAntRuntime="no"
  275. debug="on"
  276. source="1.5"
  277. target="1.5"
  278. >
  279. <src path="${src.java.dir}"/>
  280. <patternset refid="compile.sources"/>
  281. <classpath>
  282. <path refid="compile.dependencies"/>
  283. </classpath>
  284. </javac>
  285.  
  286. <available file="${overlay.src.dir}" type="dir" property="overlay.source.found"/>
  287. <if>
  288. <equals arg1="${overlay.source.found}" arg2="true"/>
  289. <then>
  290.  
  291. <mkdir dir="${overlay.compile.dir}"/>
  292. <javac
  293. destdir="${overlay.compile.dir}"
  294. includeAntRuntime="no"
  295. debug="on"
  296. source="1.5"
  297. target="1.5"
  298. >
  299. <src path="${overlay.src.dir}"/>
  300. <patternset refid="compile.sources"/>
  301. <classpath>
  302. <path refid="compile.dependencies"/>
  303. <path location="${compile.dir}"/>
  304. </classpath>
  305. </javac>
  306.  
  307. </then>
  308. <else><echo>Nothing to compile from custom here </echo></else>
  309. </if>
  310.  
  311. </target>
  312.  
  313. <!-- i18n ================================================================================== -->
  314. <!-- Note, this is a "private" target - no need to call it externally -->
  315. <target name="-i18n">
  316. <!-- Auto generates a default base i18n file -->
  317. <mkdir dir="${target.i18n.dir}"/>
  318. <copy file="${src.i18n.dir}/${i18n.basename}_${i18n.default.locale}.properties"
  319. tofile="${target.i18n.dir}/${i18n.basename}.properties"/>
  320.  
  321. <!-- if title override file exists, overwrite all i18n files -->
  322. <available file="${overlay.dir}/${overlay.properties.file}" type="file" property="overlay.props.found"/>
  323. <if>
  324. <equals arg1="${overlay.props.found}" arg2="true"/>
  325. <then>
  326. <echo>Found overlay file: ${overlay.dir}/${overlay.properties.file}</echo>
  327. <property file="${overlay.dir}/${overlay.properties.file}"/>
  328. <replace dir="${target.i18n.dir}">
  329. <replacefilter token="title = Wildfire" value="title=${title}"/>
  330. <replacefilter token="short.title = Wildfire" value="short.title=${short.title}"/>
  331. </replace>
  332.  
  333. </then>
  334. </if>
  335. </target>
  336.  
  337. <target name="plugins-dev" depends="anttasks">
  338. <!-- Setup Openfire -->
  339. <ant antfile="${basedir}/build/build.xml" dir="${basedir}" target="openfire"
  340. inheritAll="false" inheritRefs="false"/>
  341.  
  342. <copy file="${java.home}/../lib/tools.jar" todir="${jar.dest.dir}"></copy>
  343. <copy file="${ant.home}/lib/ant.jar" todir="${jar.dest.dir}"></copy>
  344.  
  345. <!-- Retrieve each plugin -->
  346. <!-- Get a list of subdirs of the main plugins dir. This tells us which plugins to make.
  347. <subdirinfo dir="${plugin.src.dir}" property="dirlist" ifexists="plugin.xml" except="admin"/>
  348.  
  349. <for list="${dirlist}" param="plugin" trim="true">
  350. <sequential>
  351. <xmltask source="${plugin.src.dir}/@{plugin}/plugin.xml" dest="${plugin.src.dir}/@{plugin}/plugins2.xml">
  352. <insert path="/plugin/minOpenfireVersion[last()]" position="after">
  353. <![CDATA[
  354. <development>
  355. <webRoot>
  356. ${java.home}
  357. </webRoot>
  358. <classesDir>
  359. XXXXXXXXX
  360. </classesDir>
  361. </development>
  362. ]]>
  363. </insert>
  364. </xmltask>
  365. <jar jarfile="c:\\test\\@{plugin}.jar">
  366. <fileset dir="${plugin.src.dir}/@{plugin}" includes="*.xml"/>
  367. </jar>
  368. </sequential>
  369. </for>
  370. -->
  371.  
  372. </target>
  373.  
  374. <!-- openfire =================================================================================== -->
  375. <target name="openfire" depends="compile, jspc, -i18n"
  376. description="Compiles and generates runnable target/openfire folder">
  377. <mkdir dir="${jar.dest.dir}"/>
  378. <!-- Make main Openfire jar -->
  379. <jar jarfile="${jar.dest.dir}/${jar.name}" index="true" duplicate="preserve">
  380. <fileset dir="${compile.dir}" includes="**/*.class"
  381. excludes="org/jivesoftware/openfire/starter/ServerStarter*.class,org/jivesoftware/openfire/launcher/*.class">
  382. <!-- don't include files that have an overlay counterpart -->
  383. <present present="srconly" targetdir="${overlay.compile.dir}"/>
  384. </fileset>
  385. <!-- now include overlay files -->
  386. <fileset dir="${overlay.compile.dir}" includes="**/*.class"/>
  387. <fileset dir="${src.i18n.dir}" includes="*.properties"/>
  388. <fileset dir="${target.i18n.dir}" includes="*.properties"/>
  389. <fileset dir="${resources.dir}/jar" includes="**"/>
  390. <zipgroupfileset dir="${lib.merge.dir}" includes="*.jar"/>
  391. <manifest>
  392. <attribute name="Built-By" value="Jive Software (www.igniterealtime.org)"/>
  393. </manifest>
  394. </jar>
  395.  
  396. <!-- Make startup jar -->
  397. <jar jarfile="${jar.dest.dir}/${jar.starter.name}">
  398. <fileset dir="${compile.dir}">
  399. <include name="org/jivesoftware/openfire/starter/ServerStarter*.class"/>
  400. <include name="org/jivesoftware/openfire/launcher/*.class"/>
  401. <include name="org/jivesoftware/openfire/starter/JiveClassLoader*.class"/>
  402. </fileset>
  403. <fileset dir="${lib.build.installer.dir}/images" includes="**/*.gif"/>
  404. <fileset dir="${lib.build.installer.dir}/images" includes="**/*.png"/>
  405. <manifest>
  406. <attribute name="Main-Class"
  407. value="org.jivesoftware.openfire.starter.ServerStarter"/>
  408. <attribute name="Built-By" value="Jive Software (www.igniterealtime.org)"/>
  409. </manifest>
  410. </jar>
  411. <!-- Copy application dependent files -->
  412. <copy todir="${jar.dest.dir}">
  413. <fileset dir="${lib.dist.dir}" includes="*.*"/>
  414. </copy>
  415.  
  416. <!-- Copy in tag library support -->
  417. <copy todir="${jar.dest.dir}">
  418. <fileset dir="${lib.build.dir}" includes="commons-el.jar"/>
  419. </copy>
  420.  
  421. <!-- Copy in jasper runtime jar -->
  422. <copy todir="${jar.dest.dir}">
  423. <fileset dir="${lib.build.dir}" includes="jasper-runtime.jar"/>
  424. <fileset dir="${lib.build.dir}" includes="jasper-compiler.jar"/>
  425. </copy>
  426.  
  427. <!-- Update/create target/openfire directory -->
  428. <antcall target="openfireHome"/>
  429. </target>
  430.  
  431. <!-- run =================================================================================== -->
  432. <target name="run" description="Starts Openfire inline to the build process.">
  433. <available file="${target.openfireHome}" type="dir" property="openfire.found"/>
  434. <fail unless="openfire.found"
  435. message="Can't find openfire, run 'ant openfire' or specify with -Dtarget.openfireHome."/>
  436.  
  437. <condition property="run.debug"
  438. value="-Xdebug -Xint -server -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000">
  439. <isset property="debug"/>
  440. </condition>
  441.  
  442. <property name="run.spawn" value="false"/>
  443.  
  444. <java jar="${target.openfireHome}/lib/startup.jar" fork="true" spawn="${run.spawn}"
  445. dir="${target.openfireHome}/bin">
  446. <jvmarg line="${run.debug} -DopenfireHome=${target.openfireHome}"/>
  447. </java>
  448. </target>
  449.  
  450.  
  451. <!-- run.test.init ========================================================================= -->
  452. <target name="run.test.init">
  453. <delete dir="${target.openfireHome}"/>
  454.  
  455. <property name="openfireHome.preconfigured" value="true"/>
  456.  
  457. <property name="run.spawn" value="true"/>
  458. </target>
  459.  
  460. <!-- run.test ============================================================================== -->
  461. <!-- Starts Openfire inline to the build process, with a clean pre-configured openfireHome -->
  462. <target name="run.test" depends="run.test.init,openfireHome,run">
  463. <echo>Openfire server started.</echo>
  464. </target>
  465.  
  466. <!-- javadoc =============================================================================== -->
  467. <target name="javadoc" depends="init" description="Produces Openfire Javadocs">
  468. <mkdir dir="${javadoc.dest.dir}"/>
  469. <antcall target="-javadoc-impl"/>
  470. </target>
  471.  
  472. <target name="-javadoc-impl" unless="no.javadoc">
  473. <!-- Run javadoc over all source code -->
  474. <javadoc
  475. packagenames="org.jivesoftware.*, org.xmpp.*"
  476. destdir="${javadoc.dest.dir}"
  477. windowtitle="Openfire ${version} Javadoc"
  478. overview="${src.java.dir}/overview.html"
  479. failonerror="yes"
  480. >
  481. <sourcepath>
  482. <path location="${src.java.dir}"/>
  483. </sourcepath>
  484. <doctitle>
  485. <![CDATA[<font face="arial,helvetica,sans-serif">Openfire ${version} Javadoc</font>]]></doctitle>
  486. <header><![CDATA[<b>Openfire ${version} Javadoc</b>]]></header>
  487. <bottom><![CDATA[<i>Copyright &copy; 2003-2008 Jive Software.</i>]]></bottom>
  488. <classpath>
  489. <path refid="javadoc.dependencies"/>
  490. </classpath>
  491. <link offline="true" href="http://java.sun.com/j2se/1.5.0/docs/api/"
  492. packagelistLoc="${javadoc.src.dir}/jdk15"/>
  493. </javadoc>
  494. </target>
  495.  
  496. <!-- jspc ================================================================================== -->
  497. <target name="jspc" depends="compile" description="Compiles all JSP pages in the admin console">
  498. <mkdir dir="${jspc.dest.dir}"/>
  499. <mkdir dir="${jspc.java.dest.dir}"/>
  500. <mkdir dir="${jspc.classes.dest.dir}"/>
  501. <mkdir dir="${webapp.dest.dir}"/>
  502.  
  503. <antcall target="-jspc-impl"/>
  504. </target>
  505.  
  506. <target name="-jspc-impl" unless="no.jspc">
  507.  
  508. <!-- we're forced to create a temp dir to properly overwrite sources from overlay directory -->
  509. <mkdir dir="${jspc.jsp.src.dir}"/>
  510.  
  511. <copy todir="${jspc.jsp.src.dir}">
  512. <fileset dir="${web.dir}"/>
  513. </copy>
  514. <!-- copy overlay -->
  515.  
  516. <available file="${overlay.web.dir}" type="dir" property="overlay.webdir.found"/>
  517. <if>
  518. <equals arg1="${overlay.webdir.found}" arg2="true"/>
  519. <then>
  520. <copy todir="${jspc.jsp.src.dir}" overwrite="true">
  521. <fileset dir="${overlay.web.dir}"/>
  522. </copy>
  523. </then>
  524. </if>
  525.  
  526.  
  527. <java classname="org.apache.jasper.JspC" fork="true">
  528. <classpath>
  529. <pathelement location="${java.home}/../lib/tools.jar"/>
  530. <pathelement path="${compile.dir}"/>
  531. <path refid="jspc.dependencies"/>
  532. </classpath>
  533. <arg line="-uriroot '${jspc.jsp.src.dir}'"/>
  534. <arg line="-d '${jspc.java.dest.dir}'"/>
  535. <arg line="-p org.jivesoftware.openfire.admin"/>
  536. <arg line="-webinc '${jspc.dest.dir}/web.partial.xml'"/>
  537. </java>
  538.  
  539. <!-- Compile java source -->
  540. <javac
  541. destdir="${jspc.classes.dest.dir}"
  542. includeAntRuntime="no"
  543. debug="on"
  544. source="1.5"
  545. target="1.5"
  546. includes="org/jivesoftware/openfire/admin/**/*.java"
  547. >
  548. <src path="${jspc.java.dest.dir}"/>
  549. <classpath>
  550. <pathelement path="${compile.dir}"/>
  551. <path refid="jspc.dependencies"/>
  552. </classpath>
  553. </javac>
  554.  
  555. <!-- Update the web.xml to include the servlet and servlet mapping defs from jspc -->
  556. <loadfile property="servlet-xml" srcFile="${jspc.dest.dir}/web.partial.xml" failonerror="false" />
  557. <copy file="${web.dir}/WEB-INF/web.xml"
  558. toFile="${webapp.dest.dir}/WEB-INF/web.xml"
  559. overwrite="true">
  560. <filterset begintoken="&lt;!--@@" endtoken="@@--&gt;">
  561. <filter token="JSPC-SERVLETS" value="${servlet-xml}"/>
  562. </filterset>
  563. </copy>
  564.  
  565. <!-- Copy over Sitemesh files. -->
  566. <copy file="${web.dir}/WEB-INF/decorators.xml"
  567. toFile="${webapp.dest.dir}/WEB-INF/decorators.xml"
  568. overwrite="true">
  569. </copy>
  570. <copy file="${web.dir}/WEB-INF/sitemesh.xml"
  571. toFile="${webapp.dest.dir}/WEB-INF/sitemesh.xml"
  572. overwrite="true">
  573. </copy>
  574. <copy file="${web.dir}/WEB-INF/dwr.xml"
  575. toFile="${webapp.dest.dir}/WEB-INF/dwr.xml"
  576. overwrite="true">
  577. </copy>
  578.  
  579. <!-- Create a jar of compiled servlets -->
  580. <jar jarfile="${jspc.dest.dir}/${jspc.jar.name}">
  581. <fileset dir="${jspc.classes.dest.dir}" includes="**/*.class"/>
  582. </jar>
  583.  
  584. </target>
  585.  
  586. <!-- test ================================================================================== -->
  587. <target name="test" depends="openfire" description="Compiles and runs test cases">
  588. <!-- Compile all test code -->
  589. <mkdir dir="${test.classes.dest.dir}"/>
  590. <javac
  591. destdir="${test.classes.dest.dir}"
  592. includeAntRuntime="no"
  593. debug="on"
  594. source="1.5"
  595. target="1.5"
  596. >
  597. <src path="${src.test.java.dir}"/>
  598. <patternset refid="test.sources"/>
  599. <classpath>
  600. <path refid="test.dependencies"/>
  601. <pathelement path="${compile.dir}"/>
  602. </classpath>
  603. </javac>
  604.  
  605. <!-- Copy resources -->
  606. <copy todir="${test.dest.dir}">
  607. <fileset dir="${src.test.dir}" includes="resources/**/*.*"/>
  608. </copy>
  609.  
  610. <!-- Run jUnit -->
  611. <mkdir dir="${test.results.dest.dir}"/>
  612. <junit printsummary="yes" haltonfailure="yes" fork="yes" dir="${test.dest.dir}">
  613. <sysproperty key="openfireHome" value="${target.openfireHome}"/>
  614.  
  615. <!-- We must add our own classes to the classpath for testing -->
  616. <classpath>
  617. <path refid="test.dependencies"/>
  618. <pathelement path="${test.dest.dir}/resources"/>
  619. <pathelement path="${test.classes.dest.dir}"/>
  620. </classpath>
  621.  
  622. <formatter type="xml"/>
  623.  
  624. <batchtest todir="${test.results.dest.dir}">
  625. <fileset dir="${src.test.java.dir}">
  626. <patternset refid="test.sources"/>
  627. </fileset>
  628. </batchtest>
  629. </junit>
  630. </target>
  631.  
  632. <!-- openfireHome ========================================================================== -->
  633. <target name="openfireHome" unless="openfireHome.no.update">
  634. <!-- Set this to true to enable a pre-setup openfireHome directory -->
  635. <property name="openfireHome.preconfigured" value="false"/>
  636. <property name="openfireHome.no.plugins" value="false"/>
  637.  
  638. <mkdir dir="${target.openfireHome}"/>
  639.  
  640. <!-- Copy conf dir -->
  641. <copy todir="${target.openfireHome}">
  642. <fileset dir="${src.dir}" includes="conf/**/*.*"></fileset>
  643. </copy>
  644.  
  645. <!-- Copy database scripts -->
  646. <if>
  647. <equals arg1="${copy.dbscripts}" arg2="true"/>
  648. <then>
  649. <copy todir="${target.openfireHome}/resources">
  650. <fileset dir="${src.dir}" includes="database/**/*.sql"></fileset>
  651. </copy>
  652. </then>
  653. </if>
  654.  
  655. <!-- Copy security resources -->
  656. <copy todir="${target.openfireHome}/resources">
  657. <fileset dir="${src.dir}">
  658. <include name="security/*"/>
  659. <include name="security/*.*"/>
  660. </fileset>
  661. </copy>
  662.  
  663. <!-- Copy native authentication files -->
  664. <copy todir="${target.openfireHome}/resources">
  665. <fileset dir="${src.dir}/resources">
  666. <include name="nativeAuth/**"/>
  667. </fileset>
  668. </copy>
  669.  
  670. <!-- Copy lib dir -->
  671. <copy todir="${target.openfireHome}/lib">
  672. <fileset dir="${jar.dest.dir}" includes="*.*"></fileset>
  673. </copy>
  674.  
  675. <!-- Overwrite config with build/openfireHome dir, if requested -->
  676. <if>
  677. <equals arg1="${openfireHome.preconfigured}" arg2="true"/>
  678. <then>
  679. <!-- Copy pre-configured openfireHome dir -->
  680. <copy todir="${target.openfireHome}">
  681. <fileset dir="${basedir}/build/openfireHome" includes="**/*.*"/>
  682. </copy>
  683. </then>
  684. </if>
  685.  
  686. <!-- Copy admin Plugin -->
  687. <antcall target="adminPlugin">
  688. <param name="plugin.dest.dir" value="${target.openfireHome}/plugins"/>
  689. </antcall>
  690.  
  691. <antcall target="spank">
  692. <param name="plugin.dest.dir" value="${target.openfireHome}/plugins"/>
  693. </antcall>
  694.  
  695. <!-- Copy compiled plugins if we need to -->
  696. <if>
  697. <and>
  698. <equals arg1="${openfireHome.no.plugins}" arg2="false"/>
  699. <available file="${plugin.dest.dir}" />
  700. </and>
  701. <then>
  702. <copy todir="${target.openfireHome}/plugins" failonerror="false">
  703. <fileset dir="${plugin.dest.dir}"/>
  704. </copy>
  705. </then>
  706. </if>
  707.  
  708. <!-- Copy bin dir -->
  709. <copy todir="${target.openfireHome}">
  710. <fileset dir="${src.dir}" includes="bin/**/*"/>
  711. </copy>
  712. <fixcrlf srcdir="${target.openfireHome}/bin" eol="lf" eof="remove" includes="*.sh,extra/*"/>
  713.  
  714. <!-- Create a logs dir in the binary release -->
  715. <mkdir dir="${target.openfireHome}/logs"/>
  716. </target>
  717.  
  718. <!-- adminPlugin =========================================================================== -->
  719. <target name="adminPlugin">
  720. <!-- Copy admin plugin source (if any) -->
  721. <copy todir="${plugin.dest.dir}">
  722. <fileset dir="${src.dir}/plugins" includes="admin/*.*"/>
  723. </copy>
  724.  
  725. <!-- Copy admin plugin resources -->
  726. <copy todir="${plugin.dest.dir}/admin/webapp">
  727. <!-- All web resources minus jsp's and jspf's - those are precompiled -->
  728. <fileset dir="${web.dir}">
  729. <patternset refid="web.sources"/>
  730. <exclude name="**/*.jsp"/>
  731. <exclude name="**/*.jspf"/>
  732. </fileset>
  733. </copy>
  734. <!-- Copy other admin WEB-INF stuff -->
  735. <copy todir="${plugin.dest.dir}/admin/webapp">
  736. <fileset dir="${webapp.dest.dir}"/>
  737. </copy>
  738.  
  739. <!-- Copy in pre-compiled JSP jar -->
  740. <copy todir="${plugin.dest.dir}/admin/webapp/WEB-INF/lib" overwrite="${overwrite}">
  741. <fileset dir="${jspc.dest.dir}" includes="${jspc.jar.name}"/>
  742. </copy>
  743.  
  744. </target>
  745.  
  746. <target name="spank">
  747. <mkdir dir="${target.openfireHome}/resources/spank"/>
  748. <copy todir="${target.openfireHome}/resources/spank">
  749. <!-- All web resources minus jsp's and jspf's - those are precompiled -->
  750. <fileset dir="${spank.dir}">
  751. <patternset refid="web.sources"/>
  752. <exclude name="**/*.jsp"/>
  753. <exclude name="**/*.jspf"/>
  754. <include name="**/*.xml"/>
  755. <include name="**/*.swf"/>
  756. </fileset>
  757. </copy>
  758. </target>
  759.  
  760. <!-- dist.init ============================================================================== -->
  761. <target name="dist.init" >
  762. <!-- ie: openfire_src -->
  763. <property name="release.name.src" value="${dist.prefix}_src"/>
  764. <!-- ie: openfire_src_2_1_2 -->
  765. <property name="release.fullname.src" value="${dist.prefix}_src_${version.filename}"/>
  766. <property name="package.dest.filename.zip" value="${package.dest.dir}/${release.fullname.src}.zip" />
  767. <property name="package.dest.filename.tar" value="${package.dest.dir}/${release.fullname.src}.tar" />
  768. <property name="package.dest.filename.tar.gz" value="${package.dest.filename.tar}.gz" />
  769. <property name="release.src.out.dir" value="${release.dest.dir}/${release.name.src}"/>
  770.  
  771. <!-- ie: openfire -->
  772. <property name="release.name" value="${dist.prefix}"/>
  773. <!-- ie: openfire_2_1_2 -->
  774. <property name="release.fullname" value="${dist.prefix}_${version.filename}"/>
  775. <property name="release.out.dir" value="${release.dest.dir}/${release.name}"/>
  776. </target>
  777.  
  778. <target name="clean.dist.folders" depends="init, dist.init">
  779. <!-- Removes the expanded release folders, makes for easier automation of builds -->
  780. <delete dir="${release.src.out.dir}"/>
  781. <delete dir="${release.out.dir}"/>
  782. </target>
  783.  
  784. <!-- dist.src =============================================================================== -->
  785. <target name="dist.src" depends="init, dist.init, javadoc, -i18n"
  786. description="Creates a source distribution package">
  787.  
  788. <mkdir dir="${release.dest.dir}"/>
  789.  
  790. <!-- Create a new prop for the final release dirs then create the dirs -->
  791. <mkdir dir="${release.src.out.dir}"/>
  792. <!-- Copy dist docs, use filtering -->
  793. <copy todir="${release.src.out.dir}">
  794. <fileset dir="${docs.dir}/dist" includes="*.*" excludes="LICENSE.html"/>
  795. <filterset>
  796. <filter token="builddate" value="${builddate}"/>
  797. <filter token="version" value="${version}"/>
  798. </filterset>
  799. </copy>
  800. <!-- Copy the license -->
  801. <copy todir="${release.src.out.dir}" file="${license.file.path}/LICENSE.html"/>
  802. <!-- Copy text docs -->
  803. <copy todir="${release.src.out.dir}/documentation">
  804. <fileset dir="${docs.dir}" includes="**/*.html,**/*.txt"/>
  805. <filterset>
  806. <filter token="version" value="${version}"/>
  807. </filterset>
  808. </copy>
  809. <!-- Copy rest of docs -->
  810. <copy todir="${release.src.out.dir}/documentation">
  811. <fileset dir="${docs.dir}" excludes="**/*.html,**/*.txt"/>
  812. </copy>
  813. <!-- Copy Javadocs -->
  814. <copy todir="${release.src.out.dir}/documentation/docs/javadoc">
  815. <fileset dir="${javadoc.dest.dir}"/>
  816. </copy>
  817. <!-- Copy non-java source -->
  818. <copy todir="${release.src.out.dir}/src">
  819. <fileset dir="${src.dir}" excludes="**/*.java"/>
  820. </copy>
  821.  
  822. <!-- Copy java source, stripping non-distributable files and replacing DATE strings -->
  823. <copy todir="${release.src.out.dir}/src">
  824. <fileset dir="${src.dir}">
  825. <include name="**/*.java" />
  826. <srcinc />
  827. </fileset>
  828. <filterset>
  829. <filter token="DATE" value="${builddate}"/>
  830. </filterset>
  831. </copy>
  832.  
  833. <if>
  834. <available file="${work.dir}/plugins-dev/enterprise/target/lib" />
  835. <then>
  836. <copy todir="${release.src.out.dir}/src/plugins/enterprise/lib" failonerror="false">
  837. <fileset dir="${work.dir}/plugins-dev/enterprise/target/lib">
  838. <include name="*-lib.jar" />
  839. </fileset>
  840. </copy>
  841. </then>
  842. </if>
  843.  
  844. <!-- Copy the i18n files to the resources dir. This way they won't be in the jar only -->
  845. <copy todir="${release.src.out.dir}/resources/i18n">
  846. <fileset dir="${target.i18n.dir}" includes="*.properties"/>
  847. <fileset dir="${src.i18n.dir}" includes="*.properties"/>
  848. </copy>
  849. <!-- Copy build -->
  850. <copy todir="${release.src.out.dir}/build">
  851. <fileset dir="${basedir}/build"/>
  852. </copy>
  853.  
  854. <if>
  855. <not>
  856. <isset property="no.package"/>
  857. </not>
  858. <then>
  859. <parallel>
  860. <!-- Source Packages -->
  861. <zip zipfile="${package.dest.filename.zip}"
  862. basedir="${release.src.out.dir}/.."
  863. includes="${release.fullname.src}/**/*, ${release.name.src}/**/*"
  864. />
  865. <tar tarfile="${package.dest.filename.tar.gz}"
  866. basedir="${release.src.out.dir}/.."
  867. includes="${release.fullname.src}/**/*, ${release.name.src}/**/*"
  868. compression="gzip"
  869. longfile="gnu"
  870. />
  871. </parallel>
  872. </then>
  873. </if>
  874. </target>
  875.  
  876. <!-- dist.bin =============================================================================== -->
  877. <target name="dist.bin" depends="init, dist.init, plugins, javadoc, enterprise"
  878. description="Creates a binary distribution package">
  879.  
  880. <mkdir dir="${release.out.dir}"/>
  881.  
  882. <!-- Make & copy the search plugin. -->
  883. <copy todir="${release.out.dir}">
  884. <fileset dir="${work.dir}">
  885. <include name="plugins/search.jar"/>
  886. </fileset>
  887. </copy>
  888.  
  889. <!-- Copy all prepare dirs to the binary dist -->
  890. <antcall target="openfireHome">
  891. <param name="target.openfireHome" value="${release.out.dir}"/>
  892. <param name="openfireHome.no.plugins" value="true"/>
  893. </antcall>
  894.  
  895. <!-- Remove the development scripts -->
  896. <delete file="${release.out.dir}/bin/openfire-dev.bat"/>
  897. <delete file="${release.out.dir}/bin/openfire-dev.sh"/>
  898.  
  899. <!-- Pack200 processing on JAR files in lib dir -->
  900.  
  901. <for param="jar">
  902. <path>
  903. <fileset dir="${release.out.dir}/lib" includes="*.jar"
  904. excludes="startup.jar,jdic.jar,mail.jar,activation.jar,bouncycastle.jar"/>
  905. </path>
  906. <sequential>
  907. <delete file="@{jar}.pack"/>
  908. <pack200 src="@{jar}"
  909. destfile="@{jar}.pack"
  910. gzipoutput="false"
  911. />
  912. <delete file="@{jar}"/>
  913. </sequential>
  914. </for>
  915.  
  916. <!-- Pack200 processing on JAR files in admin plugin lib dir -->
  917.  
  918. <for param="jar">
  919. <path>
  920. <fileset dir="${release.out.dir}/plugins/admin/webapp/WEB-INF/lib" includes="*.jar"
  921. excludes="startup.jar,jdic.jar,mail.jar,activation.jar,bouncycastle.jar"/>
  922. </path>
  923. <sequential>
  924. <delete file="@{jar}.pack"/>
  925. <pack200 src="@{jar}"
  926. destfile="@{jar}.pack"
  927. gzipoutput="false"
  928. />
  929. <delete file="@{jar}"/>
  930. </sequential>
  931. </for>
  932.  
  933. <!-- Copy dist docs, use filtering -->
  934. <copy todir="${release.out.dir}">
  935. <fileset dir="${docs.dir}/dist" includes="*.*" excludes="LICENSE.html"/>
  936. <filterset>
  937. <filter token="builddate" value="${builddate}"/>
  938. <filter token="version" value="${version}"/>
  939. </filterset>
  940. </copy>
  941.  
  942. <!-- Copy the license -->
  943. <copy todir="${release.out.dir}" file="${license.file.path}/LICENSE.html"/>
  944. <mkdir dir="${release.out.dir}/logs"/>
  945. <touch file="${release.out.dir}/logs/stderr.out"/>
  946.  
  947. <!-- Copy docs -->
  948. <copy todir="${release.out.dir}/documentation">
  949. <fileset dir="${docs.dir}/docs"/>
  950. <filterset>
  951. <filter token="version" value="${version}"/>
  952. </filterset>
  953. </copy>
  954. <copy todir="${release.out.dir}/documentation/images" filtering="false" overwrite="true">
  955. <fileset dir="${docs.dir}/docs/images"/>
  956. </copy>
  957.  
  958. <!-- Copy Javadocs -->
  959. <copy todir="${release.out.dir}/documentation/javadoc">
  960. <fileset dir="${javadoc.dest.dir}"/>
  961. </copy>
  962.  
  963.  
  964. <!-- Copy the i18n files to the resources dir. This way they won't be in the jar only -->
  965. <copy todir="${release.out.dir}/resources/i18n">
  966. <fileset dir="${target.i18n.dir}" includes="*.properties"/>
  967. <fileset dir="${src.i18n.dir}" includes="*.properties"/>
  968. </copy>
  969.  
  970. <!-- Package the release -->
  971. <property name="package.dest.dir" value="${release.dest.dir}"/>
  972.  
  973. <if>
  974. <not>
  975. <isset property="no.package"/>
  976. </not>
  977. <then>
  978. <parallel>
  979. <!-- Binary packages -->
  980. <zip zipfile="${package.dest.dir}/${release.fullname}.zip"
  981. basedir="${release.out.dir}/.."
  982. includes="${release.fullname}/**/*, ${release.name}/**/*"/>
  983. <tar tarfile="${package.dest.dir}/${release.fullname}.tar.gz"
  984. basedir="${release.out.dir}/.."
  985. includes="${release.fullname}/**/*, ${release.name}/**/*"
  986. compression="gzip"
  987. longfile="gnu"/>
  988. </parallel>
  989. </then>
  990. </if>
  991. </target>
  992.  
  993. <target name="enterprise" if="do.enterprise">
  994. <!-- Copy enterprise plugins. -->
  995. <copy todir="${release.out.dir}">
  996. <fileset dir="${work.dir}">
  997. <include name="plugins/enterprise.jar"/>
  998. <include name="plugins/fastpath.jar"/>
  999. <include name="plugins/webchat.war"/>
  1000. </fileset>
  1001. </copy>
  1002. <!-- Remove GPL libs from distribution -->
  1003. <delete file="${release.out.dir}/lib/mysql.jar.pack"/>
  1004. </target>
  1005.  
  1006. <!-- dailybuild ============================================================================ -->
  1007. <target name="dailybuild" depends="init" description="Creates a daily build release">
  1008. <property name="release.out.name" value="${dist.prefix}_${dailybuild.tstamp}"/>
  1009. <property name="release.fullname" value="${release.out.name}"/>
  1010. <property name="release.src.out.name" value="${dist.prefix}_src_${dailybuild.tstamp}"/>
  1011. <property name="release.fullname.src" value="${release.src.out.name}"/>
  1012. <property name="release.out.dir"
  1013. value="${release.dest.dir}/dailybuild/${release.out.name}"/>
  1014. <property name="release.src.out.dir"
  1015. value="${release.dest.dir}/dailybuild/${release.src.out.name}"/>
  1016. <antcall target="dist.src">
  1017. <param name="release.src.out.name" value="${release.src.out.name}"/>
  1018. <param name="release.src.out.dir" value="${release.src.out.dir}"/>
  1019. <param name="package.dest.dir" value="${release.dest.dir}/dailybuild"/>
  1020. </antcall>
  1021. <antcall target="dist.bin">
  1022. <param name="release.out.name" value="${release.out.name}"/>
  1023. <param name="release.out.dir" value="${release.out.dir}"/>
  1024. <param name="package.dest.dir" value="${release.dest.dir}/dailybuild"/>
  1025. <!-- dist.src above does this already, so don't need to do it twice -->
  1026. <param name="no.javadoc" value="true"/>
  1027. </antcall>
  1028. </target>
  1029.  
  1030. <!-- installer ============================================================================= -->
  1031. <target name="installer" description="Creates Openfire installers">
  1032. <condition property="install4j.not.ok" value="true">
  1033. <not>
  1034. <available file="${installer.install4j.home}/bin/install4j.jar"/>
  1035. </not>
  1036. </condition>
  1037. <fail if="install4j.not.ok"
  1038. message="Path to Install4j not set, see build.properties.template file."/>
  1039.  
  1040. <antcall target="dist.bin">
  1041. <!-- Don't need package for installer build -->
  1042. <param name="no.package" value="true"/>
  1043. </antcall>
  1044.  
  1045. <antcall target="dist.src">
  1046. <!-- Already built javadoc with dist.bin above -->
  1047. <param name="no.javadoc" value="true"/>
  1048. </antcall>
  1049.  
  1050. <taskdef name="install4j"
  1051. classname="com.install4j.Install4JTask"
  1052. classpath="${installer.install4j.home}/bin/ant.jar"/>
  1053.  
  1054. <mkdir dir="${installer.dest.dir}"/>
  1055.  
  1056. <!-- Install4j doesn't support extra version info (like beta) correctly, so
  1057. define a special revision number. -->
  1058. <if>
  1059. <equals arg1="${version.extra}" arg2=""/>
  1060. <then>
  1061. <property name="install4j.revision" value="${version.revision}"/>
  1062. </then>
  1063. <else>
  1064. <property name="install4j.revision" value="${version.revision}.${version.extra}"/>
  1065. </else>
  1066. </if>
  1067.  
  1068. <install4j projectfile="${installer.install4j.srcfile}" destination="${installer.dest.dir}">
  1069. <variable name="RELEASE_DIR" value="${dist.prefix}"/>
  1070. <variable name="VERSION_MAJOR" value="${version.major}"/>
  1071. <variable name="VERSION_MINOR" value="${version.minor}"/>
  1072. <variable name="VERSION_REVISION" value="${install4j.revision}"/>
  1073. <variable name="APP_NAME" value="${installer.app_name}"/>
  1074. <variable name="APP_SHORT_NAME" value="${installer.app_short_name}"/>
  1075. <variable name="PRODUCT_NAME" value="${installer.product_name}"/>
  1076. <variable name="PUBLISHER" value="${installer.publisher}"/>
  1077. <variable name="PUBLISHER_URL" value="${installer.publisher_url}"/>
  1078. <variable name="FILE_PREFIX" value="${installer.app_short_name}"/>
  1079. <variable name="RELEASE_ROOT_PATH" value="${installer.release_root_path}"/>
  1080. <variable name="APPLICATION_ID" value="${installer.application_id}"/>
  1081. <variable name="UNIX_INSTALL_DIR" value="${installer.unix_install_dir}"/>
  1082. <variable name="WINDOWS_INSTALL_DIR" value="${installer.windows_install_dir}"/>
  1083. </install4j>
  1084.  
  1085. </target>
  1086.  
  1087. <!-- installer.rpm ========================================================================= -->
  1088. <property name="bundle.jre" value="true" />
  1089. <property name="target.work.subdir" value="rpm" />
  1090. <property name="target.rpm" value="${work.dir}/${target.work.subdir}" />
  1091. <property name="rpm.spec.file" value="${basedir}/build/rpm/openfire.spec"/>
  1092. <tstamp>
  1093. <format property="rpm.builddate" pattern="EEE MMM dd yyyy" locale="en"/>
  1094. </tstamp>
  1095. <target name="installer.rpm" depends="init, dist.init" description="Builds a rpm of openfire.">
  1096. <antcall target="dist.src"/>
  1097.  
  1098. <mkdir dir="${target.rpm}/SPECS" />
  1099. <mkdir dir="${target.rpm}/SOURCES" />
  1100. <mkdir dir="${target.rpm}/BUILD" />
  1101. <mkdir dir="${target.rpm}/SRPMS" />
  1102. <mkdir dir="${target.rpm}/RPMS" />
  1103.  
  1104. <copy tofile="${target.rpm}/SPECS/openfire.spec" file="${rpm.spec.file}" />
  1105. <if>
  1106. <equals arg1="${bundle.jre}" arg2="true"/>
  1107. <then>
  1108. <!-- Include bundled jre -->
  1109. <copy todir="${target.rpm}/SOURCES" file="${basedir}/build/rpm/jre-dist.tar.gz" />
  1110. </then>
  1111. </if>
  1112. <copy todir="${target.rpm}/SOURCES" file="${release.dest.dir}/${release.fullname.src}.tar.gz" />
  1113.  
  1114.  
  1115. <if>
  1116. <equals arg1="${bundle.jre}" arg2="true"/>
  1117. <then>
  1118. <rpm specFile="openfire.spec"
  1119. topDir="${target.rpm}"
  1120. command="-ba --target i386 --define 'OPENFIRE_VERSION ${version}' --define 'OPENFIRE_SOURCE ${release.fullname.src}.tar.gz' --define 'OPENFIRE_BUILDDATE ${rpm.builddate}'"
  1121. failOnError="true"
  1122. />
  1123.  
  1124. <copy todir="${release.dest.dir}" >
  1125. <fileset dir="${target.rpm}/SRPMS" />
  1126. <fileset dir="${target.rpm}/RPMS/i386" />
  1127. </copy>
  1128. </then>
  1129. <else>
  1130. <rpm specFile="openfire.spec"
  1131. topDir="${target.rpm}"
  1132. command="-ba --target noarch --define 'OPENFIRE_VERSION ${version}' --define 'OPENFIRE_SOURCE ${release.fullname.src}.tar.gz' --define 'OPENFIRE_BUILDDATE ${rpm.builddate}'"
  1133. failOnError="true"
  1134. />
  1135.  
  1136. <copy todir="${release.dest.dir}" >
  1137. <fileset dir="${target.rpm}/SRPMS" />
  1138. <fileset dir="${target.rpm}/RPMS/noarch" />
  1139. </copy>
  1140. </else>
  1141. </if>
  1142. </target>
  1143.  
  1144. <!-- installer.solaris ========================================================================= -->
  1145. <target name="installer.solaris" depends="init, dist.init, dist.bin" description="Builds a solaris pkg of openfire.">
  1146. <property name="target.solaris" value="${work.dir}/solaris" />
  1147. <property name="target.solaris.root" value="${target.solaris}/root" />
  1148. <!-- <property name="target.solaris.pkg" value="${target.solaris}/pkg" /> -->
  1149. <property name="target.solaris.pkg" value="/var/spool/pkg" />
  1150. <property name="solaris.pkg.name" value="JSopenfire"/>
  1151. <property name="solaris.pkg.filename" value="${solaris.pkg.name}-${version}-ALL.pkg"/>
  1152. <tstamp>
  1153. <format property="solaris.builddate" pattern="yyyymmdd" locale="en"/>
  1154. </tstamp>
  1155.  
  1156. <antcall target="dist.bin">
  1157. <!-- Don't need package for installer build -->
  1158. <param name="no.package" value="true"/>
  1159. </antcall>
  1160.  
  1161. <mkdir dir="${target.solaris.root}" />
  1162. <mkdir dir="${target.solaris.root}/opt" />
  1163. <!-- <mkdir dir="${target.solaris.pkg}" /> -->
  1164. <mkdir dir="${target.solaris.root}/opt/openfire/resources/solaris" />
  1165.  
  1166. <copy todir="${target.solaris.root}/opt/openfire">
  1167. <fileset dir="${release.out.dir}"/>
  1168. </copy>
  1169.  
  1170. <chmod perm="0755" file="${target.solaris.root}/opt/openfire/bin/openfirectl" />
  1171. <chmod perm="0755" file="${target.solaris.root}/opt/openfire/bin/openfire.sh" />
  1172. <chmod perm="0755" file="${target.solaris.root}/opt/openfire/bin/extra/embedded-db-viewer.sh" />
  1173.  
  1174. <delete file="${target.solaris.root}/opt/openfire/bin/openfire.bat" />
  1175. <delete file="${target.solaris.root}/opt/openfire/bin/openfire-dev.bat" />
  1176. <delete file="${target.solaris.root}/opt/openfire/bin/extra/openfire-launchd-wrapper.sh" />
  1177. <delete file="${target.solaris.root}/opt/openfire/bin/extra/openfired" />
  1178. <delete dir="${target.solaris.root}/opt/openfire/bin/extra/redhat" />
  1179. <delete file="${target.solaris.root}/opt/openfire/bin/extra/redhat-postinstall.sh" />
  1180. <delete file="${target.solaris.root}/opt/openfire/bin/extra/embedded-db-viewer.bat" />
  1181.  
  1182. <copy tofile="${target.solaris.root}/pkginfo" file="${basedir}/build/pkg/pkginfo" />
  1183. <copy tofile="${target.solaris.root}/opt/openfire/resources/solaris/openfire.xml" file="${basedir}/build/solaris/openfire.xml" />
  1184. <copy tofile="${target.solaris.root}/checkinstall" file="${basedir}/build/solaris/checkinstall" />
  1185. <copy tofile="${target.solaris.root}/postinstall" file="${basedir}/build/solaris/postinstall" />
  1186. <copy tofile="${target.solaris.root}/preremove" file="${basedir}/build/solaris/preremove" />
  1187.  
  1188. <copy tofile="${target.solaris.root}/Prototype" file="${basedir}/build/pkg/Prototype.template" overwrite="true"/>
  1189. <exec executable="/usr/bin/pkgproto" output="${target.solaris.root}/Prototype" append="true" failonerror="true">
  1190. <arg value="${target.solaris.root}/opt/openfire=/opt/openfire"/>
  1191. </exec>
  1192.  
  1193. <replaceregexp file="${target.solaris.root}/Prototype" match="(.* .* .* .*) .* .*" replace="\1 daemon daemon" byline="true"/>
  1194. <replaceregexp file="${target.solaris.root}/Prototype" match=".* (.* /opt/openfire/conf/openfire.xml=.* .* .* .*)" replace="e \1" byline="true"/>
  1195. <replaceregexp file="${target.solaris.root}/Prototype" match=".* (.* /opt/openfire/resources/security/keystore=.* .* .* .*)" replace="e \1" byline="true"/>
  1196. <replaceregexp file="${target.solaris.root}/Prototype" match=".* (.* /opt/openfire/resources/security/truststore=.* .* .* .*)" replace="e \1" byline="true"/>
  1197. <replaceregexp file="${target.solaris.root}/Prototype" match=".* (.* /opt/openfire/resources/security/client.truststore=.* .* .* .*)" replace="e \1" byline="true"/>
  1198. <replaceregexp file="${target.solaris.root}/Prototype" match=".* (.* /opt/openfire/bin/embedded-db.rc=.* .* .* .*)" replace="e \1" byline="true"/>
  1199.  
  1200. <exec executable="/usr/bin/pkgmk" dir="${target.solaris.root}" failonerror="true">
  1201. <arg value="-o"/>
  1202. <!-- <arg value="-d ${target.solaris.pkg}"/> this doesn't work as advertised -->
  1203. <arg value="-v ${version}"/>
  1204. <arg value="-p ${solaris.builddate}"/>
  1205. </exec>
  1206.  
  1207. <touch file="${release.dest.dir}/${solaris.pkg.filename}"/>
  1208.  
  1209. <exec executable="/usr/bin/pkgtrans" failonerror="true">
  1210. <arg value="-s"/>
  1211. <arg value="${target.solaris.pkg}"/>
  1212. <arg value="${release.dest.dir}/${solaris.pkg.filename}"/>
  1213. <arg value="${solaris.pkg.name}"/>
  1214. </exec>
  1215.  
  1216. <gzip src="${release.dest.dir}/${solaris.pkg.filename}" destfile="${release.dest.dir}/${solaris.pkg.filename}.gz"/>
  1217.  
  1218. <delete dir="${target.solaris.pkg}/${solaris.pkg.name}"/>
  1219. </target>
  1220.  
  1221. <!-- plugins =============================================================================== -->
  1222. <target name="plugins" description="Builds all plugins" depends="anttasks">
  1223. <tstamp>
  1224. <format property="buildJavaDate" pattern="MMM dd, yyyy"/>
  1225. </tstamp>
  1226. <!-- Call jar task, can't do this is as a 'depends' call of this target because
  1227. of the way class loading works for jspc calls.
  1228. -->
  1229. <antcall target="openfire">
  1230. <param name="openfireHome.no.update" value="true"/>
  1231. </antcall>
  1232.  
  1233. <mkdir dir="${plugin.dest.dir}"/>
  1234.  
  1235. <!-- Get a list of subdirs of the main plugins dir. This tells us which plugins to make. -->
  1236. <subdirinfo dir="${plugin.src.dir}" property="dirlist" ifexists="plugin.xml"
  1237. except="admin"/>
  1238.  
  1239. <antcall target="-plugins-impl-dev"/>
  1240. <antcall target="-plugins-impl"/>
  1241.  
  1242. <!-- Update/create target/openfire directory -->
  1243. <antcall target="openfireHome"/>
  1244.  
  1245. </target>
  1246. <target name="-plugins-impl" if="dirlist">
  1247.  
  1248. <!-- For each plugin in the main src dir, call the 'buildplugin' macro -->
  1249. <for list="${dirlist}" param="plugin" trim="true">
  1250. <sequential>
  1251. <if>
  1252. <equals arg1="@{plugin}" arg2="clustering"/>
  1253. <then>
  1254. <echo message="bypassing clustering plugin, build via single plugin target if needed"/>
  1255. </then>
  1256. <else>
  1257. <buildplugin plugin="@{plugin}" pluginsrc="${plugin.src.dir}"/>
  1258. </else>
  1259. </if>
  1260. </sequential>
  1261. </for>
  1262.  
  1263. </target>
  1264. <target name="-plugins-impl-dev" if="plugin.dev.dir" depends="anttasks">
  1265.  
  1266. <!-- Get a list of plugins in the optional dev dir -->
  1267. <subdirinfo dir="${plugin.dev.dir}" property="dirlist2" ifexists="plugin.xml"/>
  1268.  
  1269. <antcall target="-plugin-impl-dev-build"/>
  1270.  
  1271. </target>
  1272. <target name="-plugin-impl-dev-build" if="dirlist2">
  1273.  
  1274. <!-- For each list of plugins in the dev dir call the 'buildplugin' macro -->
  1275. <for list="${dirlist2}" param="plugin" trim="true">
  1276. <sequential>
  1277. <if>
  1278. <equals arg1="@{plugin}" arg2="clustering"/>
  1279. <then>
  1280. <echo message="bypassing clustering plugin, build via single plugin target if needed"/>
  1281. </then>
  1282. <else>
  1283. <buildplugin plugin="@{plugin}" pluginsrc="${plugin.dev.dir}"/>
  1284. </else>
  1285. </if>
  1286. </sequential>
  1287. </for>
  1288.  
  1289. </target>
  1290. <target name="plugin" description="build one plugin">
  1291. <mkdir dir="${plugin.dest.dir}"/>
  1292.  
  1293. <delete dir="${plugin.dev.dest.dir}/${plugin}"/>
  1294. <delete file="${plugin.dev.dest.dir}/${plugin}.jar"/>
  1295. <delete file="${plugin.dest.dir}/${plugin}.jar"/>
  1296. <buildplugin plugin="${plugin}" pluginsrc="${plugin.src.dir}"/>
  1297.  
  1298. <!-- Update/create target/openfire directory -->
  1299. <antcall target="openfireHome"/>
  1300. </target>
  1301.  
  1302. <!-- buildplugin (MACRO) =================================================================== -->
  1303. <macrodef name="buildplugin">
  1304. <attribute name="plugin"/>
  1305. <attribute name="pluginsrc"/>
  1306. <attribute name="pluginlib" default="${plugin.dev.dest.dir}/@{plugin}/work/lib" />
  1307. <sequential>
  1308. <trycatch property="message_ref" reference="exception_ref" >
  1309. <try>
  1310.  
  1311. <!-- For each plugin, copile code, make a jar and copy resources. -->
  1312. <mkdir dir="${plugin.dev.dest.dir}"/>
  1313. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}"/>
  1314. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target"/>
  1315.  
  1316. <!-- Compile plugin source code -->
  1317. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
  1318. <javac
  1319. destdir="${plugin.dev.dest.dir}/@{plugin}/target/classes"
  1320. includeAntRuntime="no"
  1321. debug="on"
  1322. source="1.5"
  1323. target="1.5"
  1324. >
  1325. <src path="@{pluginsrc}/@{plugin}/src/java"/>
  1326. <classpath>
  1327. <path refid="plugin.dependencies"/>
  1328. <!-- Jars used by the plugin to compile with -->
  1329. <fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
  1330. </classpath>
  1331. </javac>
  1332.  
  1333. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/lib" />
  1334.  
  1335. <!-- Searchs source of a plugin and makes a <plugin>-lib.jar that contains compiled versions of all
  1336. non-distributable source -->
  1337. <mkdir dir="@{pluginlib}/source" />
  1338. <mkdir dir="@{pluginlib}/classes" />
  1339.  
  1340. <!-- copy the source we want to compile -->
  1341. <copy todir="@{pluginlib}/source">
  1342. <fileset dir="@{pluginsrc}/@{plugin}/src/java" includes="**/*.java" >
  1343. <not>
  1344. <srcinc />
  1345. </not>
  1346. </fileset>
  1347. <filterset>
  1348. <filter token="DATE" value="${buildJavaDate}"/>
  1349. </filterset>
  1350. </copy>
  1351.  
  1352. <if>
  1353. <not><uptodate>
  1354. <srcfiles dir="@{pluginlib}/source" includes="**/*.java"/>
  1355. <mapper type="merge" to="@{pluginlib}/@{plugin}-lib.jar"/>
  1356. </uptodate></not>
  1357. <then>
  1358. <javac
  1359. destdir="@{pluginlib}/classes"
  1360. includeAntRuntime="no"
  1361. debug="on"
  1362. source="1.5"
  1363. includes="**/*.java"
  1364. >
  1365. <src path="@{pluginlib}/source"/>
  1366. <classpath>
  1367. <pathelement location="${plugin.dev.dest.dir}/@{plugin}/target/classes"/>
  1368. <path>
  1369. <path refid="plugin.dependencies"/>
  1370. <!-- Jars used by the plugin to compile with -->
  1371. <fileset dir="@{pluginsrc}/@{plugin}" includes="lib/*.jar"/>
  1372. </path>
  1373. </classpath>
  1374. </javac>
  1375.  
  1376.  
  1377. <jar jarfile="${plugin.dev.dest.dir}/@{plugin}/target/lib/@{plugin}-lib.jar">
  1378. <fileset dir="@{pluginlib}/classes" />
  1379. </jar>
  1380. </then>
  1381. </if>
  1382.  
  1383. <!-- Make the jar -->
  1384. <jar jarfile="${plugin.dev.dest.dir}/@{plugin}/target/lib/plugin-@{plugin}.jar">
  1385. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target/classes" >
  1386. <present present="srconly" targetdir="@{pluginlib}/classes"/>
  1387. </fileset>
  1388. </jar>
  1389.  
  1390. <!-- Clean-up our source files for the "srcinc" files -->
  1391. <delete dir="@{pluginlib}/classes" />
  1392. <delete dir="@{pluginlib}/source" />
  1393.  
  1394. <available file="@{pluginsrc}/@{plugin}/src/include" type="dir"
  1395. property="@{plugin}.include.exists"/>
  1396. <if>
  1397. <equals arg1="${@{plugin}.include.exists}" arg2="true"/>
  1398. <then>
  1399. <jar jarfile="${plugin.dev.dest.dir}/@{plugin}/target/lib/plugin-@{plugin}.jar"
  1400. update="true">
  1401. <fileset dir="@{pluginsrc}/@{plugin}/src/include" includes="**/*.*"/>
  1402. </jar>
  1403. </then>
  1404. </if>
  1405.  
  1406. <!-- Copy anything in the plugin's lib dir to the target lib dir -->
  1407. <if>
  1408. <available file="@{pluginsrc}/@{plugin}/lib" />
  1409. <then>
  1410. <copy todir="${plugin.dev.dest.dir}/@{plugin}/target/lib" failonerror="false"
  1411. overwrite="${overwrite}">
  1412. <fileset dir="@{pluginsrc}/@{plugin}/lib" includes="**/*.*"/>
  1413. </copy>
  1414. </then>
  1415. </if>
  1416.  
  1417. <!-- Copy web.xml to web-custom.xml -->
  1418. <if>
  1419. <available file="@{pluginsrc}/@{plugin}/src/web/WEB-INF" />
  1420. <then>
  1421. <copy todir="${plugin.dev.dest.dir}/@{plugin}/target/web/WEB-INF" failonerror="false"
  1422. overwrite="${overwrite}">
  1423. <fileset dir="@{pluginsrc}/@{plugin}/src/web/WEB-INF" includes="web.xml"/>
  1424. <mapper type="glob" from="web.xml" to="web-custom.xml"/>
  1425. </copy>
  1426. </then>
  1427. </if>
  1428.  
  1429. <!-- Copy the plugin.xml and documentation to the target dir, code below assumes it's there -->
  1430. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/jar"/>
  1431. <copy todir="${plugin.dev.dest.dir}/@{plugin}/jar" failonerror="false"
  1432. overwrite="${overwrite}">
  1433. <fileset dir="@{pluginsrc}/@{plugin}" includes="*.xml, *.html, *.gif, *.png, *.ico"/>
  1434. </copy>
  1435.  
  1436. <!-- Copy the database and i18n file to the target dir, if they exist. -->
  1437. <!--<copy todir="${plugin.dev.dest.dir}/@{plugin}/target/database" failonerror="false">-->
  1438. <!--<fileset dir="@{pluginsrc}/@{plugin}/src/database"/>-->
  1439. <!--</copy>-->
  1440.  
  1441. <!-- JSPC any JSP pages. Do this conditionally as there might not be a web dir. -->
  1442. <available property="plugin.@{plugin}.webdocs.available"
  1443. type="dir" file="@{pluginsrc}/@{plugin}/src/web"/>
  1444. <if>
  1445. <equals arg1="${plugin.@{plugin}.webdocs.available}" arg2="true"/>
  1446. <then>
  1447.  
  1448. <!-- Continue with JSPC tasks... -->
  1449.  
  1450. <!-- Create output dir -->
  1451. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/jspc/java"/>
  1452. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/jspc/classes"/>
  1453.  
  1454. <!-- Copy jsp's from plugin and web.xml from openfire to a temp dir. We'll
  1455. not fail on an error since the web dir might not exist.
  1456. -->
  1457. <copy todir="${plugin.dev.dest.dir}/@{plugin}/target/web"
  1458. overwrite="${overwrite}">
  1459. <fileset dir="@{pluginsrc}/@{plugin}/src/web">
  1460. <exclude name="WEB-INF/web.xml"/>
  1461. </fileset>
  1462. <fileset dir="${web.dir}">
  1463. <include name="WEB-INF/**/*.*"/>
  1464. <exclude name="WEB-INF/web.xml"/>
  1465. <exclude name="WEB-INF/classes/openfire_init.xml"/>
  1466. <exclude name="WEB-INF/tmp/**/*.*"/>
  1467. <exclude name="WEB-INF/work/**/*.*"/>
  1468. </fileset>
  1469. </copy>
  1470.  
  1471. <!-- Declare the jspc task with our plugin's classpath -->
  1472. <taskdef classname="org.apache.jasper.JspC" name="jasper2" loaderref="jasperB">
  1473. <classpath>
  1474. <pathelement location="${java.home}/../lib/tools.jar"/>
  1475. <pathelement
  1476. location="${plugin.dev.dest.dir}/@{plugin}/target/lib/plugin-@{plugin}.jar"/>
  1477. <path refid="jspc.dependencies"/>
  1478. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target" includes="lib/*.jar"/>
  1479. <pathelement path="${compile.dir}"/>
  1480. </classpath>
  1481. </taskdef>
  1482.  
  1483. <!-- JSP to Java -->
  1484. <jasper2
  1485. validateXml="false"
  1486. uriroot="${plugin.dev.dest.dir}/@{plugin}/target/web"
  1487. outputDir="${plugin.dev.dest.dir}/@{plugin}/target/jspc/java"
  1488. package="org.jivesoftware.openfire.plugin.@{plugin}"
  1489. webXml="${plugin.dev.dest.dir}/@{plugin}/target/jspc/web.xml"
  1490. />
  1491.  
  1492. <!-- Use xmltask to merge the generated web.xml file and a developer one (if any) -->
  1493. <available property="plugin.@{plugin}.webxml.available"
  1494. type="file" file="@{pluginsrc}/@{plugin}/src/web/WEB-INF/web.xml"/>
  1495.  
  1496. <mkdir dir="${plugin.dev.dest.dir}/@{plugin}/target/web/WEB-INF"/>
  1497.  
  1498. <if>
  1499. <equals arg1="${plugin.@{plugin}.webxml.available}" arg2="true"/>
  1500. <then>
  1501.  
  1502. <!-- Copy the servlet and servlet-mapping elements from the original web.xml to a temp buffer.
  1503. Note: The original web.xml can only contain one servlet and servlet-mapping -->
  1504. <xmltask source="@{pluginsrc}/@{plugin}/src/web/WEB-INF/web.xml">
  1505. <copy path="//web-app/servlet[last()]" buffer="foobar"/>
  1506. <copy path="//web-app/servlet-mapping[last()]" buffer="foobar2"/>
  1507. </xmltask>
  1508. <!-- Add the copied servlet and servlet-mapping elements to the generated web.xml -->
  1509. <xmltask source="${plugin.dev.dest.dir}/@{plugin}/target/jspc/web.xml"
  1510. dest="${plugin.dev.dest.dir}/@{plugin}/target/web/WEB-INF/web.xml">
  1511. <insert path="/web-app/servlet[last()]" buffer="foobar"
  1512. position="after"/>
  1513. <insert path="/web-app/servlet-mapping[last()]" buffer="foobar2"
  1514. position="after"/>
  1515. </xmltask>
  1516.  
  1517. </then>
  1518. <else>
  1519. <copy todir="${plugin.dev.dest.dir}/@{plugin}/target/web/WEB-INF"
  1520. file="${plugin.dev.dest.dir}/@{plugin}/target/jspc/web.xml"
  1521. overwrite="${overwrite}"/>
  1522. </else>
  1523. </if>
  1524.  
  1525. <!-- Compile java classes -->
  1526. <javac
  1527. destdir="${plugin.dev.dest.dir}/@{plugin}/target/jspc/classes"
  1528. includeAntRuntime="no"
  1529. debug="on"
  1530. source="1.5"
  1531. target="1.5"
  1532. >
  1533. <src path="${plugin.dev.dest.dir}/@{plugin}/target/jspc/java"/>
  1534. <classpath>
  1535. <path refid="jspc.dependencies"/>
  1536. <pathelement path="${compile.dir}"/>
  1537. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target" includes="lib/*.jar"/>
  1538. </classpath>
  1539. </javac>
  1540.  
  1541. <!-- Make a jar of compiled jsp classes -->
  1542. <jar jarfile="${plugin.dev.dest.dir}/@{plugin}/target/lib/plugin-@{plugin}-jspc.jar">
  1543. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target/jspc/classes"
  1544. includes="**/*.class"/>
  1545. </jar>
  1546.  
  1547. </then>
  1548. </if>
  1549.  
  1550. <!-- Some JAR files don't work well through Pack200. When that's the case, they should
  1551. be manually added to this list.
  1552. -->
  1553. <property name="pack200.excludes"
  1554. value="gnujaxp.jar,mail.jar,activation.jar,bouncycastle.jar,tangosol.jar"/>
  1555.  
  1556. <if>
  1557. <equals arg1="${pack200.enabled}" arg2="true" />
  1558. <then>
  1559. <for param="jar">
  1560. <path>
  1561. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target/lib" includes="*.jar"
  1562. excludes="${pack200.excludes}"/>
  1563. </path>
  1564. <sequential>
  1565. <delete file="@{jar}.pack"/>
  1566. <pack200 src="@{jar}"
  1567. destfile="@{jar}.pack"
  1568. gzipoutput="false"
  1569. />
  1570. </sequential>
  1571. </for>
  1572.  
  1573. <copy todir="${plugin.dev.dest.dir}/@{plugin}/jar" overwrite="true">
  1574. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target">
  1575. <include name="lib/*.pack"/>
  1576. <include name="web/WEB-INF/web.xml"/>
  1577. <include name="web/WEB-INF/web-custom.xml"/>
  1578. </fileset>
  1579. </copy>
  1580.  
  1581. <!-- Excluded pack files need to be copied over as well -->
  1582. <copy todir="${plugin.dev.dest.dir}/@{plugin}/jar/lib" overwrite="true">
  1583. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target/lib"
  1584. includes="${pack200.excludes}"/>
  1585. </copy>
  1586. </then>
  1587. <else>
  1588. <copy todir="${plugin.dev.dest.dir}/@{plugin}/jar" overwrite="true">
  1589. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/target">
  1590. <include name="lib/*.jar"/>
  1591. <include name="web/WEB-INF/web.xml"/>
  1592. <include name="web/WEB-INF/web-custom.xml"/>
  1593. </fileset>
  1594. </copy>
  1595. </else>
  1596. </if>
  1597.  
  1598. <!-- Copy everything else to Openfire's plugin dir -->
  1599. <copy todir="${plugin.dev.dest.dir}/@{plugin}/jar" overwrite="true">
  1600. <fileset dir="@{pluginsrc}/@{plugin}">
  1601. <include name="classes/**/*.*"/>
  1602. </fileset>
  1603. <fileset dir="@{pluginsrc}/@{plugin}/src">
  1604. <include name="database/**/*.sql"/>
  1605. <include name="i18n/*.properties"/>
  1606. <include name="web/**/*.*"/>
  1607. <exclude name="web/WEB-INF/web.xml"/>
  1608. <exclude name="web/**/*.jsp"/>
  1609. <exclude name="web/**/*.jspf"/>
  1610. <exclude name="java/**/*.java"/>
  1611. </fileset>
  1612. </copy>
  1613.  
  1614. <!-- Jar the plugin -->
  1615. <jar jarfile="${plugin.dest.dir}/@{plugin}.jar">
  1616. <fileset dir="${plugin.dev.dest.dir}/@{plugin}/jar"/>
  1617. </jar>
  1618.  
  1619. <!-- Delete the exploded plugin -->
  1620. <delete dir="${plugin.dev.dest.dir}/@{plugin}/jar"/>
  1621. </try>
  1622. <catch>
  1623. <property name="exception" refid="exception_ref" />
  1624. <property name="message" value="Error building plugin: @{plugin}. Exception:${line.separator}${exception}" />
  1625. <echo message="${message}" />
  1626. <fail if="halt.on.plugin.error" message="${message}" />
  1627. </catch>
  1628. </trycatch>
  1629. </sequential>
  1630.  
  1631. </macrodef>
  1632.  
  1633. <!-- anttasks ============================================================================== -->
  1634. <target name="anttasks" depends="init">
  1635.  
  1636. <mkdir dir="${anttools.target.dir}"/>
  1637. <mkdir dir="${anttools.target.dir}/classes"/>
  1638.  
  1639. <javac
  1640. destdir="${anttools.target.dir}/classes"
  1641. includeAntRuntime="no"
  1642. debug="on"
  1643. source="1.4"
  1644. >
  1645. <src path="${anttools.src.dir}"/>
  1646. <patternset refid="compile.sources"/>
  1647. <classpath>
  1648. <path refid="compile.dependencies"/>
  1649. </classpath>
  1650. </javac>
  1651.  
  1652. <jar jarfile="${anttools.target.dir}/ant-subdirtask.jar">
  1653. <fileset dir="${anttools.target.dir}/classes" includes="**/*.class"/>
  1654. </jar>
  1655.  
  1656. <taskdef name="subdirinfo" classname="org.jivesoftware.ant.SubDirInfoTask">
  1657. <classpath>
  1658. <pathelement location="${basedir}/build/lib/ant-subdirtask.jar"/>
  1659. </classpath>
  1660. </taskdef>
  1661. </target>
  1662.  
  1663. <!-- clean ================================================================================= -->
  1664. <target name="clean" description="Cleans up all build-generated output">
  1665. <delete dir="${work.dir}"/>
  1666. <delete dir="${target.dir}"/>
  1667.  
  1668. <!-- Delete the Enterprise plugin in the openfire plugin directory, if this isn't an enterprise build -->
  1669. <if>
  1670. <not><equals arg1="${do.enterprise}" arg2="true"/></not>
  1671. <then>
  1672. <!-- Copy pre-configured openfireHome dir -->
  1673. <delete dir="${basedir}/src/plugins/enterprise" />
  1674. </then>
  1675. </if>
  1676. </target>
  1677.  
  1678. <!-- clean-jspc ============================================================================ -->
  1679. <!-- Cleans all JSPC output -->
  1680. <target name="clean-jspc">
  1681. <delete dir="${jspc.dest.dir}"/>
  1682. </target>
  1683.  
  1684. <!-- clean-test ============================================================================ -->
  1685. <!-- Cleans all compiled test classes -->
  1686. <target name="clean-test">
  1687. <delete dir="${test.classes.dest.dir}"/>
  1688. </target>
  1689.  
  1690. <!-- clean-plugins ========================================================================= -->
  1691. <!-- Cleans all generated plugins -->
  1692. <target name="clean-plugins">
  1693. <delete includeemptydirs="true" failonerror="false">
  1694. <fileset dir="${plugin.dest.dir}" excludes="admin/**/*.*"/>
  1695. </delete>
  1696. <!--<delete dir="${plugin.dest.dir}"/> -->
  1697. <delete dir="${plugin.dev.dest.dir}"/>
  1698. </target>
  1699.  
  1700. <!-- Mac installer ========================================================================= -->
  1701. <property name="target.osx" value="${work.dir}/osx" />
  1702. <property name="mac.pkg.dir" value="${target.osx}/macpkg"/>
  1703. <property name="mac.dmg.dir" value="${target.osx}/Openfire"/>
  1704. <property name="mac.dmg.file" value="${release.dest.dir}/openfire.dmg"/>
  1705. <property name="mac.template" value="${target.osx}/template"/>
  1706. <property name="mac.prefpane.build" value="${target.osx}/prefPane"/>
  1707.  
  1708. <target name="mac.delete">
  1709. <delete dir="${mac.pkg.dir}" failonerror="false"/>
  1710. <delete dir="${mac.dmg.dir}" failonerror="false"/>
  1711. <delete file="${mac.dmg.file}" failonerror="false"/>
  1712. <delete dir="${mac.template}" failonerror="false"/>
  1713. <delete dir="${mac.prefpane.build}" failonerror="false"/>
  1714. </target>
  1715.  
  1716. <target name="mac.prefpane">
  1717. <!-- install will put it in macpkg/Library/PreferencePanes/ as specified in the target settings -->
  1718. <copy todir="${mac.prefpane.build}" >
  1719. <fileset dir="${basedir}/build/osx/openfirePrefPane" />
  1720. </copy>
  1721. <exec executable="/usr/bin/xcodebuild" dir="${mac.prefpane.build}" failonerror="true">
  1722. <arg value="-configuration"/>
  1723. <arg value="Deployment"/>
  1724. <arg value="-target"/>
  1725. <arg value="Openfire"/>
  1726. <arg value="clean"/>
  1727. <arg value="install"/>
  1728. </exec>
  1729. </target>
  1730.  
  1731. <target name="mac.prepare" depends="mac.delete,openfire, mac.prefpane">
  1732. <copy todir="${mac.pkg.dir}/usr/local/openfire">
  1733. <fileset dir="${target.dir}/openfire">
  1734. <exclude name="**/openfired"/>
  1735. <exclude name="**/openfirectl"/>
  1736. <exclude name="**/redhat"/>
  1737. <exclude name="**/embedded-db*"/>
  1738. <exclude name="**/redhat-postinstall.sh"/>
  1739. </fileset>
  1740. </copy>
  1741. <mkdir dir="${mac.pkg.dir}/Library/LaunchDaemons"/>
  1742. <copy file="${basedir}/build/osx/org.jivesoftware.openfire.plist"
  1743. todir="${mac.pkg.dir}/Library/LaunchDaemons"/>
  1744. <mkdir dir="${mac.dmg.dir}"/>
  1745. <mkdir dir="${mac.pkg.dir}/Library/PreferencePanes"/>
  1746. <copy todir="${mac.pkg.dir}/Library/PreferencePanes">
  1747. <fileset dir="${mac.prefpane.build}/build/UninstalledProducts/"/>
  1748. </copy>
  1749. <chmod perm="o+x">
  1750. <fileset dir="${mac.pkg.dir}/Library/PreferencePanes/Openfire.prefPane/Contents/MacOS/">
  1751. <include name="HelperTool"/>
  1752. </fileset>
  1753. </chmod>
  1754. <chmod perm="ug+x">
  1755. <fileset dir="${mac.pkg.dir}/usr/local/openfire/bin">
  1756. <include name="extra/openfire-launchd-wrapper.sh"/>
  1757. </fileset>
  1758. <fileset dir="${basedir}/build/osx/resources"/>
  1759. </chmod>
  1760. <mkdir dir="${mac.template}/.background"/>
  1761. <copy todir="${mac.template}/.background">
  1762. <fileset file="${basedir}/build/osx/dmgBackground.png"/>
  1763. </copy>
  1764. </target>
  1765.  
  1766. <!-- Create a Mac OS X installer -->
  1767. <target name="mac.pkg" depends="mac.prepare">
  1768. <tstamp>
  1769. <format property="copyrightyear" pattern="yyyy"/>
  1770. </tstamp>
  1771. <copy todir="${target.osx}" file="${basedir}/build/osx/Info.plist"/>
  1772. <replace file="${target.osx}/Info.plist">
  1773. <replacefilter token="%VERSION%" value="${version}"/>
  1774. <replacefilter token="%VERSIONMAJOR%" value="${version.major}"/>
  1775. <replacefilter token="%VERSIONMINOR%" value="${version.minor}"/>
  1776. <replacefilter token="%COPYRIGHT%" value="${copyrightyear}"/>
  1777. </replace>
  1778. <copy todir="${target.osx}" file="${basedir}/build/osx/Description.plist"/>
  1779. <exec executable="/Developer/usr/bin/packagemaker">
  1780. <arg value="-build"/>
  1781. <arg value="-f"/>
  1782. <arg value="${mac.pkg.dir}"/>
  1783. <arg value="-i"/>
  1784. <arg value="${target.osx}/Info.plist"/>
  1785. <arg value="-d"/>
  1786. <arg value="${target.osx}/Description.plist"/>
  1787. <arg value="-r"/>
  1788. <arg value="${basedir}/build/osx/resources"/>
  1789. <!--<arg value="-proj"/>
  1790. <arg value="${basedir}/build/osx/openfire.pmproj"/> -->
  1791. <arg value="-p"/>
  1792. <arg value="${mac.template}/Openfire.pkg"/>
  1793. <arg value="-ds"/>
  1794. <arg value="-v"/>
  1795. </exec>
  1796. </target>
  1797.  
  1798. <target name="installer.mac" depends="mac.pkg" description="Creates a Mac OS X package">
  1799. <mkdir dir="${release.dest.dir}"/>
  1800. <exec executable="hdiutil" failonerror="true">
  1801. <arg line="create -srcfolder '${mac.template}' -volname 'Openfire' -fs HFS+ -fsargs '-c c=64,a=16,e=16' -format UDRW '${target.osx}/tmp.dmg'"/>
  1802. </exec>
  1803. <exec executable="hdiutil" failonerror="true">
  1804. <arg line="attach '${target.osx}/tmp.dmg' -readwrite -noverify -noautoopen -noidme -mountpoint '${mac.dmg.dir}'"/>
  1805. </exec>
  1806. <!-- OF-386 - commented out since it wasn't working with our Bamboo remote agent // TODO: fix it
  1807. <exec executable="osascript" dir="${basedir}/build/osx/" failonerror="true">
  1808. <arg value="dmg_openfire.scpt"/>
  1809. <arg value="Openfire"/>
  1810. <arg value="images"/>
  1811. <arg value="360"/>
  1812. <arg value="200"/>
  1813. <arg value="450"/>
  1814. <arg value="220"/>
  1815. <arg value="128"/>
  1816. </exec>
  1817. -->
  1818. <exec executable="hdiutil" failonerror="true">
  1819. <arg line="detach ${mac.dmg.dir} -quiet -force"/>
  1820. </exec>
  1821. <exec executable="hdiutil" failonerror="true">
  1822. <arg line="convert ${target.osx}/tmp.dmg -format UDZO -imagekey zlib-level=9 -o ${mac.dmg.file}"/>
  1823. </exec>
  1824. <delete file="${target.osx}/tmp.dmg"/>
  1825. </target>
  1826.  
  1827. <!-- Debian package ========================================================================= -->
  1828. <property name="debian.dir" value="${basedir}/build/debian"/>
  1829. <property name="debian.release.dir" value="${release.dest.dir}/debian"/>
  1830. <property name="debian.version" value="${version.major}.${version.minor}.${version.revision}"/>
  1831. <property name="debian.work.dir" value="${work.dir}/debian/${dist.prefix}-${debian.version}"/>
  1832. <tstamp>
  1833. <format property="debian.builddate" pattern="EEE, dd MMM yyyy HH:mm:ss Z" locale="en"/>
  1834. </tstamp>
  1835.  
  1836. <target name="installer.debian" depends="dist.src" description="Creates a Debian package">
  1837. <!-- Copy the sources to some place to work -->
  1838. <copy todir="${debian.work.dir}">
  1839. <fileset dir="${release.src.out.dir}">
  1840. <include name="**/*" />
  1841. </fileset>
  1842. </copy>
  1843.  
  1844. <!-- Copy build/debian into workdir -->
  1845. <copy todir="${debian.work.dir}/debian">
  1846. <fileset dir="${debian.dir}/" includes="**/*"/>
  1847. <filterset>
  1848. <filter token="builddate" value="${debian.builddate}"/>
  1849. <filter token="version" value="${debian.version}"/>
  1850. </filterset>
  1851. </copy>
  1852.  
  1853. <!-- Make the copied 'rules' executable -->
  1854. <chmod file="${debian.work.dir}/debian/rules" perm="755" />
  1855.  
  1856. <!-- Create the package -->
  1857. <exec executable="dpkg-buildpackage" dir="${debian.work.dir}" failonerror="true">
  1858. <!-- Allow building without root-privs -->
  1859. <arg line="-rfakeroot"/>
  1860. <!-- Don't sign source -->
  1861. <arg line="-us"/>
  1862. <!-- Don't sign changelog -->
  1863. <arg line="-uc"/>
  1864. </exec>
  1865.  
  1866. <!-- Copy the resulting files into target -->
  1867. <copy todir="${debian.release.dir}">
  1868. <fileset dir="${debian.work.dir}/.." followsymlinks="false">
  1869. <include name="**/*.deb" />
  1870. <include name="**/*.changes" />
  1871. <include name="**/*.dsc" />
  1872. <include name="**/*.gz" />
  1873. </fileset>
  1874. </copy>
  1875. </target>
  1876.  
  1877. </project>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement