Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

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