<commit_before><?xml version="1.0"?>
<!--
   Copyright 1999-2004 The Apache Software Foundation
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<project name="JMeter" default="all" basedir=".">
  <description>
    To build JMeter from source and install:
      ant [all]
    To rebuild and install:
      ant install

    To update documentation (requires Anakia to be present)
      ant docs-site
      ant docs-printable
    To build API documentation (Javadoc)
      ant docs-api
    To build all the docs
      ant docs-all

    To build all and package up the files for distribution
      ant distribution [ -Djmeter.version=vvvv ]

  	To create tar and tgz of the web-site documentation (docs and api)
      ant site [ -Djmeter.version=vvvv ]
      
      
    For more info:
      ant -projecthelp

    To diagnose usage of deprecated APIs:
      ant -Ddeprecation=on clean compile
  </description>
  
  <!--

  Note
  ====
  As with most other Jakarta projects, Gump (http://jakarta.apache.org/gump/) is used to
  perform automated builds and tests on JMeter.
  
  Gump uses its project/jakarta-jmeter.xml file to determine which target to use.
  The current setting is: <ant target="dist">
  
  Any changes to the dependency list for dist may affect Gump.
  
  Now the dist target depends on "assume-libs-present", so if additional libraries are added to that,
  the Gump project file for JMeter must also be updated.

  Jars that are not required by the dist target do not need to be added to the Gump project file.

  -->
  
  <!-- Are we running under Gump? -->
  <property name="gump.run" value="false"/>
  
  <!-- The version of this file -->
  <property name="version.build" value="$Revision$"/>
  
  <!-- Renamed targets -->
  <target name="all-docs">
    <echo message="Target has been renamed to docs-all"/>
    <antcall target="docs-all"/>
   </target>

  <target name="api-docs">
    <echo message="Target has been renamed to docs-api"/>
    <antcall target="docs-api"/>
   </target>
   
   <target name="printable-docs">
    <echo message="Target has been renamed to docs-printable"/>
    <antcall target="docs-printable"/>
   </target>
   
   <target name="docs">
    <echo message="Target has been renamed to docs-site"/>
    <antcall target="docs-site"/>
   </target>
   
   <target name="src-dist">
    <echo message="Target has been renamed to dist-src"/>
    <antcall target="dist-src"/>
   </target>
   
   <!-- Findbugs task and target -->
   <!--
   Findbugs is licensed under the Lesser GNU Public License
   HomePage: http://www.cs.umd.edu/~pugh/java/bugs/
   
   To use the findbugs target, download and install the findbugs binary distribution
   Set the value of findbugs.homedir according to where you installed findbugs, for example:
   ant findbugs -Dfindbugs.homedir=/etc/findbugs -Dfindbugs.level=medium
  [The defaults are /findbugs and medium]
   -->
   <property name="findbugs.homedir" value="/findbugs" />
   <property name="findbugs.level" value="medium" />
   <property name="findbugs.outName" value="reports/jmeter-fb" />
   <target name="findbugs" description="Run the stand-alone Findbugs detector">
    <echoproperties prefix="findbugs"/>
    <mkdir dir="reports"/>
    <taskdef name="findbugs" 
        classpath="${findbugs.homedir}/lib/findbugs-ant.jar" 
        classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
    <findbugs home="${findbugs.homedir}"
              output="xml"
              reportlevel="${findbugs.level}"
              excludeFilter="fb-excludes.xml"
              outputFile="${findbugs.outName}.xml" >
      <class location="${dest.jar}/*.jar" />
      <class location="${dest.jar.jmeter}/*.jar" />
      <sourcePath path="${src.core}" />
      <sourcePath path="${src.http}" />
      <sourcePath path="${src.ftp}" />
      <sourcePath path="${src.java}" />
      <sourcePath path="${src.jdbc}" />
      <sourcePath path="${src.ldap}" />
      <sourcePath path="${src.mail}" />
      <sourcePath path="${src.components}" />
      <sourcePath path="${src.functions}" />
      <class location="${lib.dir}/jorphan.jar" />
      <sourcePath path="${src.jorphan}" />
      <sourcePath path="${src.tcp}" />
      <sourcePath path="${src.jms}" />

	<!--
      Uncomment the following 2 lines to include htmlparser in the analysis
      <class location="${lib.dir}/htmlparser.jar" />
      <sourcePath path="${src.htmlparser}" />
      -->

      <auxClasspath>
       	<fileset dir="${lib.dir}">
       		<include name="*.jar"/>
       	</fileset>
      </auxClasspath>

      <auxClasspath>
       	<fileset dir="${lib.opt}">
       		<include name="*.jar"/>
       	</fileset>
      </auxClasspath>

    </findbugs>
    <antcall target="findbugs-style"/>
  </target>
  
  <!-- Convert findbugs XML output to CSV -->
   <target name="findbugs-style">
     <xslt style="fb-csv.xsl" 
       force="true"
       in="${findbugs.outName}.xml" 
       out="${findbugs.outName}.csv">
     </xslt>
   </target>

  <!-- Where the Sources live -->
  <property name="src.dir" value="src"/>
  <property name="src.core" value="src/core"/>
  <property name="src.http" value="src/protocol/http"/>
  <property name="src.ftp" value="src/protocol/ftp"/>
  <property name="src.test" value="test/src"/>
  <property name="src.jdbc" value="src/protocol/jdbc"/>
  <property name="src.java" value="src/protocol/java"/>
  <property name="src.components" value="src/components"/>
  <property name="src.functions" value="src/functions"/>
  <property name="src.jorphan" value="src/jorphan"/>
  <property name="src.ldap" value="src/protocol/ldap"/>
  <property name="src.htmlparser" value="src/htmlparser"/>
  <property name="src.tcp" value="src/protocol/tcp"/>
  <property name="src.examples" value="src/examples"/>
  <property name="src.mail" value="src/protocol/mail"/>
  <property name="src.monitor.components" value="src/monitor/components"/>
  <property name="src.monitor.model" value="src/monitor/model"/>
  <property name="src.jms" value="src/protocol/jms"/>

  <!-- Where the documentation sources live -->
  <property name="src.docs" value="xdocs"/>
  <property name="src.images" value="xdocs/images"/>
  <property name="src.demos" value="xdocs/demos"/>

  <!-- Javadoc sources -->
  <path id="srcpaths">
    <pathelement location="${src.core}"/>
    <pathelement location="${src.components}"/>
    <pathelement location="${src.functions}"/>
    <pathelement location="${src.http}"/>
    <pathelement location="${src.ftp}"/>
    <pathelement location="${src.jdbc}"/>
    <pathelement location="${src.java}"/>
    <pathelement location="${src.jorphan}"/>
    <pathelement location="${src.ldap}"/>
    <pathelement location="${src.htmlparser}"/>
    <pathelement location="${src.tcp}"/>
    <pathelement location="${src.examples}"/>
    <pathelement location="${src.mail}"/>
    <pathelement location="${src.monitor.components}"/>
    <pathelement location="${src.monitor.model}"/>
    <pathelement location="${src.jms}"/>
  </path>

  <!-- Temporary build directories: where the .class live -->
  <property name="build.dir" location="build"/>
  <property name="build.core" value="build/core"/>
  <property name="build.http" value="build/protocol/http"/>
  <property name="build.ftp" value="build/protocol/ftp"/>
  <property name="build.jdbc" value="build/protocol/jdbc"/>
  <property name="build.java" value="build/protocol/java"/>
  <property name="build.components" value="build/components"/>
  <property name="build.functions" value="build/functions"/>
  <property name="build.jorphan" value="build/jorphan"/>
  <property name="build.ldap" location="build/protocol/ldap"/>
  <property name="build.mail" location="build/protocol/mail"/>
  <property name="build.htmlparser" location="build/htmlparser"/>
  <property name="build.tcp" location="build/protocol/tcp"/>
  <property name="build.examples" location="build/examples"/>
  <property name="build.monitor.components" location="build/monitor/components"/>
  <property name="build.monitor.model" location="build/monitor/model"/>
  <property name="build.jms" location="build/protocol/jms"/>
  <property name="build.test" location="build/test"/>
  
  <!-- Path prefix to allow Anakia to find stylesheets if running under Eclipse -->
  <!--
  Anakia looks for stylesheets relative to the java launch directory.
  Use the External Tools properties page to define the variable
  as the relative path to the directory where this build file is found.
  For example: 
               eclipse.anakia=workspace/jmeter
  
  An alternative is to define it as a command-line argument on the Main page;
  this allows one to use a macro name, so is more portable.
  For example:
               -Declipse.anakia=workspace/${project_name}
  WARNING: you must ensure that you have selected a file or directory in
  the Navigator pane before attempting to run the build, or Eclipse will
  complain that it cannot resolve the variable name, and it can mark the
  launch configuration as having failed.
  -->
  <property name="eclipse.anakia" value="."/>

  <!-- Where the build result .jars will be placed -->
  <property name="dest.jar" value="lib/ext"/>
  <property name="dest.jar.jmeter" value="bin"/>

  <!-- Where the API documentation lives -->
  <property name="dest.docs.api" value="docs/api"/>

  <!-- Where the doc results live -->
  <property name="dest.docs" value="docs"/>
  <property name="dest.printable_docs" value="printable_docs"/>

  <!-- Directory where these 3rd party libraries will live -->
  <property name="lib.dir" value="lib"/>
  
  <!-- Directory where Optional 3rd party libraries will live -->
  <property name="lib.opt" value="lib/opt"/>

  <!-- Other stuff -->
  <property name="extras.dir" value="extras"/>

  <!-- Where the distribution packages will be created -->
  <property name="dist.dir" value="dist"/>

  <!-- Where the web-site packages will be created -->
  <property name="site.dir" value="site"/>

  <!-- Compilation parameters -->
  <property name="optimize" value="on"/>
  <property name="deprecation" value="off"/>
  <property name="target.java.version" value="1.3"/>
  <property name="src.java.version" value="1.3"/>
  <property name="encoding" value="UTF-8"/>

  <!-- 3rd party libraries to be included in the binary distribution -->
  <property name="avalon-excalibur.jar" value="${lib.dir}/avalon-excalibur-4.1.jar"/>
  <property name="avalon-framework.jar" value="${lib.dir}/avalon-framework-4.1.4.jar"/>
  <property name="jakarta-oro.jar" value="${lib.dir}/jakarta-oro-2.0.8.jar"/>
  <property name="commons-collections.jar" value="${lib.dir}/commons-collections.jar"/>
  <property name="commons-httpclient.jar" value="${lib.dir}/commons-httpclient-2.0.jar"/>
  <property name="commons-logging.jar" value="${lib.dir}/commons-logging.jar"/>
  <property name="excalibur-logger.jar" value="${lib.dir}/excalibur-logger-1.1.jar"/>
  <property name="excalibur-i18n.jar" value="${lib.dir}/excalibur-i18n-1.1.jar"/>
  <property name="excalibur-compatibility.jar" value="${lib.dir}/excalibur-compatibility-1.1.jar"/>
  <property name="batik-awt-util.jar" value="${lib.dir}/batik-awt-util.jar"/>
  <property name="junit.jar" value="${lib.dir}/junit.jar"/>
  <property name="logkit.jar" value="${lib.dir}/logkit-1.2.jar"/>
  <property name="excalibur-datasource.jar" value="${lib.dir}/excalibur-datasource-1.1.1.jar"/>
  <property name="excalibur-pool.jar" value="${lib.dir}/excalibur-pool-1.2.jar"/>
  <property name="excalibur-instrument.jar" value="${lib.dir}/excalibur-instrument-1.0.jar"/>
  <property name="xstream.jar" value="${lib.dir}/xstream-1.0.1.jar"/>
  <property name="xpp3.jar" value="${lib.dir}/xpp3-1.1.3.4.D.jar"/>
	  
  <!-- The following 3 jars are probably optional for JDK1.4 -->
  <property name="xalan.jar" value="${lib.dir}/xalan.jar"/>
  <property name="xerces.jar" value="${lib.dir}/xercesImpl.jar"/>
  <property name="xml-apis.jar" value="${lib.dir}/xml-apis.jar"/>
  
  <property name="jdom.jar" value="${lib.dir}/jdom-b9.jar"/>
  <property name="js.jar" value="${lib.dir}/js.jar"/>
  <property name="soap.jar" value="${lib.dir}/soap.jar"/>
  <property name="tidy.jar" value="${lib.dir}/Tidy.jar"/>

  <patternset id="external.jars">
    <include name="LICENSE"/>
    <include name="NOTICE"/>
    <include name="README"/>
    <include name="INSTALL"/>
    <include name="${lib.dir}/*.html"/>
    <include name="${lib.dir}/LICENSE*.*"/>
    <include name="${avalon-excalibur.jar}"/>
    <include name="${avalon-framework.jar}"/>
    <include name="${jakarta-oro.jar}"/>
    <include name="${commons-collections.jar}"/>
    <include name="${commons-httpclient.jar}"/>
    <include name="${commons-logging.jar}"/>
    <include name="${excalibur-logger.jar}"/>
    <include name="${excalibur-i18n.jar}"/>
    <include name="${excalibur-compatibility.jar}"/>
    <include name="${junit.jar}"/>
    <include name="${logkit.jar}"/>
    <include name="${xalan.jar}"/>
    <include name="${xerces.jar}"/>
    <include name="${xml-apis.jar}"/>
    <include name="${jdom.jar}"/>
    <include name="${js.jar}"/>
    <include name="${soap.jar}"/>
    <include name="${tidy.jar}"/>
    <include name="${excalibur-datasource.jar}"/>
    <include name="${excalibur-pool.jar}"/>
    <include name="${excalibur-instrument.jar}"/>
    <include name="${batik-awt-util.jar}"/>
    <include name="${xstream.jar}"/>
    <include name="${xpp3.jar}"/>
  </patternset>

  <!--
  Optional jars, not included in distribution.
  Any such jars need to be downloaded separately.
  These can be put into ${lib.dir} or ${lib.opt}
  - both of these are included in the build classpath
  
  Any jars put into ${lib.dir} will be included in
  the classpath used by JMeter to load classes.
  Jars in ${lib.opt} are NOT normally included by JMeter.
  
  Placing an optional jar in ${lib.opt} means that it
  will be included in the build classpath, but it will
  not be included in the runtime classpath. This is intended
  for testing JMeter without the optional Jar file(s).
  -->
  
  <!-- Build classpath (includes the optional jar directory) -->
  <path id="classpath">
    <fileset dir="${lib.dir}" includes="*.jar"/>
    <fileset dir="${lib.opt}" includes="*.jar"/>
  </path>

  <!-- Anakia classpath -->
  <!--
  N.B. On some OSes - e.g. VMS - multiple "." are converted to other characters
  So replace the version part with "*" to match any version.
  -->
  <path id="anakia.classpath">
    <fileset dir="${lib.dir}" includes="velocity*.jar"/>
    <fileset dir="${lib.dir}" includes="jdom-*.jar"/>
    <fileset dir="${lib.dir}" includes="commons-collections*.jar"/>
    <fileset dir="${lib.dir}" includes="logkit-*.jar"/>
  </path>
  

  <target name="init-version">
  	<tstamp/>
  	<!-- JMeter version -->
  <property name="jmeter.version" value="2.1.${DSTAMP}"/>
  </target>

  <target name="init" depends="check-libs,report-missing-libs,init-version">
    <!-- Create the optional directory (fileset complains if it is missing) -->
    <mkdir dir="${lib.opt}"/>
  </target>

  	<!-- JMeter Javadoc version (own variable is used so can be overriden independently) -->
  <property name="docversion" value="${jmeter.version}"/>
  
  <target name="init-docs" depends="check-anakia,report-anakia-missing">
  	<echo>eclipse.anakia = ${eclipse.anakia}</echo>
  	</target>

  <!--
    - Check for optional libraries.
    -->
  <target name="check-libs" description="Check availability of optional libraries." unless="assuming.libs.present">
    <!-- Create the optional directory (fileset complains if it is missing) -->
    <mkdir dir="${lib.opt}"/>
    <available classname="com.sun.net.ssl.internal.ssl.Provider" property="jsse.present">
      <classpath refid="classpath"/>
    </available>
    <condition property="javamail.complete">
      <and>
        <available classname="javax.mail.Transport" classpathref="classpath"/>
        <available classname="javax.activation.DataHandler" classpathref="classpath"/>
      </and>
    </condition>
    <available classname="iaik.protocol.https.Handler" property="isasilk.present">
      <classpath refid="classpath"/>
    </available>
    <available classname="bsh.Interpreter" property="beanshell.present">
      <classpath refid="classpath"/>
    </available>
    <available classname="org.apache.bsf.BSFManager" property="bsf.present">
      <classpath refid="classpath"/>
    </available>
    <available classname="javax.jms.TopicConnection" property="jms.present">
      <classpath refid="classpath"/>
    </available>
  </target>
  
  <!--
    - Messages for missing libraries
    -->
  <target name="ssl-message" depends="check-libs" unless="jsse.present">
    <echo message="Classes for SSL not found in classpath"/>
  </target>

  <target name="iaik-message" depends="check-libs" unless="isasilk.present">
    <echo message="Classes for IAIK iSaSiLk not found in classpath"/>
  </target>

  <target name="mail-message" depends="check-libs" unless="javamail.complete">
    <echo message="Classes for Mail support not found in classpath"/>
  </target>

  <target name="beanshell-message" depends="check-libs" unless="beanshell.present">
    <echo message="Classes for BeanShell support not found in classpath"/>
  </target>

  <target name="bsf-message" depends="check-libs" unless="bsf.present">
    <echo message="Classes for BSF support not found in classpath"/>
  </target>

  <target name="jms-message" depends="check-libs" unless="jms.present">
    <echo message="Classes for JMS support not found in classpath"/>
  </target>

  <target name="report-missing-libs" 
      depends="ssl-message,iaik-message,mail-message,beanshell-message,bsf-message,jms-message"
  />

  <!--
    - Check for anakia task
    -->
  <target name="check-anakia">
    <available classpathref="anakia.classpath" classname="org.apache.velocity.anakia.AnakiaTask" property="AnakiaTask.present"/>
  </target>
  <target name="report-anakia-missing" depends="check-anakia" unless="AnakiaTask.present">
    <echo>
      AnakiaTask is not present, documentation will not be generated.
    </echo>
  </target>

  <target name="compile-core" depends="compile-jorphan,update-version" description="Compile JMeter core classes.">
    <mkdir dir="${build.core}"/>
    <javac srcdir="${src.core}" destdir="${build.core}" optimize="${optimize}" source="${src.java.version}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/util/JsseSSLManager.java" unless="jsse.present"/>
      <exclude name="org/apache/jmeter/util/keystore/PKCS12KeyStore.java" unless="isasilk.present"/>
      <exclude name="org/apache/jmeter/util/keystore/DefaultKeyStore.java" unless="jsse.present"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
      </classpath>
    </javac>
  </target>

  <target name="update-version" unless="version.noupdate">
    <echo>Updating version string</echo>
    <replaceregexp file="${src.core}/org/apache/jmeter/util/JMeterVersion.java"
    	match="VERSION = &quot;.*?&quot;"
	replace="VERSION = &quot;${jmeter.version}&quot;"/>
  </target>

  <target name="compile-components" depends="compile-jorphan,compile-core" description="Compile generic (protocol-independent) components.">
    <mkdir dir="${build.components}"/>
    <javac srcdir="${src.components}" destdir="${build.components}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/visualizers/MailerVisualizer.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/reporters/MailerModel.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/reporters/MailerResultCollector.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/assertions/**/BeanShell*.java" unless="beanshell.present"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-functions" depends="compile-jorphan,compile-core" description="Compile functions.">
    <mkdir dir="${build.functions}"/>
    <javac srcdir="${src.functions}" destdir="${build.functions}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-http" depends="compile-jorphan,compile-core,compile-htmlparser" description="Compile components specific to HTTP sampling.">
    <mkdir dir="${build.http}"/>
    <javac srcdir="${src.http}" destdir="${build.http}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java" unless="javamail.complete"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
        <pathelement location="${build.components}"/>
        <pathelement location="${build.htmlparser}"/>
      </classpath>
    </javac>
  </target>
  
  <target name="compile-tests" depends="compile" description="Compile components specific to HTTP sampling.">
    <mkdir dir="${build.test}"/>
    <javac srcdir="${src.test}" destdir="${build.test}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
        <pathelement location="${build.components}"/>
        <pathelement location="${build.htmlparser}"/>
        <pathelement location="${build.http}"/>
        <pathelement location="${build.ftp}"/>
        <pathelement location="${build.functions}"/>
        <pathelement location="${build.java}"/>
        <pathelement location="${build.jdbc}"/>
        <pathelement location="${build.ldap}"/>
        <pathelement location="${build.mail}"/>
        <pathelement location="${build.monitor.components}"/>
        <pathelement location="${build.monitor.model}"/>
        <pathelement location="${build.tcp}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-ftp" depends="compile-jorphan,compile-core" description="Compile components specific to FTP sampling.">
    <mkdir dir="${build.ftp}"/>
    <javac srcdir="${src.ftp}" destdir="${build.ftp}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-jdbc" depends="compile-jorphan,compile-core" description="Compile components specific to JDBC sampling.">
    <mkdir dir="${build.jdbc}"/>
    <javac srcdir="${src.jdbc}" destdir="${build.jdbc}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>
  
  <target name="compile-ldap" depends="compile-jorphan,compile-core" 
    description="Compile components specific to LDAP sampling.">
    <mkdir dir="${build.ldap}"/>
    <javac srcdir="${src.ldap}" destdir="${build.ldap}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="create-mail-dir">
    <mkdir dir="${build.mail}"/>
  </target>

  <target name="compile-mail" depends="compile-jorphan,compile-core,create-mail-dir" if="javamail.complete"
    description="Compile components specific to IMAP and POP3 sampling.">
    <javac srcdir="${src.mail}" destdir="${build.mail}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-java" depends="compile-jorphan,compile-core" description="Compile components specific to Java sampling.">
    <mkdir dir="${build.java}"/>
    <javac srcdir="${src.java}" destdir="${build.java}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/protocol/java/**/BeanShell*.java" unless="beanshell.present"/>
      <exclude name="org/apache/jmeter/protocol/java/**/BSF*.java" unless="bsf.present"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-tcp" depends="compile-jorphan,compile-core" description="Compile components specific to TCP sampling.">
    <mkdir dir="${build.tcp}"/>
    <javac srcdir="${src.tcp}" destdir="${build.tcp}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-protocols" depends="compile-http,compile-ftp,compile-jdbc,compile-java,compile-ldap,compile-mail,compile-tcp,compile-jms" description="Compile all protocol-specific components."/>

  <target name="compile-examples" depends="compile-jorphan,compile-core" description="Compile example components.">
    <mkdir dir="${build.examples}"/>
    <javac srcdir="${src.examples}" destdir="${build.examples}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-monitor" depends="compile-monitor-model,compile-monitor-components"/>

  <target name="compile-monitor-components"
    depends="compile-jorphan,compile-core,compile-components,compile-monitor-model">
    <mkdir dir="${build.monitor.components}"/>
    <javac srcdir="${src.monitor.components}" source="${src.java.version}" destdir="${build.monitor.components}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.monitor.model}"/>
        <pathelement location="${build.http}"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
        <pathelement location="${build.components}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-monitor-model" depends="compile-jorphan,compile-core">
    <mkdir dir="${build.monitor.model}"/>
    <javac srcdir="${src.monitor.model}" destdir="${build.monitor.model}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-jorphan" depends="init" description="Compile JOrphan utility classes.">
    <mkdir dir="${build.jorphan}"/>
    <javac srcdir="${src.jorphan}" destdir="${build.jorphan}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-rmi" depends="compile-jorphan,compile-core" description="Compile RMI stubs and skeletons.">
    <rmic base="${build.core}" classname="org.apache.jmeter.engine.RemoteJMeterEngineImpl">
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement path="${build.core}"/>
      </classpath>
    </rmic>
    <rmic base="${build.core}" classname="org.apache.jmeter.samplers.RemoteSampleListenerImpl">
      <classpath>
        <path refid="classpath"/>
        <pathelement path="${build.core}"/>
      </classpath>
    </rmic>
  </target>

  <target name="compile-htmlparser" depends="" description="Compile htmlparser.">
    <mkdir dir="${build.htmlparser}"/>
    <javac srcdir="${src.htmlparser}" destdir="${build.htmlparser}" optimize="${optimize}" debug="on" source="${src.java.version}" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-jms" depends="compile-jorphan,compile-core,compile-components" 
      	description="Compile components specific to JMS sampling."
  	    if="jms.present">
    <mkdir dir="${build.jms}"/>
    <javac srcdir="${src.jms}" destdir="${build.jms}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile" depends="compile-core,compile-components,compile-functions,compile-protocols,compile-rmi,compile-htmlparser,compile-monitor"
  description="Compile everything."/>

  <target name="package" depends="compile, package-only"
     description="Compile everything and create the jars"/>
  
<!--
N.B. Eclipse (and perhaps other Java IDEs) copies all files to the build directory, unless
told otherwise. This means that there might be copies of property and image files in the
build directory. To avoid including the files twice in the jar file, we include only .class
files in the list of files to be processed.

An alternative solution is to copy the extra resources to the build tree, and then
include everything from the build tree.
This has the disadvantage that there are then two copies of each
properties file visible in Eclipse, and it is easy to pick the wrong one to edit,
especially as the build directory appears first ...
The advantage would be that JMeter could theoretically be run from the classes, without
needing to create jar files first. However, this would mean changing the way JMeter loads
some of its classes - at present JMeter can only run from jar files.
-->
  <target name="package-only" description="Package already-compiled classes (shortcut for IDE users)">
    <mkdir dir="${dest.jar}"/>
    
    <!-- perhaps ought to include a basic jmeter.properties file in one of the jars,
    given that JMeterUtils looks for it if it cannot find the external one
    - otherwise, change utils to ignore it -->
    
    <!-- JMeter launch jar -->
    <jar jarfile="${dest.jar.jmeter}/ApacheJMeter.jar" includes="**/NewDriver*" 
        manifest="${src.core}/MANIFEST" 
        basedir="${build.core}"/>

    <!-- core -->    
    <jar jarfile="${dest.jar}/ApacheJMeter_core.jar" excludes="**/NewDriver*">
      <!-- Only include class files from build tree - see above -->
      <fileset dir="${build.core}" includes="**/*.class"/>
      <fileset dir="${src.core}" includes="org/apache/jmeter/images/"/>
      <fileset dir="${src.core}" includes="**/*.properties">
        <exclude name="*eucJP*"/>
      </fileset>
      <!-- This file is used by the jmeter -h option -->
      <fileset dir="${src.core}" includes="org/apache/jmeter/help.txt"/>
    </jar>
    
    <!-- components -->
    <jar jarfile="${dest.jar}/ApacheJMeter_components.jar">
      <fileset dir="${build.components}" includes="**/*.class" />
      <fileset dir="${src.components}" includes="**/*.properties" />
    </jar>
    
    <!-- functions -->
    <jar jarfile="${dest.jar}/ApacheJMeter_functions.jar">
      <fileset dir="${build.functions}" includes="**/*.class" />
      <fileset dir="${src.functions}" includes="**/*.properties" />
    </jar>

    <!-- http -->
    <jar jarfile="${dest.jar}/ApacheJMeter_http.jar">
      <fileset dir="${build.http}" includes="**/*.class" />
      <fileset dir="${src.http}" includes="**/*.properties" />
    </jar>
    
    <!-- ftp -->
    <jar jarfile="${dest.jar}/ApacheJMeter_ftp.jar">
      <fileset dir="${build.ftp}" includes="**/*.class" />
      <fileset dir="${src.ftp}" includes="**/*.properties" />
    </jar>
    
    <!-- jdbc -->
    <jar jarfile="${dest.jar}/ApacheJMeter_jdbc.jar">
      <fileset dir="${build.jdbc}" includes="**/*.class" />
      <fileset dir="${src.jdbc}" includes="**/*.properties" />
    </jar>
    
    <!-- java -->
    <jar jarfile="${dest.jar}/ApacheJMeter_java.jar">
      <fileset dir="${build.java}" includes="**/*.class" />
      <fileset dir="${src.java}" includes="**/*.properties" />
    </jar>
    
    <!-- ldap -->
    <jar jarfile="${dest.jar}/ApacheJMeter_ldap.jar">
      <fileset dir="${build.ldap}" includes="**/*.class" />
      <fileset dir="${src.ldap}" includes="**/*.properties" />
    </jar>
    
    <!-- mail -->
    <jar jarfile="${dest.jar}/ApacheJMeter_mail.jar" >
      <fileset dir="${build.mail}" includes="**/*.class"  />
      <fileset dir="${src.mail}" includes="**/*.properties" />
    </jar>
    
    <!-- tcp -->
    <jar jarfile="${dest.jar}/ApacheJMeter_tcp.jar">
      <fileset dir="${build.tcp}" includes="**/*.class" />
      <fileset dir="${src.tcp}" includes="**/*.properties" />
    </jar>
    
    <!-- monitor -->
    <jar jarfile="${dest.jar}/ApacheJMeter_monitors.jar">
      <fileset dir="${build.monitor.model}" includes="**/*.class" />
      <fileset dir="${build.monitor.components}" includes="**/*.class" />
    </jar>

    <!-- jms -->
    <jar jarfile="${dest.jar}/ApacheJMeter_jms.jar">
      <fileset dir="${build.jms}" includes="**/*.class" />
      <fileset dir="${src.jms}" includes="**/*.properties" />
    </jar><commit_msg>Ensure jms build dir exists even if JMS doesn't build<commit_after><?xml version="1.0"?>
<!--
   Copyright 1999-2004 The Apache Software Foundation
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<project name="JMeter" default="all" basedir=".">
  <description>
    To build JMeter from source and install:
      ant [all]
    To rebuild and install:
      ant install

    To update documentation (requires Anakia to be present)
      ant docs-site
      ant docs-printable
    To build API documentation (Javadoc)
      ant docs-api
    To build all the docs
      ant docs-all

    To build all and package up the files for distribution
      ant distribution [ -Djmeter.version=vvvv ]

  	To create tar and tgz of the web-site documentation (docs and api)
      ant site [ -Djmeter.version=vvvv ]
      
      
    For more info:
      ant -projecthelp

    To diagnose usage of deprecated APIs:
      ant -Ddeprecation=on clean compile
  </description>
  
  <!--

  Note
  ====
  As with most other Jakarta projects, Gump (http://jakarta.apache.org/gump/) is used to
  perform automated builds and tests on JMeter.
  
  Gump uses its project/jakarta-jmeter.xml file to determine which target to use.
  The current setting is: <ant target="dist">
  
  Any changes to the dependency list for dist may affect Gump.
  
  Now the dist target depends on "assume-libs-present", so if additional libraries are added to that,
  the Gump project file for JMeter must also be updated.

  Jars that are not required by the dist target do not need to be added to the Gump project file.

  -->
  
  <!-- Are we running under Gump? -->
  <property name="gump.run" value="false"/>
  
  <!-- The version of this file -->
  <property name="version.build" value="$Revision$"/>
  
  <!-- Renamed targets -->
  <target name="all-docs">
    <echo message="Target has been renamed to docs-all"/>
    <antcall target="docs-all"/>
   </target>

  <target name="api-docs">
    <echo message="Target has been renamed to docs-api"/>
    <antcall target="docs-api"/>
   </target>
   
   <target name="printable-docs">
    <echo message="Target has been renamed to docs-printable"/>
    <antcall target="docs-printable"/>
   </target>
   
   <target name="docs">
    <echo message="Target has been renamed to docs-site"/>
    <antcall target="docs-site"/>
   </target>
   
   <target name="src-dist">
    <echo message="Target has been renamed to dist-src"/>
    <antcall target="dist-src"/>
   </target>
   
   <!-- Findbugs task and target -->
   <!--
   Findbugs is licensed under the Lesser GNU Public License
   HomePage: http://www.cs.umd.edu/~pugh/java/bugs/
   
   To use the findbugs target, download and install the findbugs binary distribution
   Set the value of findbugs.homedir according to where you installed findbugs, for example:
   ant findbugs -Dfindbugs.homedir=/etc/findbugs -Dfindbugs.level=medium
  [The defaults are /findbugs and medium]
   -->
   <property name="findbugs.homedir" value="/findbugs" />
   <property name="findbugs.level" value="medium" />
   <property name="findbugs.outName" value="reports/jmeter-fb" />
   <target name="findbugs" description="Run the stand-alone Findbugs detector">
    <echoproperties prefix="findbugs"/>
    <mkdir dir="reports"/>
    <taskdef name="findbugs" 
        classpath="${findbugs.homedir}/lib/findbugs-ant.jar" 
        classname="edu.umd.cs.findbugs.anttask.FindBugsTask"/>
    <findbugs home="${findbugs.homedir}"
              output="xml"
              reportlevel="${findbugs.level}"
              excludeFilter="fb-excludes.xml"
              outputFile="${findbugs.outName}.xml" >
      <class location="${dest.jar}/*.jar" />
      <class location="${dest.jar.jmeter}/*.jar" />
      <sourcePath path="${src.core}" />
      <sourcePath path="${src.http}" />
      <sourcePath path="${src.ftp}" />
      <sourcePath path="${src.java}" />
      <sourcePath path="${src.jdbc}" />
      <sourcePath path="${src.ldap}" />
      <sourcePath path="${src.mail}" />
      <sourcePath path="${src.components}" />
      <sourcePath path="${src.functions}" />
      <class location="${lib.dir}/jorphan.jar" />
      <sourcePath path="${src.jorphan}" />
      <sourcePath path="${src.tcp}" />
      <sourcePath path="${src.jms}" />

	<!--
      Uncomment the following 2 lines to include htmlparser in the analysis
      <class location="${lib.dir}/htmlparser.jar" />
      <sourcePath path="${src.htmlparser}" />
      -->

      <auxClasspath>
       	<fileset dir="${lib.dir}">
       		<include name="*.jar"/>
       	</fileset>
      </auxClasspath>

      <auxClasspath>
       	<fileset dir="${lib.opt}">
       		<include name="*.jar"/>
       	</fileset>
      </auxClasspath>

    </findbugs>
    <antcall target="findbugs-style"/>
  </target>
  
  <!-- Convert findbugs XML output to CSV -->
   <target name="findbugs-style">
     <xslt style="fb-csv.xsl" 
       force="true"
       in="${findbugs.outName}.xml" 
       out="${findbugs.outName}.csv">
     </xslt>
   </target>

  <!-- Where the Sources live -->
  <property name="src.dir" value="src"/>
  <property name="src.core" value="src/core"/>
  <property name="src.http" value="src/protocol/http"/>
  <property name="src.ftp" value="src/protocol/ftp"/>
  <property name="src.test" value="test/src"/>
  <property name="src.jdbc" value="src/protocol/jdbc"/>
  <property name="src.java" value="src/protocol/java"/>
  <property name="src.components" value="src/components"/>
  <property name="src.functions" value="src/functions"/>
  <property name="src.jorphan" value="src/jorphan"/>
  <property name="src.ldap" value="src/protocol/ldap"/>
  <property name="src.htmlparser" value="src/htmlparser"/>
  <property name="src.tcp" value="src/protocol/tcp"/>
  <property name="src.examples" value="src/examples"/>
  <property name="src.mail" value="src/protocol/mail"/>
  <property name="src.monitor.components" value="src/monitor/components"/>
  <property name="src.monitor.model" value="src/monitor/model"/>
  <property name="src.jms" value="src/protocol/jms"/>

  <!-- Where the documentation sources live -->
  <property name="src.docs" value="xdocs"/>
  <property name="src.images" value="xdocs/images"/>
  <property name="src.demos" value="xdocs/demos"/>

  <!-- Javadoc sources -->
  <path id="srcpaths">
    <pathelement location="${src.core}"/>
    <pathelement location="${src.components}"/>
    <pathelement location="${src.functions}"/>
    <pathelement location="${src.http}"/>
    <pathelement location="${src.ftp}"/>
    <pathelement location="${src.jdbc}"/>
    <pathelement location="${src.java}"/>
    <pathelement location="${src.jorphan}"/>
    <pathelement location="${src.ldap}"/>
    <pathelement location="${src.htmlparser}"/>
    <pathelement location="${src.tcp}"/>
    <pathelement location="${src.examples}"/>
    <pathelement location="${src.mail}"/>
    <pathelement location="${src.monitor.components}"/>
    <pathelement location="${src.monitor.model}"/>
    <pathelement location="${src.jms}"/>
  </path>

  <!-- Temporary build directories: where the .class live -->
  <property name="build.dir" location="build"/>
  <property name="build.core" value="build/core"/>
  <property name="build.http" value="build/protocol/http"/>
  <property name="build.ftp" value="build/protocol/ftp"/>
  <property name="build.jdbc" value="build/protocol/jdbc"/>
  <property name="build.java" value="build/protocol/java"/>
  <property name="build.components" value="build/components"/>
  <property name="build.functions" value="build/functions"/>
  <property name="build.jorphan" value="build/jorphan"/>
  <property name="build.ldap" location="build/protocol/ldap"/>
  <property name="build.mail" location="build/protocol/mail"/>
  <property name="build.htmlparser" location="build/htmlparser"/>
  <property name="build.tcp" location="build/protocol/tcp"/>
  <property name="build.examples" location="build/examples"/>
  <property name="build.monitor.components" location="build/monitor/components"/>
  <property name="build.monitor.model" location="build/monitor/model"/>
  <property name="build.jms" location="build/protocol/jms"/>
  <property name="build.test" location="build/test"/>
  
  <!-- Path prefix to allow Anakia to find stylesheets if running under Eclipse -->
  <!--
  Anakia looks for stylesheets relative to the java launch directory.
  Use the External Tools properties page to define the variable
  as the relative path to the directory where this build file is found.
  For example: 
               eclipse.anakia=workspace/jmeter
  
  An alternative is to define it as a command-line argument on the Main page;
  this allows one to use a macro name, so is more portable.
  For example:
               -Declipse.anakia=workspace/${project_name}
  WARNING: you must ensure that you have selected a file or directory in
  the Navigator pane before attempting to run the build, or Eclipse will
  complain that it cannot resolve the variable name, and it can mark the
  launch configuration as having failed.
  -->
  <property name="eclipse.anakia" value="."/>

  <!-- Where the build result .jars will be placed -->
  <property name="dest.jar" value="lib/ext"/>
  <property name="dest.jar.jmeter" value="bin"/>

  <!-- Where the API documentation lives -->
  <property name="dest.docs.api" value="docs/api"/>

  <!-- Where the doc results live -->
  <property name="dest.docs" value="docs"/>
  <property name="dest.printable_docs" value="printable_docs"/>

  <!-- Directory where these 3rd party libraries will live -->
  <property name="lib.dir" value="lib"/>
  
  <!-- Directory where Optional 3rd party libraries will live -->
  <property name="lib.opt" value="lib/opt"/>

  <!-- Other stuff -->
  <property name="extras.dir" value="extras"/>

  <!-- Where the distribution packages will be created -->
  <property name="dist.dir" value="dist"/>

  <!-- Where the web-site packages will be created -->
  <property name="site.dir" value="site"/>

  <!-- Compilation parameters -->
  <property name="optimize" value="on"/>
  <property name="deprecation" value="off"/>
  <property name="target.java.version" value="1.3"/>
  <property name="src.java.version" value="1.3"/>
  <property name="encoding" value="UTF-8"/>

  <!-- 3rd party libraries to be included in the binary distribution -->
  <property name="avalon-excalibur.jar" value="${lib.dir}/avalon-excalibur-4.1.jar"/>
  <property name="avalon-framework.jar" value="${lib.dir}/avalon-framework-4.1.4.jar"/>
  <property name="jakarta-oro.jar" value="${lib.dir}/jakarta-oro-2.0.8.jar"/>
  <property name="commons-collections.jar" value="${lib.dir}/commons-collections.jar"/>
  <property name="commons-httpclient.jar" value="${lib.dir}/commons-httpclient-2.0.jar"/>
  <property name="commons-logging.jar" value="${lib.dir}/commons-logging.jar"/>
  <property name="excalibur-logger.jar" value="${lib.dir}/excalibur-logger-1.1.jar"/>
  <property name="excalibur-i18n.jar" value="${lib.dir}/excalibur-i18n-1.1.jar"/>
  <property name="excalibur-compatibility.jar" value="${lib.dir}/excalibur-compatibility-1.1.jar"/>
  <property name="batik-awt-util.jar" value="${lib.dir}/batik-awt-util.jar"/>
  <property name="junit.jar" value="${lib.dir}/junit.jar"/>
  <property name="logkit.jar" value="${lib.dir}/logkit-1.2.jar"/>
  <property name="excalibur-datasource.jar" value="${lib.dir}/excalibur-datasource-1.1.1.jar"/>
  <property name="excalibur-pool.jar" value="${lib.dir}/excalibur-pool-1.2.jar"/>
  <property name="excalibur-instrument.jar" value="${lib.dir}/excalibur-instrument-1.0.jar"/>
  <property name="xstream.jar" value="${lib.dir}/xstream-1.0.1.jar"/>
  <property name="xpp3.jar" value="${lib.dir}/xpp3-1.1.3.4.D.jar"/>
	  
  <!-- The following 3 jars are probably optional for JDK1.4 -->
  <property name="xalan.jar" value="${lib.dir}/xalan.jar"/>
  <property name="xerces.jar" value="${lib.dir}/xercesImpl.jar"/>
  <property name="xml-apis.jar" value="${lib.dir}/xml-apis.jar"/>
  
  <property name="jdom.jar" value="${lib.dir}/jdom-b9.jar"/>
  <property name="js.jar" value="${lib.dir}/js.jar"/>
  <property name="soap.jar" value="${lib.dir}/soap.jar"/>
  <property name="tidy.jar" value="${lib.dir}/Tidy.jar"/>

  <patternset id="external.jars">
    <include name="LICENSE"/>
    <include name="NOTICE"/>
    <include name="README"/>
    <include name="INSTALL"/>
    <include name="${lib.dir}/*.html"/>
    <include name="${lib.dir}/LICENSE*.*"/>
    <include name="${avalon-excalibur.jar}"/>
    <include name="${avalon-framework.jar}"/>
    <include name="${jakarta-oro.jar}"/>
    <include name="${commons-collections.jar}"/>
    <include name="${commons-httpclient.jar}"/>
    <include name="${commons-logging.jar}"/>
    <include name="${excalibur-logger.jar}"/>
    <include name="${excalibur-i18n.jar}"/>
    <include name="${excalibur-compatibility.jar}"/>
    <include name="${junit.jar}"/>
    <include name="${logkit.jar}"/>
    <include name="${xalan.jar}"/>
    <include name="${xerces.jar}"/>
    <include name="${xml-apis.jar}"/>
    <include name="${jdom.jar}"/>
    <include name="${js.jar}"/>
    <include name="${soap.jar}"/>
    <include name="${tidy.jar}"/>
    <include name="${excalibur-datasource.jar}"/>
    <include name="${excalibur-pool.jar}"/>
    <include name="${excalibur-instrument.jar}"/>
    <include name="${batik-awt-util.jar}"/>
    <include name="${xstream.jar}"/>
    <include name="${xpp3.jar}"/>
  </patternset>

  <!--
  Optional jars, not included in distribution.
  Any such jars need to be downloaded separately.
  These can be put into ${lib.dir} or ${lib.opt}
  - both of these are included in the build classpath
  
  Any jars put into ${lib.dir} will be included in
  the classpath used by JMeter to load classes.
  Jars in ${lib.opt} are NOT normally included by JMeter.
  
  Placing an optional jar in ${lib.opt} means that it
  will be included in the build classpath, but it will
  not be included in the runtime classpath. This is intended
  for testing JMeter without the optional Jar file(s).
  -->
  
  <!-- Build classpath (includes the optional jar directory) -->
  <path id="classpath">
    <fileset dir="${lib.dir}" includes="*.jar"/>
    <fileset dir="${lib.opt}" includes="*.jar"/>
  </path>

  <!-- Anakia classpath -->
  <!--
  N.B. On some OSes - e.g. VMS - multiple "." are converted to other characters
  So replace the version part with "*" to match any version.
  -->
  <path id="anakia.classpath">
    <fileset dir="${lib.dir}" includes="velocity*.jar"/>
    <fileset dir="${lib.dir}" includes="jdom-*.jar"/>
    <fileset dir="${lib.dir}" includes="commons-collections*.jar"/>
    <fileset dir="${lib.dir}" includes="logkit-*.jar"/>
  </path>
  

  <target name="init-version">
  	<tstamp/>
  	<!-- JMeter version -->
  <property name="jmeter.version" value="2.1.${DSTAMP}"/>
  </target>

  <target name="init" depends="check-libs,report-missing-libs,init-version">
    <!-- Create the optional directory (fileset complains if it is missing) -->
    <mkdir dir="${lib.opt}"/>
  </target>

  	<!-- JMeter Javadoc version (own variable is used so can be overriden independently) -->
  <property name="docversion" value="${jmeter.version}"/>
  
  <target name="init-docs" depends="check-anakia,report-anakia-missing">
  	<echo>eclipse.anakia = ${eclipse.anakia}</echo>
  	</target>

  <!--
    - Check for optional libraries.
    -->
  <target name="check-libs" description="Check availability of optional libraries." unless="assuming.libs.present">
    <!-- Create the optional directory (fileset complains if it is missing) -->
    <mkdir dir="${lib.opt}"/>
    <available classname="com.sun.net.ssl.internal.ssl.Provider" property="jsse.present">
      <classpath refid="classpath"/>
    </available>
    <condition property="javamail.complete">
      <and>
        <available classname="javax.mail.Transport" classpathref="classpath"/>
        <available classname="javax.activation.DataHandler" classpathref="classpath"/>
      </and>
    </condition>
    <available classname="iaik.protocol.https.Handler" property="isasilk.present">
      <classpath refid="classpath"/>
    </available>
    <available classname="bsh.Interpreter" property="beanshell.present">
      <classpath refid="classpath"/>
    </available>
    <available classname="org.apache.bsf.BSFManager" property="bsf.present">
      <classpath refid="classpath"/>
    </available>
    <available classname="javax.jms.TopicConnection" property="jms.present">
      <classpath refid="classpath"/>
    </available>
  </target>
  
  <!--
    - Messages for missing libraries
    -->
  <target name="ssl-message" depends="check-libs" unless="jsse.present">
    <echo message="Classes for SSL not found in classpath"/>
  </target>

  <target name="iaik-message" depends="check-libs" unless="isasilk.present">
    <echo message="Classes for IAIK iSaSiLk not found in classpath"/>
  </target>

  <target name="mail-message" depends="check-libs" unless="javamail.complete">
    <echo message="Classes for Mail support not found in classpath"/>
  </target>

  <target name="beanshell-message" depends="check-libs" unless="beanshell.present">
    <echo message="Classes for BeanShell support not found in classpath"/>
  </target>

  <target name="bsf-message" depends="check-libs" unless="bsf.present">
    <echo message="Classes for BSF support not found in classpath"/>
  </target>

  <target name="jms-message" depends="check-libs" unless="jms.present">
    <echo message="Classes for JMS support not found in classpath"/>
  </target>

  <target name="report-missing-libs" 
      depends="ssl-message,iaik-message,mail-message,beanshell-message,bsf-message,jms-message"
  />

  <!--
    - Check for anakia task
    -->
  <target name="check-anakia">
    <available classpathref="anakia.classpath" classname="org.apache.velocity.anakia.AnakiaTask" property="AnakiaTask.present"/>
  </target>
  <target name="report-anakia-missing" depends="check-anakia" unless="AnakiaTask.present">
    <echo>
      AnakiaTask is not present, documentation will not be generated.
    </echo>
  </target>

  <target name="compile-core" depends="compile-jorphan,update-version" description="Compile JMeter core classes.">
    <mkdir dir="${build.core}"/>
    <javac srcdir="${src.core}" destdir="${build.core}" optimize="${optimize}" source="${src.java.version}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/util/JsseSSLManager.java" unless="jsse.present"/>
      <exclude name="org/apache/jmeter/util/keystore/PKCS12KeyStore.java" unless="isasilk.present"/>
      <exclude name="org/apache/jmeter/util/keystore/DefaultKeyStore.java" unless="jsse.present"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
      </classpath>
    </javac>
  </target>

  <target name="update-version" unless="version.noupdate">
    <echo>Updating version string</echo>
    <replaceregexp file="${src.core}/org/apache/jmeter/util/JMeterVersion.java"
    	match="VERSION = &quot;.*?&quot;"
	replace="VERSION = &quot;${jmeter.version}&quot;"/>
  </target>

  <target name="compile-components" depends="compile-jorphan,compile-core" description="Compile generic (protocol-independent) components.">
    <mkdir dir="${build.components}"/>
    <javac srcdir="${src.components}" destdir="${build.components}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/visualizers/MailerVisualizer.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/reporters/MailerModel.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/reporters/MailerResultCollector.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/assertions/**/BeanShell*.java" unless="beanshell.present"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-functions" depends="compile-jorphan,compile-core" description="Compile functions.">
    <mkdir dir="${build.functions}"/>
    <javac srcdir="${src.functions}" destdir="${build.functions}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-http" depends="compile-jorphan,compile-core,compile-htmlparser" description="Compile components specific to HTTP sampling.">
    <mkdir dir="${build.http}"/>
    <javac srcdir="${src.http}" destdir="${build.http}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/protocol/http/sampler/WebServiceSampler.java" unless="javamail.complete"/>
      <exclude name="org/apache/jmeter/protocol/http/control/gui/WebServiceSamplerGui.java" unless="javamail.complete"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
        <pathelement location="${build.components}"/>
        <pathelement location="${build.htmlparser}"/>
      </classpath>
    </javac>
  </target>
  
  <target name="compile-tests" depends="compile" description="Compile components specific to HTTP sampling.">
    <mkdir dir="${build.test}"/>
    <javac srcdir="${src.test}" destdir="${build.test}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
        <pathelement location="${build.components}"/>
        <pathelement location="${build.htmlparser}"/>
        <pathelement location="${build.http}"/>
        <pathelement location="${build.ftp}"/>
        <pathelement location="${build.functions}"/>
        <pathelement location="${build.java}"/>
        <pathelement location="${build.jdbc}"/>
        <pathelement location="${build.ldap}"/>
        <pathelement location="${build.mail}"/>
        <pathelement location="${build.monitor.components}"/>
        <pathelement location="${build.monitor.model}"/>
        <pathelement location="${build.tcp}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-ftp" depends="compile-jorphan,compile-core" description="Compile components specific to FTP sampling.">
    <mkdir dir="${build.ftp}"/>
    <javac srcdir="${src.ftp}" destdir="${build.ftp}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-jdbc" depends="compile-jorphan,compile-core" description="Compile components specific to JDBC sampling.">
    <mkdir dir="${build.jdbc}"/>
    <javac srcdir="${src.jdbc}" destdir="${build.jdbc}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>
  
  <target name="compile-ldap" depends="compile-jorphan,compile-core" 
    description="Compile components specific to LDAP sampling.">
    <mkdir dir="${build.ldap}"/>
    <javac srcdir="${src.ldap}" destdir="${build.ldap}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="create-mail-dir">
    <mkdir dir="${build.mail}"/>
  </target>

  <target name="compile-mail" depends="compile-jorphan,compile-core,create-mail-dir" if="javamail.complete"
    description="Compile components specific to IMAP and POP3 sampling.">
    <javac srcdir="${src.mail}" destdir="${build.mail}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-java" depends="compile-jorphan,compile-core" description="Compile components specific to Java sampling.">
    <mkdir dir="${build.java}"/>
    <javac srcdir="${src.java}" destdir="${build.java}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <exclude name="org/apache/jmeter/protocol/java/**/BeanShell*.java" unless="beanshell.present"/>
      <exclude name="org/apache/jmeter/protocol/java/**/BSF*.java" unless="bsf.present"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-tcp" depends="compile-jorphan,compile-core" description="Compile components specific to TCP sampling.">
    <mkdir dir="${build.tcp}"/>
    <javac srcdir="${src.tcp}" destdir="${build.tcp}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-protocols" depends="compile-http,compile-ftp,compile-jdbc,compile-java,compile-ldap,compile-mail,compile-tcp,compile-jms" description="Compile all protocol-specific components."/>

  <target name="compile-examples" depends="compile-jorphan,compile-core" description="Compile example components.">
    <mkdir dir="${build.examples}"/>
    <javac srcdir="${src.examples}" destdir="${build.examples}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-monitor" depends="compile-monitor-model,compile-monitor-components"/>

  <target name="compile-monitor-components"
    depends="compile-jorphan,compile-core,compile-components,compile-monitor-model">
    <mkdir dir="${build.monitor.components}"/>
    <javac srcdir="${src.monitor.components}" source="${src.java.version}" destdir="${build.monitor.components}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.monitor.model}"/>
        <pathelement location="${build.http}"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
        <pathelement location="${build.components}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-monitor-model" depends="compile-jorphan,compile-core">
    <mkdir dir="${build.monitor.model}"/>
    <javac srcdir="${src.monitor.model}" destdir="${build.monitor.model}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-jorphan" depends="init" description="Compile JOrphan utility classes.">
    <mkdir dir="${build.jorphan}"/>
    <javac srcdir="${src.jorphan}" destdir="${build.jorphan}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-rmi" depends="compile-jorphan,compile-core" description="Compile RMI stubs and skeletons.">
    <rmic base="${build.core}" classname="org.apache.jmeter.engine.RemoteJMeterEngineImpl">
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement path="${build.core}"/>
      </classpath>
    </rmic>
    <rmic base="${build.core}" classname="org.apache.jmeter.samplers.RemoteSampleListenerImpl">
      <classpath>
        <path refid="classpath"/>
        <pathelement path="${build.core}"/>
      </classpath>
    </rmic>
  </target>

  <target name="compile-htmlparser" depends="" description="Compile htmlparser.">
    <mkdir dir="${build.htmlparser}"/>
    <javac srcdir="${src.htmlparser}" destdir="${build.htmlparser}" optimize="${optimize}" debug="on" source="${src.java.version}" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile-jms" depends="compile-jorphan,compile-core,compile-components" 
      	description="Compile components specific to JMS sampling."
  	    if="jms.present">
    <mkdir dir="${build.jms}"/>
    <javac srcdir="${src.jms}" destdir="${build.jms}" source="${src.java.version}" optimize="${optimize}" debug="on" target="${target.java.version}" deprecation="${deprecation}" encoding="${encoding}">
      <include name="**/*.java"/>
      <classpath>
        <path refid="classpath"/>
        <pathelement location="${build.jorphan}"/>
        <pathelement location="${build.core}"/>
      </classpath>
    </javac>
  </target>

  <target name="compile" depends="compile-core,compile-components,compile-functions,compile-protocols,compile-rmi,compile-htmlparser,compile-monitor"
  description="Compile everything."/>

  <target name="package" depends="compile, package-only"
     description="Compile everything and create the jars"/>
  
<!--
N.B. Eclipse (and perhaps other Java IDEs) copies all files to the build directory, unless
told otherwise. This means that there might be copies of property and image files in the
build directory. To avoid including the files twice in the jar file, we include only .class
files in the list of files to be processed.

An alternative solution is to copy the extra resources to the build tree, and then
include everything from the build tree.
This has the disadvantage that there are then two copies of each
properties file visible in Eclipse, and it is easy to pick the wrong one to edit,
especially as the build directory appears first ...
The advantage would be that JMeter could theoretically be run from the classes, without
needing to create jar files first. However, this would mean changing the way JMeter loads
some of its classes - at present JMeter can only run from jar files.
-->
  <target name="package-only" description="Package already-compiled classes (shortcut for IDE users)">
    <mkdir dir="${dest.jar}"/>
    
    <!-- perhaps ought to include a basic jmeter.properties file in one of the jars,
    given that JMeterUtils looks for it if it cannot find the external one
    - otherwise, change utils to ignore it -->
    
    <!-- JMeter launch jar -->
    <jar jarfile="${dest.jar.jmeter}/ApacheJMeter.jar" includes="**/NewDriver*" 
        manifest="${src.core}/MANIFEST" 
        basedir="${build.core}"/>

    <!-- core -->    
    <jar jarfile="${dest.jar}/ApacheJMeter_core.jar" excludes="**/NewDriver*">
      <!-- Only include class files from build tree - see above -->
      <fileset dir="${build.core}" includes="**/*.class"/>
      <fileset dir="${src.core}" includes="org/apache/jmeter/images/"/>
      <fileset dir="${src.core}" includes="**/*.properties">
        <exclude name="*eucJP*"/>
      </fileset>
      <!-- This file is used by the jmeter -h option -->
      <fileset dir="${src.core}" includes="org/apache/jmeter/help.txt"/>
    </jar>
    
    <!-- components -->
    <jar jarfile="${dest.jar}/ApacheJMeter_components.jar">
      <fileset dir="${build.components}" includes="**/*.class" />
      <fileset dir="${src.components}" includes="**/*.properties" />
    </jar>
    
    <!-- functions -->
    <jar jarfile="${dest.jar}/ApacheJMeter_functions.jar">
      <fileset dir="${build.functions}" includes="**/*.class" />
      <fileset dir="${src.functions}" includes="**/*.properties" />
    </jar>

    <!-- http -->
    <jar jarfile="${dest.jar}/ApacheJMeter_http.jar">
      <fileset dir="${build.http}" includes="**/*.class" />
      <fileset dir="${src.http}" includes="**/*.properties" />
    </jar>
    
    <!-- ftp -->
    <jar jarfile="${dest.jar}/ApacheJMeter_ftp.jar">
      <fileset dir="${build.ftp}" includes="**/*.class" />
      <fileset dir="${src.ftp}" includes="**/*.properties" />
    </jar>
    
    <!-- jdbc -->
    <jar jarfile="${dest.jar}/ApacheJMeter_jdbc.jar">
      <fileset dir="${build.jdbc}" includes="**/*.class" />
      <fileset dir="${src.jdbc}" includes="**/*.properties" />
    </jar>
    
    <!-- java -->
    <jar jarfile="${dest.jar}/ApacheJMeter_java.jar">
      <fileset dir="${build.java}" includes="**/*.class" />
      <fileset dir="${src.java}" includes="**/*.properties" />
    </jar>
    
    <!-- ldap -->
    <jar jarfile="${dest.jar}/ApacheJMeter_ldap.jar">
      <fileset dir="${build.ldap}" includes="**/*.class" />
      <fileset dir="${src.ldap}" includes="**/*.properties" />
    </jar>
    
    <!-- mail -->
    <jar jarfile="${dest.jar}/ApacheJMeter_mail.jar" >
      <fileset dir="${build.mail}" includes="**/*.class"  />
      <fileset dir="${src.mail}" includes="**/*.properties" />
    </jar>
    
    <!-- tcp -->
    <jar jarfile="${dest.jar}/ApacheJMeter_tcp.jar">
      <fileset dir="${build.tcp}" includes="**/*.class" />
      <fileset dir="${src.tcp}" includes="**/*.properties" />
    </jar>
    
    <!-- monitor -->
    <jar jarfile="${dest.jar}/ApacheJMeter_monitors.jar">
      <fileset dir="${build.monitor.model}" includes="**/*.class" />
      <fileset dir="${build.monitor.components}" includes="**/*.class" />
    </jar>

    <!-- jms -->
    <!-- Ensure that build dir exists, even if JMS has not been built -->
    <mkdir dir="${build.jms}"/>
    <jar jarfile="${dest.jar}/ApacheJMeter_jms.jar">
      <fileset dir="${build.jms}" includes="**/*.class" />
      <fileset dir="${src.jms}" includes="**/*.properties" />
    </jar>
{'fraction_non_alphanumeric': 0.18488025996013216, 'fraction_numerical': 0.001993391769749597, 'mean_word_length': 3.720482083011085, 'pattern_counts': {'":': 0, '<': 1237, '<?xml version=': 2, '>': 1237, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 18}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6553254', 'n_tokens_mistral': 22665, 'n_tokens_neox': 21880, 'n_words': 4884}