<!--
|
! CDDL HEADER START
|
!
|
! The contents of this file are subject to the terms of the
|
! Common Development and Distribution License, Version 1.0 only
|
! (the "License"). You may not use this file except in compliance
|
! with the License.
|
!
|
! You can obtain a copy of the license at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE
|
! or https://OpenDS.dev.java.net/OpenDS.LICENSE.
|
! See the License for the specific language governing permissions
|
! and limitations under the License.
|
!
|
! When distributing Covered Code, include this CDDL HEADER in each
|
! file and include the License file at
|
! trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
|
! add the following below this CDDL HEADER, with the fields enclosed
|
! by brackets "[]" replaced with your own identifying information:
|
! Portions Copyright [yyyy] [name of copyright owner]
|
!
|
! CDDL HEADER END
|
!
|
!
|
! Copyright 2010 Sun Microsystems, Inc.
|
! -->
|
|
<project name="extension" basedir="." default="package">
|
<description>
|
This Ant build file contains common targets for extensions. It
|
should not be invoked directly.
|
</description>
|
|
<!-- OpenDS base directory -->
|
<dirname property="extension.basedir" file="${ant.file.extension}" />
|
<property name="base.dir" location="${extension.basedir}/.." />
|
<property name="opends.install.dir"
|
location="${base.dir}/build/package/OpenDS-2.3.0" />
|
|
<!-- Source paths relative to extension -->
|
<property name="src.dir" location="src" />
|
<property name="src.gen.dir" location="src-generated" />
|
<property name="lib.dir" location="lib" />
|
<property name="config.dir" location="config" />
|
<property name="schema.dir" location="schema" />
|
|
<!-- Build paths relative to extension -->
|
<property name="build.dir" location="build" />
|
<property name="classes.dir" location="${build.dir}/classes" />
|
<property name="javadoc.dir" location="${build.dir}/javadoc" />
|
<property name="package.dir" location="${build.dir}/package" />
|
<property name="message.dir" location="${build.dir}/message" />
|
|
<!-- Files based on extension name -->
|
<property name="jar.file" value="${extension.name}.jar" />
|
<property name="properties.file" value="${extension.name}.properties" />
|
|
<!-- Paths relative to OpenDS source tree -->
|
<property name="resource.dir" location="${base.dir}/resource" />
|
<property name="admin.dir" location="${resource.dir}/admin" />
|
|
<!-- Build class path -->
|
<path id="build.classpath">
|
<fileset dir="${lib.dir}">
|
<include name="*.jar" />
|
</fileset>
|
<pathelement path="${base.dir}/build/classes" />
|
</path>
|
|
<!-- Condition variable used for deciding if messages need generating -->
|
<available property="hasmessages" file="${properties.file}" type="file">
|
<filepath>
|
<dirset dir="${src.dir}" />
|
</filepath>
|
</available>
|
|
<!-- Clean up any files generated during the build process. -->
|
<target name="clean"
|
description="Clean up any files generated during the build process.">
|
<delete includeemptydirs="true">
|
<fileset dir="${src.gen.dir}" includes="**/*" />
|
</delete>
|
<delete includeemptydirs="true">
|
<fileset dir="${build.dir}" includes="**/*" />
|
</delete>
|
</target>
|
|
<!-- Compile the Directory Server extension source files. -->
|
<target name="compile"
|
depends="init,compileadmin,generate-messages"
|
description="Compile the Directory Server extension source files.">
|
<mkdir dir="${classes.dir}" />
|
<javac srcdir="${src.dir}:${src.gen.dir}"
|
destdir="${classes.dir}"
|
optimize="true"
|
excludes="**/package-info.java"
|
debug="on"
|
debuglevel="lines,source"
|
source="1.5"
|
target="1.5"
|
deprecation="true"
|
fork="true"
|
memoryInitialSize="${MEM}"
|
memoryMaximumSize="${MEM}">
|
<compilerarg value="-Xlint:all" />
|
<classpath refid="build.classpath" />
|
</javac>
|
</target>
|
|
<!-- Generate JavaDoc documentation from the source files. -->
|
<target name="javadoc"
|
depends="init,compile"
|
description="Generate JavaDoc documentation.">
|
<mkdir dir="${javadoc.dir}" />
|
<javadoc destdir="${javadoc.dir}"
|
source="1.5"
|
additionalparam="-quiet"
|
linksource="yes"
|
windowtitle="${extension.description} API Documentation"
|
maxmemory="${MEM}">
|
<classpath refid="build.classpath" />
|
<packageset dir="${src.dir}" />
|
<packageset dir="${src.gen.dir}" />
|
</javadoc>
|
</target>
|
|
<!-- Package the Directory Server extension for distribution. -->
|
<target name="package"
|
depends="clean,compile"
|
description="Package the Directory Server extension for distribution.">
|
<mkdir dir="${package.dir}" />
|
<jar jarfile="${package.dir}/${jar.file}"
|
basedir="${classes.dir}"
|
compress="true"
|
index="true" />
|
</target>
|
|
<!-- Install the Directory Server extension in an existing OpenDS installation. -->
|
<target name="install"
|
depends="package"
|
description="Install the Directory Server extension in an existing OpenDS installation.">
|
|
<echo message="Use the following Ant option to change the install location:" />
|
<echo message="" />
|
<echo message=" -Dopends.install.dir=path" />
|
<echo message=" The path of an OpenDS installation where the extension will be installed." />
|
<echo message=" Used by the install target [default: ${opends.install.dir}]." />
|
<echo message="" />
|
|
<mkdir dir="${opends.install.dir}/lib" />
|
<copy todir="${opends.install.dir}/lib">
|
<fileset file="${lib.dir}/*.jar" />
|
</copy>
|
<mkdir dir="${opends.install.dir}/lib/extensions" />
|
<copy todir="${opends.install.dir}/lib/extensions">
|
<fileset file="${package.dir}/*.jar" />
|
</copy>
|
<copy todir="${opends.install.dir}/config">
|
<fileset file="${config.dir}/*.ldif" />
|
</copy>
|
<copy todir="${opends.install.dir}/config/schema">
|
<fileset file="${schema.dir}/*.ldif" />
|
</copy>
|
</target>
|
|
<!-- Perform common initialization common to several targets. -->
|
<target name="init">
|
<tstamp>
|
<format property="timestamp" pattern="yyyyMMddHHmmss" />
|
</tstamp>
|
<condition property="DEBUG_BUILD" value="false">
|
<not>
|
<isset property="DEBUG_BUILD" />
|
</not>
|
</condition>
|
<condition property="MEM" value="128M">
|
<not>
|
<isset property="MEM" />
|
</not>
|
</condition>
|
</target>
|
|
<!-- Compile the Directory Server extension configuration definition files. -->
|
<target name="compileadmin" depends="validateadmin">
|
<!-- Copy XML definitions for this extension and core server into the same location -->
|
<tempfile property="admin.temp.dir" destDir="${classes.dir}" />
|
<mkdir dir="${admin.temp.dir}" />
|
|
<copy todir="${admin.temp.dir}">
|
<fileset dir="${src.dir}" includes="**/*.xml" />
|
<fileset dir="${base.dir}/src/admin/defn" includes="**/*.xml" />
|
</copy>
|
|
<!-- Compile the Directory Server extension configuration meta classes. -->
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${src.gen.dir}"
|
style="${admin.dir}/metaMO.xsl">
|
<include name="**/*Configuration.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)Configuration\.xml$$"
|
to="\1/meta/\2CfgDefn.java" />
|
<param name="base-dir" expression="${admin.temp.dir}" />
|
</xslt>
|
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${src.gen.dir}"
|
style="${admin.dir}/package-info.xsl">
|
<include name="**/Package.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)\.xml$$"
|
to="\1/meta/package-info.java" />
|
<param name="type" expression="meta" />
|
</xslt>
|
|
<!-- Compile the Directory Server extension configuration client classes. -->
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${src.gen.dir}"
|
style="${admin.dir}/clientMO.xsl">
|
<include name="**/*Configuration.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)Configuration\.xml$$"
|
to="\1/client/\2CfgClient.java" />
|
<param name="base-dir" expression="${admin.temp.dir}" />
|
</xslt>
|
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${src.gen.dir}"
|
style="${admin.dir}/package-info.xsl">
|
<include name="**/Package.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)\.xml$$"
|
to="\1/client/package-info.java" />
|
<param name="type" expression="client" />
|
</xslt>
|
|
<!-- Compile the Directory Server extension configuration server classes. -->
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${src.gen.dir}"
|
style="${admin.dir}/serverMO.xsl">
|
<include name="**/*Configuration.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)Configuration\.xml$$"
|
to="\1/server/\2Cfg.java" />
|
<param name="base-dir" expression="${admin.temp.dir}" />
|
</xslt>
|
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${src.gen.dir}"
|
style="${admin.dir}/package-info.xsl">
|
<include name="**/Package.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)\.xml$$"
|
to="\1/server/package-info.java" />
|
<param name="type" expression="server" />
|
</xslt>
|
|
<!-- Compile the Directory Server extension configuration ldap profile property files. -->
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${classes.dir}/admin/profiles/ldap"
|
style="${admin.dir}/ldapMOProfile.xsl">
|
<include name="**/*Configuration.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)Configuration\.xml$$"
|
to="\1/meta/\2CfgDefn.properties" />
|
<param name="base-dir" expression="${admin.temp.dir}" />
|
</xslt>
|
|
<!-- Compile the Directory Server extension configuration cli profile property files. -->
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${classes.dir}/admin/profiles/cli"
|
style="${admin.dir}/cliMOProfile.xsl">
|
<include name="**/*Configuration.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)Configuration\.xml$$"
|
to="\1/meta/\2CfgDefn.properties" />
|
<param name="base-dir" expression="${admin.temp.dir}" />
|
</xslt>
|
|
<!-- Compile the Directory Server extension configuration I18N message files. -->
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${classes.dir}/admin/messages"
|
style="${admin.dir}/messagesMO.xsl">
|
<include name="**/*Configuration.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
<regexpmapper handledirsep="true"
|
from="^(.*)/([^/]+)Configuration\.xml$$"
|
to="\1/meta/\2CfgDefn.properties" />
|
<param name="base-dir" expression="${admin.temp.dir}" />
|
</xslt>
|
|
<!-- Compile the Directory Server extension configuration manifest file. -->
|
<xslt basedir="${admin.temp.dir}"
|
destdir="${admin.temp.dir}"
|
extension=".manifest"
|
style="${admin.dir}/manifestMO.xsl">
|
<include name="**/*Configuration.xml" />
|
<exclude name="org/opends/server/admin/std/*.xml" />
|
</xslt>
|
<concat destfile="${classes.dir}/admin/extension.manifest">
|
<fileset dir="${admin.temp.dir}" includes="**/*.manifest" />
|
</concat>
|
|
<!-- Clean up -->
|
<delete dir="${admin.temp.dir}" />
|
</target>
|
|
<!-- Validate the Directory Server extension configuration definitions. -->
|
<target name="validateadmin">
|
<schemavalidate>
|
<fileset dir="${src.dir}" includes="**/*.xml" />
|
<schema namespace="http://www.opends.org/admin"
|
file="${admin.dir}/admin.xsd" />
|
<schema namespace="http://www.opends.org/admin-ldap"
|
file="${admin.dir}/admin-ldap.xsd" />
|
<schema namespace="http://www.opends.org/admin-cli"
|
file="${admin.dir}/admin-cli.xsd" />
|
</schemavalidate>
|
</target>
|
|
<!-- Generate messages from messages.properties file
|
located in the message directory and declared in a package
|
-->
|
<target name="generate-messages" if="hasmessages">
|
<typedef name="genmsg"
|
classname="org.opends.build.tools.GenerateMessageFile">
|
<classpath>
|
<fileset dir="${base.dir}/build/build-tools">
|
<include name="*.jar" />
|
</fileset>
|
</classpath>
|
</typedef>
|
|
<path id="messages.src.path">
|
<fileset dir="${src.dir}">
|
<include name="**/${properties.file}" />
|
</fileset>
|
</path>
|
<property name="messages.src.file" refid="messages.src.path" />
|
|
<pathconvert property="messages.dst.file" refid="messages.src.path">
|
<map from="${src.dir}" to="${src.gen.dir}" />
|
</pathconvert>
|
<dirname property="messages.dst.dir" file="${messages.dst.file}" />
|
|
|
<!-- Needed by genmsg task -->
|
<property name="msg.dir" location="${src.dir}" />
|
<property name="msg.javagen.dir" location="${src.gen.dir}" />
|
|
<genmsg sourceProps="${messages.src.file}" />
|
<copy file="${messages.src.file}" todir="${classes.dir}/messages" />
|
</target>
|
</project>
|