java-sdk/build.xml
author Landry Breuil <landry@openbsd.org>
Thu, 24 Jan 2013 14:39:48 +0100
changeset 37 2b72c62f545044b70c61e4c59a5285010154d591
parent 0 b29d2f870f0ea9b69123fc85c48d6d7f73304ec3
child 48 a34932a9856fccb005de1bc6f95e2160038ecd33
permissions -rw-r--r--
Bug 720373 followup : regen configure with autoconf after configure.in change. rs=standard8

<project name="Mozilla Java LDAP SDK" default="show" basedir=".">

<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
   -
   - The contents of this file are subject to the Mozilla Public License Version
   - 1.1 (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.mozilla.org/MPL/
   -
   - Software distributed under the License is distributed on an "AS IS" basis,
   - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
   - for the specific language governing rights and limitations under the
   - License.
   -
   - The Original Code is mozilla.org code.
   -
   - The Initial Developer of the Original Code is
   - Netscape Communications Corporation.
   - Portions created by the Initial Developer are Copyright (C) 1999
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -   Tony Dahbura (tony@dahbura.com) initial creation of ant build files
   -
   - Alternatively, the contents of this file may be used under the terms of
   - either the GNU General Public License Version 2 or later (the "GPL"), or
   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   - in which case the provisions of the GPL or the LGPL are applicable instead
   - of those above. If you wish to allow use of your version of this file only
   - under the terms of either the GPL or the LGPL, and not to allow others to
   - use your version of this file under the terms of the MPL, indicate your
   - decision by deleting the provisions above and replace them with the notice
   - and other provisions required by the GPL or the LGPL. If you do not delete
   - the provisions above, a recipient may use your version of this file under
   - the terms of any one of the MPL, the GPL or the LGPL.
   -
   - ***** END LICENSE BLOCK ***** -->


  <!-- ===================== Initialize Property Values =================== -->

    <property file="build.properties"/>

  <!-- Project Properties -->
    <property name="name"                value="java-sdk" />
    <property name="year"                value="2007" />
    <property name="version"             value="4.18" />
    <property name="sdkjarfilename"      value="ldapjdk.jar" />
    <property name="filtjarfilename"     value="ldapfilt.jar" />
    <property name="jdnijarfilename"     value="ldapsp.jar" />
    <property name="beansjarfilename"    value="ldapbeans.jar" />
    <property name="doczipfilename"      value="ldapdoc.zip" />


  <!-- Build Defaults -->
 
    <property name="jdk.dist"            value="${basedir}/dist/classes"/>
    <property name="filter.dist"         value="${basedir}/dist/ldapfilt"/>
    <property name="jndi.dist"           value="${basedir}/dist/classes"/>
    <property name="doc.dist"            value="${basedir}/dist/doc"/>
    <property name="package.dist"        value="${basedir}/dist/packages"/>
    <property name="src"                 value="."/>
    <property name="build"               value="build"/>
    <property name="dist"                value="dist"/>

    <!-- the following is to setup the correct info for sun jsse which
        is jdk dependent -->
    <property name="ssllibs14" value="${basedir}/ldapjdk/lib/jss32_stub.jar"/>
    <property name="ssllibs13" value="${basedir}/ldapjdk/lib/jaas.jar:${basedir}/ldapjdk/lib/jnet.jar:${basedir}/ldapjdk/lib/jsse.jar:${basedir}/ldapjdk/lib/jss32_stub.jar"/>

    <!-- we do not use the users existing classpath and instead build our own
         comment the following line out if this is not desired -->
    <property name="build.sysclasspath" value="ignore"/>

    <!-- the following target is the default target so show some help -->
    <target name="show">
        <echo>The following targets are defined:
   dist         : will build entire sdk and package all the pieces
   dist-jdk     : will build only the ldap jdk jar (ldapjdk.jar)
   dist-filter  : will build only the ldap filter jar (ldapfilt.jar)
   dist-beans   : will build only the beans jar (ldapbeans.jar)
   dist-jndi    : will build only the jndi service provider (ldapsp.jar)
   dist-docs    : will package up all the documentation (ldapdoc.zip)

   build        : will compile the entire sdk but not package
   build-jdk    : will compile only the ldap jdk jar
   build-filter : will compile only the filter classes
   build-beans  : will compile only the ldap beans
   build-jndi   : will compile only the jndi service provider
   build-docs   : will compile the complete javadocs

   clean        : will remove all compiled files and packages
   clean-dists  : will remove all the jars and zips
   clean-builds : will remove all the compiled classes
        </echo>
      </target>

    <target name="init">
        <echo>compiling for jdk version=${ant.java.version}</echo>
        <condition property="jsselibs" value="${ssllibs13}">
        <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>
        <condition property="jsselibs" value="${ssllibs14}">
        <not>
            <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>
        </not>
          </condition>
        <echo>ssl libraries path=${jsselibs}</echo>
        <!-- create dist directories in case a clean was executed -->
        <mkdir dir="${jdk.dist}"/>
        <mkdir dir="${filter.dist}"/>
        <mkdir dir="${jndi.dist}"/>
        <mkdir dir="${doc.dist}"/>
        <mkdir dir="${package.dist}"/>
    </target>

  <target name="dist" depends="dist-jdk,dist-filter,dist-beans,dist-jndi,dist-docs">
    <echo>Building all packages....</echo>
  </target>

  <target name="dist-jdk" depends="build-jdk">
    <!-- copy errors property files in to dist area for jarfile inclusion -->
    <mkdir dir="${jdk.dist}/netscape/ldap/errors"/>
    <copy todir="${jdk.dist}/netscape/ldap/errors">
      <fileset dir="${basedir}/ldapjdk/netscape/ldap/errors">
        <include name="*.props"/>
      </fileset>
    </copy>
    <jar jarfile="${package.dist}/${sdkjarfilename}"
         basedir="${jdk.dist}"
         excludes="cvs/**"
         includes="netscape/ldap/*.class,netscape/ldap/client/*.class,netscape/ldap/client/opers/*.class,netscape/ldap/ber/stream/*.class,netscape/ldap/controls/*.class,netscape/ldap/factory/*.class,netscape/ldap/util/*.class,netscape/ldap/errors/*.props,com/netscape/sasl/*.class,com/netscape/sasl/mechanisms/*.class,*.class" 
    />
  </target>

  <target name="dist-filter" depends="build-filter">
    <jar jarfile="${package.dist}/${filtjarfilename}"
         basedir="${filter.dist}"
         excludes="cvs/**"
         includes="netscape/ldap/util/*.class" 
    />
  </target>
  
  <target name="dist-beans" depends="build-beans">
    <jar jarfile="${package.dist}/${beansjarfilename}"
         basedir="${jdk.dist}"
         excludes="cvs/**"
         includes="netscape/ldap/beans/*" 
    />
  </target>

  <target name="dist-jndi" depends="build-jndi">
    <jar jarfile="${package.dist}/${jdnijarfilename}"
         basedir="${jdk.dist}"
         excludes="cvs/**"
         includes="com/netscape/jndi/ldap/*.class com/netscape/jndi/ldap/common/*.class com/netscape/jndi/ldap/schema/*.class com/netscape/jndi/ldap/controls/*.class"
    />
  </target>

  <target name="dist-docs" depends="build-docs">
    <jar jarfile="${package.dist}/${doczipfilename}"
         update="no"
         basedir="${doc.dist}"
         excludes="cvs/**"
         includes="*.html *.css netscape/ldap/*.html netscape/ldap/beans/*.html netscape/ldap/controls/*.html netscape/ldap/util/*.html netscape/ldap/ber/stream/*.html" 
    />
  </target>


<!-- The following targets do the builds (compiles of the source files) -->

    <target name="build" depends="build-jdk,build-filter,build-beans,build-jndi"/>

    <target name="build-jdk" depends="init">
        <!-- Compile the java jdk code from ${src} into ${dest} -->
        <javac srcdir="${basedir}/ldapjdk/com" destdir="${jdk.dist}"
            excludes="cvs/**"
            classpath="${jsselibs}"
        />
        <javac srcdir="${basedir}/ldapjdk/netscape" destdir="${jdk.dist}"
            excludes="cvs/**"
            classpath="${jsselibs}"
        />
        <javac srcdir="${basedir}/tools" destdir="${jdk.dist}"
            excludes="cvs/**"
            classpath="${jsselibs}"
        />
      </target>

    <target name="build-filter" depends="init,build-jdk">
        <javac srcdir="${basedir}/ldapfilter" destdir="${filter.dist}"
            excludes="cvs/**"
            classpath="${jdk.dist}:${jsselibs}"
        />
      </target>

    <target name="build-beans" depends="init">
        <!-- Compile the java jdk bean code from ${src} into ${dest} -->
        <javac srcdir="${basedir}/ldapbeans" destdir="${jdk.dist}"
            excludes="cvs/**"
            classpath="${jsselibs}"
        />
      </target>

    <target name="build-jndi" depends="init,build-jdk">
        <!-- Compile the java code from ${src} into ${dest} -->
        <javac srcdir="${basedir}/ldapsp" destdir="${jndi.dist}"
            excludes="cvs/**"
            classpath="${jsselibs}:${basedir}/ldapsp/lib/jndi.jar"
        />
      </target>

    <target name="build-docs">
        <!-- Create the javadocs for the sdk -->
        
        <javadoc 
                packagenames="netscape.ldap.*,netscape.ldap.beans.*,netscape.ldap.controls.*,netscape.ldap.util.*,netscape.ldap.factory.*,com.netscape.sasl.*,com.netscape.sasl.mechanisms.*,netscape.ldap.ber.stream.*"
                 sourcepath="${basedir}/ldapbeans:${basedir}/ldapjdk"
                 sourcefiles="${basedir}/tools/LDAPDelete.java,${basedir}/tools/LDAPModify.java,${basedir}/tools/LDAPSearch.java,${basedir}/tools/LDAPTool.java"
                 destdir="${doc.dist}"
                 author="true"
                 version="true"
                 use="true"
                 classpath="${basedir}/ldapjdk:${basedir}/ldapjdk/lib/jss32_stub.jar:${basedir}/ldapbeans" >
        </javadoc>

        <javadoc packagenames="com.netscape.jndi.ldap.controls.*"
                sourcepath="${basedir}/ldapsp"    
                destdir="${doc.dist}/ldapsp"
                classpath="${jndi.dist}:${basedir}/ldapsp:${basedir}/ldapsp/lib/jndi.jar"
                author="true"
                version="true"
                use="true">
        </javadoc>
      </target>

    <target name="clean" depends="clean-dists,clean-builds"/>

    <target name="clean-dists">
        <!-- Delete the jar and zip files -->
        <delete includeEmptyDirs="true">
            <fileset dir="${package.dist}" includes="*.jar *.zip" />
        </delete>
    </target>

    <target name="clean-builds">
        <!-- Delete the .class and javadoc files built up from builds -->
        <delete includeEmptyDirs="true">
            <fileset dir="${basedir}/dist" excludes="**/*.jar **/*.zip"/>
        </delete>
    </target>

</project>