<commit_before><?xml version="1.0" encoding="UTF-8"?>
<!--
 ! Licensed to the Apache Software Foundation (ASF) under one
 ! or more contributor license agreements.  See the NOTICE file
 ! distributed with this work for additional information
 ! regarding copyright ownership. The ASF licenses this file
 ! to you 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.
 !-->

<!-- ################################################################## -->
<!-- ##                                                                 -->
<!-- ## Building Apache River                                           -->
<!-- ## _____________________                                           -->
<!-- ##                                                                 -->
<!-- ## Refer to doc/build.html to obtain detailed instructions for     -->
<!-- ##	building the Apache River source distribution.                  -->
<!-- ##                                                                 -->
<!-- ################################################################## -->
<project name="river" basedir="." default="all.build"
        xmlns:artifact="antlib:org.apache.maven.artifact.ant">

    <description>Apache River is a project furthering the development
        and advancement of Jini technology.</description>
        
    <!-- import common settings and macros -->
    <import file="common.xml"/>
    
    <!-- Distribution settings -->
    <property name="bin.tar.bundle" location="${dist}/${product.name}-bin.tar.gz"/>
    <property name="bin.zip.bundle" location="${dist}/${product.name}-bin.zip"/>
    <property name="src.tar.bundle" location="${dist}/${product.name}-src.tar.gz"/>
    <property name="src.zip.bundle" location="${dist}/${product.name}-src.zip"/>
    <property name="doc.tar.bundle" location="${dist}/${product.name}-doc.tar.gz"/>
    <property name="doc.zip.bundle" location="${dist}/${product.name}-doc.zip"/>

    <target name="hudson-ci" description="hudson build target" depends="diagnostics,hudson-ci-settings,all.clean,release,test,javadoc-internals" />

    <target name="hudson-ci-settings" description="provide default settings" >
        <echoproperties />
    </target>

    <target name="hudson-qa" description="hudson QA build target" depends="diagnostics,hudson-qa-settings,all.clean,qa.run" />


    <target name="hudson-qa-settings" description="provide default settings" >
        <property name="harness.generateHtml" value="true" />
        <echoproperties />
    </target>

    <target name="river-runtime" description="results in complete river, without release archives"
        depends="configentry,jars"
    />

    <target name="build" description="for compatibility" depends="river-runtime,test,river-doc"/>

    <target name="copy-resources"
		description="Copies various resources directories to the classes dir."
		depends="start.copy-resources, tools.copy-resources">
    </target>

    <target name="release" description="Create source and binary release packages"
		depends="release-src, release-bin, release-doc">
    </target>

    <fileset id="river.bin.files" dir="${basedir}">
        <include name="DISCLAIMER"/>
        <include name="LICENSE"/>
        <include name="NOTICE"/>

        <include name="${lib}/**"/>
        <include name="${lib-dl}/**"/>
        <include name="${lib-ext}/**"/>
        <include name="${configentry}/**"/>
    </fileset>

    <fileset id="river.doc.files" dir="${basedir}">
        <include name="DISCLAIMER"/>
        <include name="LICENSE"/>
        <include name="NOTICE"/>

        <include name="${doc}/**"/>
        <exclude name="${doc}/release-notes/new.html"/>
    </fileset>

    <fileset id="examples.bin.files" dir="${basedir}/examples">
        <include name="**/${lib}/**"/>
        <include name="**/config/**"/>
        <exclude name="**/config/META-INF/"/>
        <include name="**/prebuiltkeys/**"/>
        <include name="**/scripts/*.bat"/>
        <include name="**/${doc}/**"/>
        <include name="**/*.html"/>
    </fileset>
    
    <fileset id="examples.bin.exec.files" dir="${basedir}/examples">
        <include name="**/scripts/*.sh"/>
    </fileset>

    <!-- TODO create separate bin distribution for the qa tests? -->
    <!--<fileset id="qa.bin.files" dir="${basedir}/qa">
        <include name="${lib}/**"/>
        <include name="${lib-ext}/**"/>
        <include name="${doc}/**"/>
        <include name="harness/**"/>
        <include name="README.txt"/>
    </fileset>-->

    <target name="release-bin" description="Create a binary release" depends="all.build">
        <!-- TODO: add depends: javadoc-internals and remove from ci-build -->

        <mkdir dir="${dist.dir}"/>
        <delete file="${bin.zip.bundle}"/>
        <zip destfile="${bin.zip.bundle}" roundup="yes">
            <zipfileset prefix="${product.name}" refid="river.bin.files" />
            <zipfileset prefix="${product.name}/examples" refid="examples.bin.files" />
            <zipfileset prefix="${product.name}/examples" refid="examples.bin.exec.files" filemode="755"/>
            <!--<zipfileset prefix="${product.name}/qa" refid="qa.bin.files" />-->
        </zip>
        <delete file="${bin.tar.bundle}"/>
        <tar destfile="${bin.tar.bundle}" compression="gzip" longfile="gnu">
            <tarfileset prefix="${product.name}" refid="river.bin.files" />
            <tarfileset prefix="${product.name}/examples" refid="examples.bin.files" />
            <tarfileset prefix="${product.name}/examples" refid="examples.bin.exec.files" filemode="755"/>
            <!--<tarfileset prefix="${product.name}/qa" refid="qa.bin.files" />-->
        </tar>
    </target>

    <fileset id="river.src.files" dir="${basedir}">
        <include name="**" />
        <exclude name="${build}/**"/>
        <exclude name="${configentry}/**"/>
        <exclude name="${dist}/**"/>
        <exclude name="${doc}/**"/>
        <exclude name="${lib}/**"/>
        <exclude name="${lib-dl}/**"/>
        <exclude name="${lib-ext}/**"/>
        <!-- TODO: remove when archive building is pure river.src.files based -->
        <exclude name="qa/**"/>

        <exclude name="${test}/classes/**" />
        <exclude name="${test}/results/**" />

        <!--
        TODO: why were these excluded from the source archive?
        <exclude name="${doc}/release-notes/new.html"/>
        <exclude name="${src}/**/*.sh"/>
        -->

    </fileset>

    <fileset id="examples.src.files" dir="${basedir}/examples">
        <include name="**"/>
        <exclude name="**/${lib}/"/>
        <exclude name="**/${build}/"/>
        <exclude name="**/prebuiltkeys/"/>
        <exclude name="**/${doc}/"/>
    </fileset>

    <fileset id="examples.src.exec.files" dir="${basedir}/examples">
        <include name="**/scripts/*.sh"/>
    </fileset>

    <fileset id="qa.src.files" dir="${basedir}/qa">
        <include name="${src}/**"/>
        <include name="harness/**"/>
        <include name="jtreg/**"/>
        <exclude name="jtreg/JT*"/>
        <include name="${doc}/**"/>
        <exclude name="${doc.api}/"/>
        <include name="build.xml"/>
        <include name="README*.txt"/>
    </fileset>

    <target name="release-doc" description="Create release doc archives" depends="river-doc">
                
        <mkdir dir="${dist.dir}"/>
        <delete file="${doc.zip.bundle}"/>
        <zip destfile="${doc.zip.bundle}" roundup="yes">
            <zipfileset prefix="${product.name}" refid="river.doc.files"/>
        </zip>
        <delete file="${doc.tar.bundle}"/>
        <tar destfile="${doc.tar.bundle}" compression="gzip" longfile="gnu">
            <tarfileset prefix="${product.name}" refid="river.doc.files" />
        </tar>
    </target>

    <target name="release-src" description="Create a source release">
        <mkdir dir="${dist.dir}"/>
        <delete file="${src.zip.bundle}"/>
        <zip destfile="${src.zip.bundle}" roundup="yes">
            <zipfileset prefix="${product.name}" refid="river.src.files"/>
            <zipfileset prefix="${product.name}/examples" refid="examples.src.files"/>
            <zipfileset prefix="${product.name}/examples"
                    refid="examples.src.exec.files" filemode="755"/>
            <zipfileset prefix="${product.name}/qa" refid="qa.src.files" />
        </zip>
        <delete file="${src.tar.bundle}"/>
        <tar destfile="${src.tar.bundle}" compression="gzip" longfile="gnu">
            <tarfileset prefix="${product.name}" refid="river.src.files" />
            <tarfileset prefix="${product.name}/examples"
                    refid="examples.src.files" />
            <tarfileset prefix="${product.name}/examples"
                    refid="examples.src.exec.files" filemode="755"/>
            <tarfileset prefix="${product.name}/qa" refid="qa.src.files" />
        </tar>
    </target>

    <target name="prep" depends="deps" 
            description="Create build directory structure">
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.classes.dir}"/>
        <mkdir dir="${build.deps.dir}"/>
        <mkdir dir="${configentry.dir}"/>
        <mkdir dir="${lib-dl.dir}"/>
        <mkdir dir="${lib-ext.dir}"/>
    </target>

    <target name="deps" description="Verify build dependencies">
        <!-- verify JDK version	-->
        <condition property="unsupported.jdk">
            <or>
                <equals arg1="${ant.java.version}" arg2="1.1"/>
                <equals arg1="${ant.java.version}" arg2="1.2"/>
                <equals arg1="${ant.java.version}" arg2="1.3"/>
            </or>
        </condition>
        <fail if="unsupported.jdk">Building ${product.name} requires Java 2 SDK 1.4 or greater.</fail>
    </target>

    <!-- =========== documentation related ============ -->

    <target name="river-doc" depends="doc-init,javadoc-api,javadoc-spec,javadoc-internals" />

    <target name="doc-clean" depends="-doc-settings" >
        <delete dir="${doc.dir}" quiet="true"/>
    </target>

    <target name="-doc-settings" description="set javadoc options">
        
        <property name="javadoc.doc-title" value="${product.title} API Documentation"/>
        <property name="javadoc.win-title" value="${javadoc.doc-title}"/>
        <property name="javadoc.spec.doc-title" value="${product.title} Specification-only API Documentation"/>
        <property name="javadoc.spec.win-title" value="${javadoc.spec.doc-title}"/>
        <property name="javadoc.source" value="5" />

        <path id="javadoc.sourcepath">
            <pathelement path="${src.dir}"/>
        </path>
        <path id="javadoc.classpath" >
            <path refid="compile.classpath"/>
        </path>
    </target>

    <target name="doc-init" depends="-doc-settings" >
        <copy todir="${doc.dir}">
            <fileset dir="${src-doc.dir}/static" />
        </copy>
    </target>

    <target name="javadoc-api" depends="-doc-settings"
            description="Generate api javadoc documentation" >
        <delete dir="${doc.api.dir}" quiet="true"/>
        <mkdir  dir="${doc.api.dir}"/>
        <javadoc author="true"
			 breakiterator="yes"
			 destdir="${doc.api.dir}"
			 doctitle="${javadoc.doc-title}"
			 linkoffline="${jdk.doc.url} ${jdk.packages}"
			 serialwarn="${verbose}"
                         verbose="${verbose}"
			 source="${javadoc.source}"
			 use="true"
			 version="true"
			 windowtitle="${javadoc.win-title}">
            <tag name="com.sun.jini.impl"
			     enabled="true"
			     scope="packages,types"
			     description="Implementation Specifics:"/>
            <bottom><![CDATA[${api.copyright}]]></bottom>

            <classpath refid="javadoc.classpath" />
            <sourcepath refid="javadoc.sourcepath" />

            <fileset dir="${src.dir}" includes="com/sun/jini/mahalo/MahaloPermission.java"/>
            <package name="com.sun.jini.admin"/>
            <package name="com.sun.jini.config"/>
            <package name="com.sun.jini.discovery"/>
            <package name="com.sun.jini.discovery.kerberos"/>
            <package name="com.sun.jini.discovery.plaintext"/>
            <package name="com.sun.jini.discovery.ssl"/>
            <package name="com.sun.jini.discovery.x500.sha1withdsa"/>
            <package name="com.sun.jini.discovery.x500.sha1withrsa"/>
            <package name="com.sun.jini.example.browser"/>
            <package name="com.sun.jini.fiddler"/>
            <package name="com.sun.jini.landlord"/>
            <package name="com.sun.jini.lease"/>
            <package name="com.sun.jini.logging"/>
            <package name="com.sun.jini.lookup.entry"/>
            <package name="com.sun.jini.mercury"/>
            <package name="com.sun.jini.norm"/>
            <package name="com.sun.jini.outrigger"/>
            <package name="com.sun.jini.outrigger.snaplogstore"/>
            <package name="com.sun.jini.phoenix"/>
            <package name="com.sun.jini.proxy"/>
            <package name="com.sun.jini.reggie"/>
            <package name="com.sun.jini.reliableLog"/>
            <package name="com.sun.jini.resource"/>
            <package name="com.sun.jini.start"/>
            <package name="com.sun.jini.thread"/>
            <package name="com.sun.jini.tool"/>
            <package name="com.sun.jini.tool.envcheck"/>
            <package name="com.sun.jini.tool.classdepend"/>
            <package name="net.jini.activation"/>
            <package name="net.jini.admin"/>
            <package name="net.jini.config"/>
            <package name="net.jini.constraint"/>
            <package name="net.jini.core.constraint"/>
            <package name="net.jini.core.discovery"/>
            <package name="net.jini.core.entry"/>
            <package name="net.jini.core.event"/>
            <package name="net.jini.core.lease"/>
            <package name="net.jini.core.lookup"/>
            <package name="net.jini.core.transaction"/>
            <package name="net.jini.core.transaction.server"/>
            <package name="net.jini.discovery"/>
            <package name="net.jini.entry"/>
            <package name="net.jini.event"/>
            <package name="net.jini.export"/>
            <package name="net.jini.id"/>
            <package name="net.jini.iiop"/>
            <package name="net.jini.io"/>
            <package name="net.jini.io.context"/>
            <package name="net.jini.jeri"/>
            <package name="net.jini.jeri.connection"/>
            <package name="net.jini.jeri.http"/>
            <package name="net.jini.jeri.kerberos"/>
            <package name="net.jini.jeri.ssl"/>
            <package name="net.jini.jeri.tcp"/>
            <package name="net.jini.jrmp"/>
            <package name="net.jini.lease"/>
            <package name="net.jini.loader"/>
            <package name="net.jini.loader.pref"/>
            <package name="net.jini.lookup"/>
            <package name="net.jini.lookup.entry"/>
            <package name="net.jini.security"/>
            <package name="net.jini.security.policy"/>
            <package name="net.jini.security.proxytrust"/>
            <package name="net.jini.space"/>
            <package name="net.jini.url.file"/>
            <package name="net.jini.url.httpmd"/>
            <package name="net.jini.url.https"/>
        </javadoc>
        <mkdir dir="${doc.api.dir}/doc-files"/>
        <copy file="NOTICE" tofile="${doc.api.dir}/doc-files/NOTICE"/>
    </target>

    <target name="javadoc-internals" depends="-doc-settings" description="produces javadoc directory including privates">
        <property name="doc.internals.dir" value="${doc}/internals" />
        <delete dir="${doc.internals.dir}" quiet="true"/>
        <mkdir  dir="${doc.internals.dir}"/>
        <javadoc author="true"
			 breakiterator="yes"
			 destdir="${doc.internals.dir}"
			 doctitle="${javadoc.doc-title} (internals)"
			 linkoffline="${jdk.doc.url} ${jdk.packages}"
			 serialwarn="${verbose}"
                         verbose="${verbose}"
                         private="true"
			 source="${javadoc.source}"
			 use="true"
			 version="true"
			 windowtitle="${javadoc.win-title} (internals)">
            <tag name="com.sun.jini.impl"
			     enabled="true"
			     scope="packages,types"
			     description="Implementation Specifics:"/>
            <bottom><![CDATA[${api.copyright}]]></bottom>
            <classpath refid="javadoc.classpath" />
            <sourcepath refid="javadoc.sourcepath" />
        </javadoc>
        <mkdir dir="${doc.internals.dir}/doc-files"/>
        <copy file="NOTICE" tofile="${doc.internals.dir}/doc-files/NOTICE"/>
    </target>

    <target name="javadoc-spec" depends="-doc-settings"
		description="Generates specification-only javadoc documentation"
		>
        <delete dir="${doc.spec.api.dir}" quiet="true"/>
        <mkdir  dir="${doc.spec.api.dir}"/>
        <javadoc author="true"
			 breakiterator="yes"
			 destdir="${doc.spec.api.dir}"
			 doctitle="${javadoc.spec.doc-title}"
			 linkoffline="${jdk.doc.url} ${jdk.packages}"
			 serialwarn="${verbose}"
                         verbose="${verbose}"
			 source="${javadoc.source}"
			 use="true"
			 version="true"
			 windowtitle="${javadoc.spec.win-title}">
            <tag name="com.sun.jini.impl"
			     enabled="false"
			     description="ignore"/>
            <classpath refid="javadoc.classpath"/>
            <sourcepath refid="javadoc.sourcepath" />

            <package name="net.jini.activation"/>
            <package name="net.jini.config"/>
            <package name="net.jini.constraint"/>
            <package name="net.jini.core.constraint"/>
            <package name="net.jini.core.discovery"/>
            <package name="net.jini.core.entry"/>
            <package name="net.jini.core.event"/>
            <package name="net.jini.core.lease"/>
            <package name="net.jini.core.lookup"/>
            <package name="net.jini.core.transaction"/>
            <package name="net.jini.core.transaction.server"/>
            <package name="net.jini.entry"/>
            <package name="net.jini.export"/>
            <package name="net.jini.id"/>
            <package name="net.jini.iiop"/>
            <package name="net.jini.io"/>
            <package name="net.jini.io.context"/>
            <package name="net.jini.jeri"/>
            <package name="net.jini.jeri.connection"/>
            <package name="net.jini.jeri.http"/>
            <package name="net.jini.jeri.kerberos"/>
            <package name="net.jini.jeri.ssl"/>
            <package name="net.jini.jeri.tcp"/>
            <package name="net.jini.jrmp"/>
            <package name="net.jini.loader"/>
            <package name="net.jini.loader.pref"/>
            <package name="net.jini.security"/>
            <package name="net.jini.security.policy"/>
            <package name="net.jini.security.proxytrust"/>
            <package name="net.jini.space"/>
            <package name="net.jini.url.file"/>
            <package name="net.jini.url.httpmd"/>
            <package name="net.jini.url.https"/>
        </javadoc>
        <mkdir dir="${doc.spec.api.dir}/doc-files"/>
        <copy file="NOTICE" tofile="${doc.spec.api.dir}/doc-files/NOTICE"/>
    </target>

    <!-- =========== ... ============ -->

    <target name="jars"	description="Generates JAR files"
		depends="river.jars,
            toolswrappers.jars,
            services.jars,
            extra.jar,
            browser.jars" />

    <target name="river.jars" depends="stubs,
            jini-core.jar,
			jini-ext.jar,
			jsk-dl.jar,
			jsk-lib.jar,
			jsk-resources.jar,
			jsk-platform.jar,
			jsk-policy.jar,
			sun-util.jar" />

    <target name="services.jars" depends="toolswrappers.jars,
            destroy.jar,
            fiddler.jar,
            fiddler-dl.jar,
            group.jar,
            group-dl.jar,
            mahalo.jar,
            mahalo-dl.jar,
            mercury.jar,
            mercury-dl.jar,
            norm.jar,
            norm-dl.jar,
            outrigger.jar,
            outrigger-dl.jar,
            outrigger-snaplogstore.jar,
            phoenix.jar,
            phoenix-dl.jar,
            phoenix-group.jar,
            phoenix-init.jar,
            reggie.jar,
            reggie-dl.jar,
            sdm-dl.jar,
            serviceui.jar,
            sharedvm.jar,
            start.jar" />

    <target name="browser.jars" depends="services.jars,
            browser.jar,
            browser-dl.jar" />

    <target name="compile" description="Build classes" depends="copy-resources,copy-extlibs">
        <property name="river.source" value="5" />
        <property name="river.target" value="jsr14" />
        <javac-cmd source="${river.source}" target="${river.target}" source.dir="${src.dir}" dest.dir="${build.classes.dir}">
            <classpath refid="compile.classpath" />
        </javac-cmd>
    </target>

    <target name="copy-extlibs" >
        <copy todir="lib">
            <fileset refid="asm.jars"/>
        </copy>
    </target>

    <target name="install-policy"
		description="Installs jsk-policy.jar into the JRE extensions directory.">
        <copy file="${lib-ext.dir}/jsk-policy.jar" todir="${jre.ext.dir}"/>
    </target>
    
    <target name="uninstall-policy"
		description="Removes jsk-policy.jar from the JRE extensions directory.">
        <delete file="${jre.ext.dir}/jsk-policy.jar"/>
    </target>

    <target name="stubs" description="Generate stubs"
		depends="compile, browser.stubs, fiddler.stubs, mahalo.stubs, 
            mercury.stubs, norm.stubs, outrigger.stubs, phoenix.stubs,
            reggie.stubs, sdm.stubs, start.stubs">
    </target>

    <target name="clean" depends="clean-dist, clean-jars, doc-clean"
		description="Removes all files and dirs created by the build">
        <delete dir="${build.dir}" quiet="true"/>
        <delete dir="${configentry.dir}" quiet="true"/>
    </target>

    <target name="clean-dist"
		description="Deletes the distribution directory.">
        <delete dir="${dist.dir}" quiet="true"/>
    </target>

    <target name="clean-jars"
		description="Deletes the lib, lib-dl, and lib-ext directories.">
        <delete dir="${lib.dir}" quiet="true" />
        <delete dir="${lib-dl.dir}"	quiet="true"/>
        <delete dir="${lib-ext.dir}" quiet="true"/>
    </target>

    <target name="toolswrappers.jars" description="Generate tools JARS"
		depends="tools.jar,
             jarwrapper.jar,
			 checkconfigurationfile.jar,
			 checkser.jar,
			 classdep.jar,
			 classserver.jar,
			 computedigest.jar,
			 computehttpmdcodebase.jar,
			 jsk-debug-policy.jar,
			 preferredlistgen.jar,
			 envcheck.jar">
    </target>

    <target name="checkconfigurationfile.jar"
		depends="jarwrapper.jar">
        <delete file="${lib.dir}/checkconfigurationfile.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/checkconfigurationfile.mf"/>
            <arg path="${lib.dir}/checkconfigurationfile.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="checkser.jar"	depends="jarwrapper.jar">
        <delete file="${lib.dir}/checkser.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/checkser.mf"/>
            <arg path="${lib.dir}/checkser.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="classdep.jar"	depends="jarwrapper.jar">
        <delete file="${lib.dir}/classdep.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/classdep.mf"/>
            <arg path="${lib.dir}/classdep.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="classserver.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/classserver.jar" quiet="true"/>
        <jarwrapper>
            <arg path="${lib.dir}/classserver.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="computedigest.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/computedigest.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/computedigest.mf"/>
            <arg path="${lib.dir}/computedigest.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="computehttpmdcodebase.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/computehttpmdcodebase.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/computehttpmdcodebase.mf"/>
            <arg path="${lib.dir}/computehttpmdcodebase.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="jarwrapper.jar" depends="tools.jar">
        <delete file="${lib.dir}/jarwrapper.jar" quiet="true"/>
        <jarwrapper classpathref="jarwrapper.classes.classpath">
            <arg value="-manifest=${src.manifest.dir}/jarwrapper.mf"/>
            <arg path="${lib.dir}/jarwrapper.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="preferredlistgen.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/preferredlistgen.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/preferredlistgen.mf"/>
            <arg path="${lib.dir}/preferredlistgen.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="envcheck.jar"	depends="jarwrapper.jar">
        <delete file="${lib.dir}/envcheck.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/envcheck.mf"/>
            <arg path="${lib.dir}/envcheck.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
        <jar destfile="${lib.dir}/envcheck.jar"
	       update="true"
	       index="false">
            <fileset dir="${src.manifest.dir}/tools"
		      includes="META-INF/services/com.sun.jini.tool.envcheck.Plugin"/>
        </jar>
    </target>

    <target name="extra.jar" depends="compile" >
        <!-- hooks for extra.jar build (RIVER-359) -->
        
        <!-- move to sep compile.extra target or add to compile target? -->
        <javac-cmd source.dir="${src-extra.dir}" dest.dir="${build.classes.dir}">
        </javac-cmd>
        <javac-cmd source.dir="${src}/org/apache/river/config" dest.dir="${build.classes.dir}">
        </javac-cmd>
        <jar destfile="${lib.dir}/extra.jar" index="false">
            <fileset dir="${build.classes.dir}">
                <include name="org/apache/river/extra/**"/>
                <include name="org/apache/river/config/**"/>
            </fileset>
        </jar>
    </target>
    
    <!--
        Deprecated since 2.1 - Scheduled for removal (RIVER-365)
    -->
    <target name="jini-core.jar" depends="stubs">
        <jar destfile="${lib.dir}/jini-core.jar" index="false">
            <fileset dir="${build.classes.dir}"
			 includes="net/jini/core/**"/>
        </jar>
    </target>

    <!--
        Deprecated since 2.1 - Scheduled for removal (RIVER-365)
    -->
    <target name="jini-ext.jar" depends="stubs">
        <property name="jini-ext.deps" location="${build.deps.dir}/jini-ext.deps"/>
        <classdep output="${jini-ext.deps}"
                classpathref="classdep.classes.classpath">
            <arg value="-cp"/>
            <arg path="${build.classes.dir}"/>
            <arg value="-files"/>
            <arg line="-in com.sun.jini"/>
            <arg line="-in net.jini"/><commit_msg>added velocity<commit_after><?xml version="1.0" encoding="UTF-8"?>
<!--
 ! Licensed to the Apache Software Foundation (ASF) under one
 ! or more contributor license agreements.  See the NOTICE file
 ! distributed with this work for additional information
 ! regarding copyright ownership. The ASF licenses this file
 ! to you 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.
 !-->

<!-- ################################################################## -->
<!-- ##                                                                 -->
<!-- ## Building Apache River                                           -->
<!-- ## _____________________                                           -->
<!-- ##                                                                 -->
<!-- ## Refer to doc/build.html to obtain detailed instructions for     -->
<!-- ##	building the Apache River source distribution.                  -->
<!-- ##                                                                 -->
<!-- ################################################################## -->
<project name="river" basedir="." default="all.build"
        xmlns:artifact="antlib:org.apache.maven.artifact.ant">

    <description>Apache River is a project furthering the development
        and advancement of Jini technology.</description>
        
    <!-- import common settings and macros -->
    <import file="common.xml"/>
    
    <!-- Distribution settings -->
    <property name="bin.tar.bundle" location="${dist}/${product.name}-bin.tar.gz"/>
    <property name="bin.zip.bundle" location="${dist}/${product.name}-bin.zip"/>
    <property name="src.tar.bundle" location="${dist}/${product.name}-src.tar.gz"/>
    <property name="src.zip.bundle" location="${dist}/${product.name}-src.zip"/>
    <property name="doc.tar.bundle" location="${dist}/${product.name}-doc.tar.gz"/>
    <property name="doc.zip.bundle" location="${dist}/${product.name}-doc.zip"/>

    <target name="hudson-ci" description="hudson build target" depends="diagnostics,hudson-ci-settings,all.clean,release,test,javadoc-internals" />

    <target name="hudson-ci-settings" description="provide default settings" >
        <echoproperties />
    </target>

    <target name="hudson-qa" description="hudson QA build target" depends="diagnostics,hudson-qa-settings,all.clean,qa.run" />


    <target name="hudson-qa-settings" description="provide default settings" >
        <property name="harness.generateHtml" value="true" />
        <echoproperties />
    </target>

    <target name="river-runtime" description="results in complete river, without release archives"
        depends="configentry,jars"
    />

    <target name="build" description="for compatibility" depends="river-runtime,test,river-doc"/>

    <target name="copy-resources"
		description="Copies various resources directories to the classes dir."
		depends="start.copy-resources, tools.copy-resources">
    </target>

    <target name="release" description="Create source and binary release packages"
		depends="release-src, release-bin, release-doc">
    </target>

    <fileset id="river.bin.files" dir="${basedir}">
        <include name="DISCLAIMER"/>
        <include name="LICENSE"/>
        <include name="NOTICE"/>

        <include name="${lib}/**"/>
        <include name="${lib-dl}/**"/>
        <include name="${lib-ext}/**"/>
        <include name="${configentry}/**"/>
    </fileset>

    <fileset id="river.doc.files" dir="${basedir}">
        <include name="DISCLAIMER"/>
        <include name="LICENSE"/>
        <include name="NOTICE"/>

        <include name="${doc}/**"/>
        <exclude name="${doc}/release-notes/new.html"/>
    </fileset>

    <fileset id="examples.bin.files" dir="${basedir}/examples">
        <include name="**/${lib}/**"/>
        <include name="**/config/**"/>
        <exclude name="**/config/META-INF/"/>
        <include name="**/prebuiltkeys/**"/>
        <include name="**/scripts/*.bat"/>
        <include name="**/${doc}/**"/>
        <include name="**/*.html"/>
    </fileset>
    
    <fileset id="examples.bin.exec.files" dir="${basedir}/examples">
        <include name="**/scripts/*.sh"/>
    </fileset>

    <!-- TODO create separate bin distribution for the qa tests? -->
    <!--<fileset id="qa.bin.files" dir="${basedir}/qa">
        <include name="${lib}/**"/>
        <include name="${lib-ext}/**"/>
        <include name="${doc}/**"/>
        <include name="harness/**"/>
        <include name="README.txt"/>
    </fileset>-->

    <target name="release-bin" description="Create a binary release" depends="all.build">
        <!-- TODO: add depends: javadoc-internals and remove from ci-build -->

        <mkdir dir="${dist.dir}"/>
        <delete file="${bin.zip.bundle}"/>
        <zip destfile="${bin.zip.bundle}" roundup="yes">
            <zipfileset prefix="${product.name}" refid="river.bin.files" />
            <zipfileset prefix="${product.name}/examples" refid="examples.bin.files" />
            <zipfileset prefix="${product.name}/examples" refid="examples.bin.exec.files" filemode="755"/>
            <!--<zipfileset prefix="${product.name}/qa" refid="qa.bin.files" />-->
        </zip>
        <delete file="${bin.tar.bundle}"/>
        <tar destfile="${bin.tar.bundle}" compression="gzip" longfile="gnu">
            <tarfileset prefix="${product.name}" refid="river.bin.files" />
            <tarfileset prefix="${product.name}/examples" refid="examples.bin.files" />
            <tarfileset prefix="${product.name}/examples" refid="examples.bin.exec.files" filemode="755"/>
            <!--<tarfileset prefix="${product.name}/qa" refid="qa.bin.files" />-->
        </tar>
    </target>

    <fileset id="river.src.files" dir="${basedir}">
        <include name="**" />
        <exclude name="${build}/**"/>
        <exclude name="${configentry}/**"/>
        <exclude name="${dist}/**"/>
        <exclude name="${doc}/**"/>
        <exclude name="${lib}/**"/>
        <exclude name="${lib-dl}/**"/>
        <exclude name="${lib-ext}/**"/>
        <!-- TODO: remove when archive building is pure river.src.files based -->
        <exclude name="qa/**"/>

        <exclude name="${test}/classes/**" />
        <exclude name="${test}/results/**" />

        <!--
        TODO: why were these excluded from the source archive?
        <exclude name="${doc}/release-notes/new.html"/>
        <exclude name="${src}/**/*.sh"/>
        -->

    </fileset>

    <fileset id="examples.src.files" dir="${basedir}/examples">
        <include name="**"/>
        <exclude name="**/${lib}/"/>
        <exclude name="**/${build}/"/>
        <exclude name="**/prebuiltkeys/"/>
        <exclude name="**/${doc}/"/>
    </fileset>

    <fileset id="examples.src.exec.files" dir="${basedir}/examples">
        <include name="**/scripts/*.sh"/>
    </fileset>

    <fileset id="qa.src.files" dir="${basedir}/qa">
        <include name="${src}/**"/>
        <include name="harness/**"/>
        <include name="jtreg/**"/>
        <exclude name="jtreg/JT*"/>
        <include name="${doc}/**"/>
        <exclude name="${doc.api}/"/>
        <include name="build.xml"/>
        <include name="README*.txt"/>
    </fileset>

    <target name="release-doc" description="Create release doc archives" depends="river-doc">
                
        <mkdir dir="${dist.dir}"/>
        <delete file="${doc.zip.bundle}"/>
        <zip destfile="${doc.zip.bundle}" roundup="yes">
            <zipfileset prefix="${product.name}" refid="river.doc.files"/>
        </zip>
        <delete file="${doc.tar.bundle}"/>
        <tar destfile="${doc.tar.bundle}" compression="gzip" longfile="gnu">
            <tarfileset prefix="${product.name}" refid="river.doc.files" />
        </tar>
    </target>

    <target name="release-src" description="Create a source release">
        <mkdir dir="${dist.dir}"/>
        <delete file="${src.zip.bundle}"/>
        <zip destfile="${src.zip.bundle}" roundup="yes">
            <zipfileset prefix="${product.name}" refid="river.src.files"/>
            <zipfileset prefix="${product.name}/examples" refid="examples.src.files"/>
            <zipfileset prefix="${product.name}/examples"
                    refid="examples.src.exec.files" filemode="755"/>
            <zipfileset prefix="${product.name}/qa" refid="qa.src.files" />
        </zip>
        <delete file="${src.tar.bundle}"/>
        <tar destfile="${src.tar.bundle}" compression="gzip" longfile="gnu">
            <tarfileset prefix="${product.name}" refid="river.src.files" />
            <tarfileset prefix="${product.name}/examples"
                    refid="examples.src.files" />
            <tarfileset prefix="${product.name}/examples"
                    refid="examples.src.exec.files" filemode="755"/>
            <tarfileset prefix="${product.name}/qa" refid="qa.src.files" />
        </tar>
    </target>

    <target name="prep" depends="deps" 
            description="Create build directory structure">
        <mkdir dir="${build.dir}"/>
        <mkdir dir="${build.classes.dir}"/>
        <mkdir dir="${build.deps.dir}"/>
        <mkdir dir="${configentry.dir}"/>
        <mkdir dir="${lib-dl.dir}"/>
        <mkdir dir="${lib-ext.dir}"/>
    </target>

    <target name="deps" description="Verify build dependencies">
        <!-- verify JDK version	-->
        <condition property="unsupported.jdk">
            <or>
                <equals arg1="${ant.java.version}" arg2="1.1"/>
                <equals arg1="${ant.java.version}" arg2="1.2"/>
                <equals arg1="${ant.java.version}" arg2="1.3"/>
            </or>
        </condition>
        <fail if="unsupported.jdk">Building ${product.name} requires Java 2 SDK 1.4 or greater.</fail>
    </target>

    <!-- =========== documentation related ============ -->

    <target name="river-doc" depends="doc-init,javadoc-api,javadoc-spec,javadoc-internals" />

    <target name="doc-clean" depends="-doc-settings" >
        <delete dir="${doc.dir}" quiet="true"/>
    </target>

    <target name="-doc-settings" description="set javadoc options">
        
        <property name="javadoc.doc-title" value="${product.title} API Documentation"/>
        <property name="javadoc.win-title" value="${javadoc.doc-title}"/>
        <property name="javadoc.spec.doc-title" value="${product.title} Specification-only API Documentation"/>
        <property name="javadoc.spec.win-title" value="${javadoc.spec.doc-title}"/>
        <property name="javadoc.source" value="5" />

        <path id="javadoc.sourcepath">
            <pathelement path="${src.dir}"/>
        </path>
        <path id="javadoc.classpath" >
            <path refid="compile.classpath"/>
        </path>
    </target>

    <target name="doc-init" depends="-doc-settings" >
        <copy todir="${doc.dir}">
            <fileset dir="${src-doc.dir}/static" />
        </copy>
    </target>

    <target name="javadoc-api" depends="-doc-settings"
            description="Generate api javadoc documentation" >
        <delete dir="${doc.api.dir}" quiet="true"/>
        <mkdir  dir="${doc.api.dir}"/>
        <javadoc author="true"
			 breakiterator="yes"
			 destdir="${doc.api.dir}"
			 doctitle="${javadoc.doc-title}"
			 linkoffline="${jdk.doc.url} ${jdk.packages}"
			 serialwarn="${verbose}"
                         verbose="${verbose}"
			 source="${javadoc.source}"
			 use="true"
			 version="true"
			 windowtitle="${javadoc.win-title}">
            <tag name="com.sun.jini.impl"
			     enabled="true"
			     scope="packages,types"
			     description="Implementation Specifics:"/>
            <bottom><![CDATA[${api.copyright}]]></bottom>

            <classpath refid="javadoc.classpath" />
            <sourcepath refid="javadoc.sourcepath" />

            <fileset dir="${src.dir}" includes="com/sun/jini/mahalo/MahaloPermission.java"/>
            <package name="com.sun.jini.admin"/>
            <package name="com.sun.jini.config"/>
            <package name="com.sun.jini.discovery"/>
            <package name="com.sun.jini.discovery.kerberos"/>
            <package name="com.sun.jini.discovery.plaintext"/>
            <package name="com.sun.jini.discovery.ssl"/>
            <package name="com.sun.jini.discovery.x500.sha1withdsa"/>
            <package name="com.sun.jini.discovery.x500.sha1withrsa"/>
            <package name="com.sun.jini.example.browser"/>
            <package name="com.sun.jini.fiddler"/>
            <package name="com.sun.jini.landlord"/>
            <package name="com.sun.jini.lease"/>
            <package name="com.sun.jini.logging"/>
            <package name="com.sun.jini.lookup.entry"/>
            <package name="com.sun.jini.mercury"/>
            <package name="com.sun.jini.norm"/>
            <package name="com.sun.jini.outrigger"/>
            <package name="com.sun.jini.outrigger.snaplogstore"/>
            <package name="com.sun.jini.phoenix"/>
            <package name="com.sun.jini.proxy"/>
            <package name="com.sun.jini.reggie"/>
            <package name="com.sun.jini.reliableLog"/>
            <package name="com.sun.jini.resource"/>
            <package name="com.sun.jini.start"/>
            <package name="com.sun.jini.thread"/>
            <package name="com.sun.jini.tool"/>
            <package name="com.sun.jini.tool.envcheck"/>
            <package name="com.sun.jini.tool.classdepend"/>
            <package name="net.jini.activation"/>
            <package name="net.jini.admin"/>
            <package name="net.jini.config"/>
            <package name="net.jini.constraint"/>
            <package name="net.jini.core.constraint"/>
            <package name="net.jini.core.discovery"/>
            <package name="net.jini.core.entry"/>
            <package name="net.jini.core.event"/>
            <package name="net.jini.core.lease"/>
            <package name="net.jini.core.lookup"/>
            <package name="net.jini.core.transaction"/>
            <package name="net.jini.core.transaction.server"/>
            <package name="net.jini.discovery"/>
            <package name="net.jini.entry"/>
            <package name="net.jini.event"/>
            <package name="net.jini.export"/>
            <package name="net.jini.id"/>
            <package name="net.jini.iiop"/>
            <package name="net.jini.io"/>
            <package name="net.jini.io.context"/>
            <package name="net.jini.jeri"/>
            <package name="net.jini.jeri.connection"/>
            <package name="net.jini.jeri.http"/>
            <package name="net.jini.jeri.kerberos"/>
            <package name="net.jini.jeri.ssl"/>
            <package name="net.jini.jeri.tcp"/>
            <package name="net.jini.jrmp"/>
            <package name="net.jini.lease"/>
            <package name="net.jini.loader"/>
            <package name="net.jini.loader.pref"/>
            <package name="net.jini.lookup"/>
            <package name="net.jini.lookup.entry"/>
            <package name="net.jini.security"/>
            <package name="net.jini.security.policy"/>
            <package name="net.jini.security.proxytrust"/>
            <package name="net.jini.space"/>
            <package name="net.jini.url.file"/>
            <package name="net.jini.url.httpmd"/>
            <package name="net.jini.url.https"/>
        </javadoc>
        <mkdir dir="${doc.api.dir}/doc-files"/>
        <copy file="NOTICE" tofile="${doc.api.dir}/doc-files/NOTICE"/>
    </target>

    <target name="javadoc-internals" depends="-doc-settings" description="produces javadoc directory including privates">
        <property name="doc.internals.dir" value="${doc}/internals" />
        <delete dir="${doc.internals.dir}" quiet="true"/>
        <mkdir  dir="${doc.internals.dir}"/>
        <javadoc author="true"
			 breakiterator="yes"
			 destdir="${doc.internals.dir}"
			 doctitle="${javadoc.doc-title} (internals)"
			 linkoffline="${jdk.doc.url} ${jdk.packages}"
			 serialwarn="${verbose}"
                         verbose="${verbose}"
                         private="true"
			 source="${javadoc.source}"
			 use="true"
			 version="true"
			 windowtitle="${javadoc.win-title} (internals)">
            <tag name="com.sun.jini.impl"
			     enabled="true"
			     scope="packages,types"
			     description="Implementation Specifics:"/>
            <bottom><![CDATA[${api.copyright}]]></bottom>
            <classpath refid="javadoc.classpath" />
            <sourcepath refid="javadoc.sourcepath" />
        </javadoc>
        <mkdir dir="${doc.internals.dir}/doc-files"/>
        <copy file="NOTICE" tofile="${doc.internals.dir}/doc-files/NOTICE"/>
    </target>

    <target name="javadoc-spec" depends="-doc-settings"
		description="Generates specification-only javadoc documentation"
		>
        <delete dir="${doc.spec.api.dir}" quiet="true"/>
        <mkdir  dir="${doc.spec.api.dir}"/>
        <javadoc author="true"
			 breakiterator="yes"
			 destdir="${doc.spec.api.dir}"
			 doctitle="${javadoc.spec.doc-title}"
			 linkoffline="${jdk.doc.url} ${jdk.packages}"
			 serialwarn="${verbose}"
                         verbose="${verbose}"
			 source="${javadoc.source}"
			 use="true"
			 version="true"
			 windowtitle="${javadoc.spec.win-title}">
            <tag name="com.sun.jini.impl"
			     enabled="false"
			     description="ignore"/>
            <classpath refid="javadoc.classpath"/>
            <sourcepath refid="javadoc.sourcepath" />

            <package name="net.jini.activation"/>
            <package name="net.jini.config"/>
            <package name="net.jini.constraint"/>
            <package name="net.jini.core.constraint"/>
            <package name="net.jini.core.discovery"/>
            <package name="net.jini.core.entry"/>
            <package name="net.jini.core.event"/>
            <package name="net.jini.core.lease"/>
            <package name="net.jini.core.lookup"/>
            <package name="net.jini.core.transaction"/>
            <package name="net.jini.core.transaction.server"/>
            <package name="net.jini.entry"/>
            <package name="net.jini.export"/>
            <package name="net.jini.id"/>
            <package name="net.jini.iiop"/>
            <package name="net.jini.io"/>
            <package name="net.jini.io.context"/>
            <package name="net.jini.jeri"/>
            <package name="net.jini.jeri.connection"/>
            <package name="net.jini.jeri.http"/>
            <package name="net.jini.jeri.kerberos"/>
            <package name="net.jini.jeri.ssl"/>
            <package name="net.jini.jeri.tcp"/>
            <package name="net.jini.jrmp"/>
            <package name="net.jini.loader"/>
            <package name="net.jini.loader.pref"/>
            <package name="net.jini.security"/>
            <package name="net.jini.security.policy"/>
            <package name="net.jini.security.proxytrust"/>
            <package name="net.jini.space"/>
            <package name="net.jini.url.file"/>
            <package name="net.jini.url.httpmd"/>
            <package name="net.jini.url.https"/>
        </javadoc>
        <mkdir dir="${doc.spec.api.dir}/doc-files"/>
        <copy file="NOTICE" tofile="${doc.spec.api.dir}/doc-files/NOTICE"/>
    </target>

    <!-- =========== ... ============ -->

    <target name="jars"	description="Generates JAR files"
		depends="river.jars,
            toolswrappers.jars,
            services.jars,
            extra.jar,
            browser.jars" />

    <target name="river.jars" depends="stubs,
            jini-core.jar,
			jini-ext.jar,
			jsk-dl.jar,
			jsk-lib.jar,
			jsk-resources.jar,
			jsk-platform.jar,
			jsk-policy.jar,
			sun-util.jar" />

    <target name="services.jars" depends="toolswrappers.jars,
            destroy.jar,
            fiddler.jar,
            fiddler-dl.jar,
            group.jar,
            group-dl.jar,
            mahalo.jar,
            mahalo-dl.jar,
            mercury.jar,
            mercury-dl.jar,
            norm.jar,
            norm-dl.jar,
            outrigger.jar,
            outrigger-dl.jar,
            outrigger-snaplogstore.jar,
            phoenix.jar,
            phoenix-dl.jar,
            phoenix-group.jar,
            phoenix-init.jar,
            reggie.jar,
            reggie-dl.jar,
            sdm-dl.jar,
            serviceui.jar,
            sharedvm.jar,
            start.jar" />

    <target name="browser.jars" depends="services.jars,
            browser.jar,
            browser-dl.jar" />

    <target name="compile" description="Build classes" depends="copy-resources,copy-extlibs">
        <property name="river.source" value="5" />
        <property name="river.target" value="jsr14" />
        <javac-cmd source="${river.source}" target="${river.target}" source.dir="${src.dir}" dest.dir="${build.classes.dir}">
            <classpath refid="compile.classpath" />
        </javac-cmd>
    </target>

    <target name="copy-extlibs" >
        <copy todir="lib">
            <fileset refid="asm.jars"/>
        </copy>
    </target>

    <target name="install-policy"
		description="Installs jsk-policy.jar into the JRE extensions directory.">
        <copy file="${lib-ext.dir}/jsk-policy.jar" todir="${jre.ext.dir}"/>
    </target>
    
    <target name="uninstall-policy"
		description="Removes jsk-policy.jar from the JRE extensions directory.">
        <delete file="${jre.ext.dir}/jsk-policy.jar"/>
    </target>

    <target name="stubs" description="Generate stubs"
		depends="compile, browser.stubs, fiddler.stubs, mahalo.stubs, 
            mercury.stubs, norm.stubs, outrigger.stubs, phoenix.stubs,
            reggie.stubs, sdm.stubs, start.stubs">
    </target>

    <target name="clean" depends="clean-dist, clean-jars, doc-clean"
		description="Removes all files and dirs created by the build">
        <delete dir="${build.dir}" quiet="true"/>
        <delete dir="${configentry.dir}" quiet="true"/>
    </target>

    <target name="clean-dist"
		description="Deletes the distribution directory.">
        <delete dir="${dist.dir}" quiet="true"/>
    </target>

    <target name="clean-jars"
		description="Deletes the lib, lib-dl, and lib-ext directories.">
        <delete dir="${lib.dir}" quiet="true" />
        <delete dir="${lib-dl.dir}"	quiet="true"/>
        <delete dir="${lib-ext.dir}" quiet="true"/>
    </target>

    <target name="toolswrappers.jars" description="Generate tools JARS"
		depends="tools.jar,
             jarwrapper.jar,
			 checkconfigurationfile.jar,
			 checkser.jar,
			 classdep.jar,
			 classserver.jar,
			 computedigest.jar,
			 computehttpmdcodebase.jar,
			 jsk-debug-policy.jar,
			 preferredlistgen.jar,
			 envcheck.jar">
    </target>

    <target name="checkconfigurationfile.jar"
		depends="jarwrapper.jar">
        <delete file="${lib.dir}/checkconfigurationfile.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/checkconfigurationfile.mf"/>
            <arg path="${lib.dir}/checkconfigurationfile.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="checkser.jar"	depends="jarwrapper.jar">
        <delete file="${lib.dir}/checkser.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/checkser.mf"/>
            <arg path="${lib.dir}/checkser.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="classdep.jar"	depends="jarwrapper.jar">
        <delete file="${lib.dir}/classdep.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/classdep.mf"/>
            <arg path="${lib.dir}/classdep.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="classserver.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/classserver.jar" quiet="true"/>
        <jarwrapper>
            <arg path="${lib.dir}/classserver.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="computedigest.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/computedigest.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/computedigest.mf"/>
            <arg path="${lib.dir}/computedigest.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="computehttpmdcodebase.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/computehttpmdcodebase.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/computehttpmdcodebase.mf"/>
            <arg path="${lib.dir}/computehttpmdcodebase.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="jarwrapper.jar" depends="tools.jar">
        <delete file="${lib.dir}/jarwrapper.jar" quiet="true"/>
        <jarwrapper classpathref="jarwrapper.classes.classpath">
            <arg value="-manifest=${src.manifest.dir}/jarwrapper.mf"/>
            <arg path="${lib.dir}/jarwrapper.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="preferredlistgen.jar" depends="jarwrapper.jar">
        <delete file="${lib.dir}/preferredlistgen.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/preferredlistgen.mf"/>
            <arg path="${lib.dir}/preferredlistgen.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
    </target>

    <target name="envcheck.jar"	depends="jarwrapper.jar">
        <delete file="${lib.dir}/envcheck.jar" quiet="true"/>
        <jarwrapper>
            <arg value="-manifest=${src.manifest.dir}/envcheck.mf"/>
            <arg path="${lib.dir}/envcheck.jar"/>
            <arg path="${lib.dir}"/>
            <arg value="tools.jar"/>
        </jarwrapper>
        <jar destfile="${lib.dir}/envcheck.jar"
	       update="true"
	       index="false">
            <fileset dir="${src.manifest.dir}/tools"
		      includes="META-INF/services/com.sun.jini.tool.envcheck.Plugin"/>
        </jar>
    </target>

    <target name="extra.jar" depends="compile" >
        <!-- hooks for extra.jar build (RIVER-359) -->
        
        <!-- move to sep compile.extra target or add to compile target? -->
        <javac-cmd source.dir="${src-extra.dir}" dest.dir="${build.classes.dir}">
        </javac-cmd>
        <jar destfile="${lib.dir}/extra.jar" index="false">
            <fileset dir="${build.classes.dir}">
                <include name="org/apache/river/extra/**"/>
                <include name="org/apache/river/config/**"/>
            </fileset>
            <fileset dir="${src.dir}">
                <include name="org/apache/river/config/**/*.properties"/>
                <include name="org/apache/river/config/**/*.vm"/>
            </fileset>
        </jar>
    </target>
    
    <!--
        Deprecated since 2.1 - Scheduled for removal (RIVER-365)
    -->
    <target name="jini-core.jar" depends="stubs">
        <jar destfile="${lib.dir}/jini-core.jar" index="false">
            <fileset dir="${build.classes.dir}"
			 includes="net/jini/core/**"/>
        </jar>
    </target>

    <!--
        Deprecated since 2.1 - Scheduled for removal (RIVER-365)
    -->
    <target name="jini-ext.jar" depends="stubs">
        <property name="jini-ext.deps" location="${build.deps.dir}/jini-ext.deps"/>
        <classdep output="${jini-ext.deps}"
                classpathref="classdep.classes.classpath">
            <arg value="-cp"/>
            <arg path="${build.classes.dir}"/>
            <arg value="-files"/>
            <arg line="-in com.sun.jini"/>
            <arg line="-in net.jini"/>
{'fraction_non_alphanumeric': 0.1898669755361342, 'fraction_numerical': 0.002070829384717981, 'mean_word_length': 2.269998852289682, 'pattern_counts': {'":': 0, '<': 995, '<?xml version=': 2, '>': 995, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4835235', 'n_tokens_mistral': 17336, 'n_tokens_neox': 16459, 'n_words': 2857}