<!--
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 via
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://resource/legal-notices/CDDLv1_0.txt .
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 2006-2010 Sun Microsystems, Inc.
Portions Copyright 2011-2013 ForgeRock AS
Portions Copyright 2012 Delta Victor Consultants
Portions Copyright 2013 Jens Elkner
-->
xmlns:ivy="antlib:org.apache.ivy.ant"
xmlns:if="ant:if" xmlns:unless="ant:unless"
>
<description>
This is the build script for OpenDJ.
See the etc/README.txt file for build instructions and details.
</description>
<!-- Build JVM properties -->
<property name="MEM" value="1024M"/>
<property name="ant.regexp.regexpimpl"
<!-- Build OpenDMK properties -->
<property file="build.properties"/>
<property file="${user.home}/config/ant/${ant.project.name}.properties" />
<property file="${user.home}/config/ant/global.properties" />
<property file="/local/share/javax/global.properties" />
<property file="PRODUCT" />
<!-- property name="vendor.url" value="${DOC_REFERENCE_HOME}" / -->
<!-- If true, unmangled exception messages and full stacktrace gets logged,
otherwise, className if message == null and at most 20 stacktrace elements -->
<property name="DEBUG_BUILD" value="false" />
<!-- General server-wide properties -->
<property name="configguide.dir"
location="${docgen.dir}/configuration_guide" />
<property name="configguideldap.dir"
location="${docgen.dir}/configuration_guide_with_ldap_mapping" />
<property name="wiki.home"
<!-- man page related properties -->
<!-- Properties for build tools -->
<property name="buildtools.classes.dir"
location="${build.dir}/build-tools/classes" />
<!-- Properties for use in unit testing -->
<selector id="test.libs">
<or>
<filename name="**/assertj-core.jar" />
<filename name="**/hamcrest-core.jar" />
<filename name="**/mockito-core.jar" />
<filename name="**/objenesis.jar" />
</or>
</selector>
<property name="unittest.testng.src.dir"
location="${unittest.testng.dir}/src/server"/>
<property name="unittest.classes.dir"
location="${build.dir}/unit-tests/classes" />
<property name="unittest.report.dir"
location="${build.dir}/unit-tests/report"/>
<property name="unittest.resource.dir"
location="${build.dir}/unit-tests/resource"/>
<!-- Properties for use with the DSML component -->
<!-- Properties for use with the Quick Setup -->
<property name="quicksetup.classes.dir"
location="${build.dir}/quicksetup/classes" />
<property name="quicksetup.globalcompile.classes.dir"
location="${classes.dir}/org/opends/quicksetup" />
<property name="ads.classes.dir"
location="${classes.dir}/org/opends/admin/ads"/>
<!-- Properties for use with the GUI Tools that go in OpenDJ jar -->
<!-- Properties for coverage diff reports -->
<!-- Properties for code coverage testing -->
<property name="coverage.report.dir"
location="${coverage.dir}/reports/unit" />
<property name="coverage.instr.dir"
location="${coverage.dir}/instrumentedcode" />
<property name="coverage.data.dir"
location="${coverage.dir}/gathereddata" />
<!-- Properties for the EMMA code coverage tool -->
<!-- Properties for the AspectJ tools -->
<!-- Properties for the TestNG unit testing tool -->
<!-- Properties for the ANT build tool. -->
<!-- Properties for the checkstyle tool -->
<!-- Properties for Directory Server version information -->
<property name="dynconstants.file"
<property name="dynconstants.stubfile"
location="${resource.dir}/DynamicConstants.java.stubs" />
<!-- Properties for administration framework code generation -->
<property name="configguide.resource.dir"
location="resource/admin/config-guide" />
<!-- Properties for generating messages -->
<!-- Properties for L10n for generating messages -->
<selector id="msgl10n.prop.files">
<or>
<filename name="**/*_ca_ES.properties" />
<filename name="**/*_de.properties" />
<filename name="**/*_es.properties" />
<filename name="**/*_fr.properties" />
<filename name="**/*_ja.properties" />
<filename name="**/*_ko.properties" />
<filename name="**/*_pl.properties" />
<filename name="**/*_zh_TW.properties" />
<filename name="**/*_zh_CN.properties" />
</or>
</selector>
<!-- Properties for SNMP extension -->
<property name="snmp.classes.dir"
location="${classes.dir}/org/opends/server/snmp" />
<!-- Data dir for internal testing/development -->
<!-- Prevent ant runtime from being included on classpath during compilation -->
<presetdef name="javac">
deprecation="true" fork="true"
memoryInitialSize="${MEM}" memoryMaximumSize="${MEM}"
>
<compilerarg value="-Xlint:all" />
<compilerarg value="-Xlint:-rawtypes" />
<compilerarg value="-Xlint:-static" />
<compilerarg value="-Xlint:-unchecked" />
<compilerarg value="-Xprefer:source"/>
</javac>
</presetdef>
<!-- ######################### IVY #################################### -->
<isset property="build.offline"/>
</condition>
<isset property="build.offline"/>
</condition>
<target name="-check.ivy">
<dependset>
</dependset>
</target>
<!-- download Ivy from web site so that it can be used even without any
special installation -->
<echo message="Getting ivy ..."/>
<property name="ivy.baseurl"
<get src="${ivy.baseurl}/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ivy.jar.file}" usetimestamp="true"/>
</target>
<!--
Try to load ivy here from local ivy dir, in case the user has not already
dropped it into ant's lib dir (note that the latter copy will always take
precedence). We will not fail as long as local lib dir exists (it may be
empty) and ivy is in at least one of ant's lib dir or the local lib dir.
-->
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
description="Check and download required libs via ivy if not avail."
>
</target>
<target name="clean.libs"
>
<delete>
</delete>
</target>
<target name="clean.ivy">
<delete file="${ivy.jar.file}"/>
</target>
description="Remove everything in the ivy cache."
>
<ivy:cleancache/>
</target>
<!-- ########################## INIT ################################## -->
<condition property="isUnix"><os family="unix"/></condition>
value="${opendmk.lib.dir}/jdmkrt.jar" />
value="${opendmk.lib.dir}/jdmktk.jar" />
value="${ext.dir}/jdmkrt.jar" />
value="${ext.dir}/jdmktk.jar"/>
<and>
<isset property="jdmkrt.lib" />
<isset property="jdmktk.lib" />
</and>
</condition>
<path id="jdmk.jars">
</path>
<condition property="dbk.xsl"
value="${docbook.xsl.dir}/manpages/profile-docbook.xsl"
>
<and>
<available file="${docbook.xsl.dir}/manpages/profile-docbook.xsl" />
<available file="${src.man.dir}/common.xml" />
</and>
</condition>
<mkdir dir="${classes.dir}" />
<mkdir dir="${quicksetup.classes.dir}" />
<!-- defs here since we cache the result: dirs, libs must be avail -->
</fileset>
</path>
<pathelement location="${quicksetup.classes.dir}" />
</path>
<pathelement location="${classes.dir}" />
<path refid="quicksetup.classpath" />
<path refid="opendj.runtime.jars"/>
<path refid="jdmk.jars" />
<!-- messages. Dueto strange src tree layout, it contains more than
needed (i.e. not only messages) -->
<pathelement location="${msg.dir}" />
<pathelement location="${msgl10n.prop.dir}/.."/>
<pathelement location="${msg.javagen.dir}" />
</path>
<local name="snmp"/>
<condition property="snmp" value="enabled" else="disabled (OpenDMK not found)">
<isset property="jdmk.present" />
</condition>
<local name="dbk"/>
<condition property="dbk" value="available" else="not found">
<isset property="dbk.xsl" />
</condition>
<echo
> Java Version: ${java.runtime.version} (JVM ${java.vm.version})
SNMP support: ${snmp}
Docbook XSLT: ${dbk}
Ant:
${ant.home}
${ant.version}
</echo>
</target>
<target name="buildtools" depends="init"
description="Builds the build tools."
>
<mkdir dir="${buildtools.classes.dir}" />
<copy file="${resource.dir}/Messages.java.stub"
<javac srcdir="${src.dir}:${msg.src.dir}"
destdir="${buildtools.classes.dir}">
<src path="${src.dir}" />
<patternset includes="**/PublicAPI.java,**/StabilityLevel.java"/>
<src path="${msg.src.dir}" />
<patternset includes="**/Message.java,**/MessagePropertyKey.java,
**/MessageDescriptor.java,**/Severity.java,**/Category.java "/>
</javac>
includes="org/**/*,netscape/**/*"
>
<classpath>
<pathelement location="${ant.lib.dir}/ant.jar" />
</classpath>
</javac>
<jar jarfile="${build.dir}/build-tools/build-tools.jar"
cache="true"/>
<typedef name="genmsg"
classname="org.opends.build.tools.GenerateMessageFile"
>
<classpath refid="build.tools"/>
</typedef>
<presetdef name="genlogref">
<genmsg writelogref="true" />
</presetdef>
</target>
<target name="-check.repo">
<condition property="svn.uptodate">
<istrue value="${is.hg}" />
</condition>
<condition property="hg.uptodate">
<istrue value="${is.svn}" />
</condition>
</target>
<dependset>
<targetfileset file="${build.dir}/buildnumber" />
</dependset>
</target>
<dependset>
<targetfileset file="${build.dir}/buildnumber" />
</dependset>
</target>
unless="svn.uptodate">
<exec executable="svnversion" outputproperty="BUILD_ID" />
<arg line="info" />
<env key="LC_ALL" value="C"/>
</exec>
<script language="javascript"><![CDATA[
var line, s;
var lines = project.getProperty("hg.version").split("\n");
for each (var line in lines) {
s = line.split(" ", 2);
if (s[0] == "URL:") {
project.setProperty("URL_REPOSITORY", s[1]);
} else if (s[0] == "Revision:") {
project.setProperty("BUILD_NUMBER", s[1]);
}
}
var x = parseInt(project.getProperty("MAJOR_VERSION"), 10) * 1000000
+ parseInt(project.getProperty("MINOR_VERSION"), 10) * 1000
+ parseInt(project.getProperty("POINT_VERSION"), 10);
project.setProperty("REVISION_NUMBER", x);
]]></script>
<property name="BILD_NUMBER" value="0" />
<property name="URL_REPOSITORY"
BUILD_NUMBER=${BUILD_NUMBER}${line.separator}
BUILD_ID=${BUILD_ID}${line.separator}
REVISION_NUMBER=${REVISION_NUMBER}${line.separator}
URL_REPOSITORY=${URL_REPOSITORY}${line.separator}"/>
</target>
unless="hg.uptodate"
>
<!-- '+' => current branch has modifications, like M for svn -->
<arg line="id -in" />
</exec>
<script language="javascript"><![CDATA[
var s = project.getProperty("hg.version").split(" ");
var idx = s[1].lastIndexOf("+", s[1].length()-2);
idx = (idx < 0) ? 0 : idx+1;
var bn = s[1].endsWith("+")
? parseInt(s[1].substr(idx, s[1].length()-1), 10) + 1
: parseInt(s[1].substr(idx), 10);
var x = parseInt(project.getProperty("MAJOR_VERSION"), 10) * 1000000
+ parseInt(project.getProperty("MINOR_VERSION"), 10) * 1000
+ parseInt(project.getProperty("POINT_VERSION"), 10);
project.setProperty("REVISION_NUMBER", x);
project.setProperty("BUILD_NUMBER", bn);
project.setProperty("BUILD_ID", s[0]);
]]></script>
<property name="URL_REPOSITORY"
BUILD_NUMBER=${BUILD_NUMBER}${line.separator}
BUILD_ID=${BUILD_ID}${line.separator}
REVISION_NUMBER=${REVISION_NUMBER}${line.separator}
URL_REPOSITORY=${URL_REPOSITORY}${line.separator}"/>
</target>
<!-- Generate the DynamicConstants.java file.
Be warned that the .stubs file references the following properties
PRODUCT_NAME, SHORT_NAME, MAJOR_VERSION, MINOR_VERSION, POINT_VERSION,
VERSION_QUALIFIER, FIX_IDS, BUILD_NUMBER, BUILD_ID, user.name,
java.version, java.vendor, java.vm.version, JVM_VENDOR, DEBUG_BUILD,
URL_REPOSITORY, DOC_REFERENCE_HOME, DOC_REFERENCE_WIKI,
DOC_QUICK_REFERENCE_GUIDE, ADMINISTRATION_GUIDE_URL, VERSION-BUILD.
If you change the name of any of those properties in this build.xml
you'll need to reflect the same change in the .stubs file
-->
<property file="${build.dir}/buildnumber" />
<property name="BUILD_NUMBER" value="-1"/>
<!-- Construct the version number string -->
<loadresource property="PKG_QUALIFIER">
<propertyresource name="VERSION_QUALIFIER" />
<filterchain>
<tokenfilter>
<replaceregex pattern="[^0-9a-zA-Z]+" replace="" flags="g"/>
</tokenfilter>
</filterchain>
</loadresource>
<property name="PKG_QUALIFIER" value="" />
<property name="VERSION_FULL"
value="${MAJOR_VERSION}.${MINOR_VERSION}.${POINT_VERSION}" />
<property name="VERSION_SHORT" value="${MAJOR_VERSION}${MINOR_VERSION}"/>
<property name="VERSION-BUILD"
value="${VERSION_FULL}-build${BUILD_NUMBER}"/>
<property name="PKG_DIRNAME" value="${SHORT_NAME}-${VERSION-BUILD}" />
<srcfiles file="${build.dir}/buildnumber"/>
<srcfiles file="${dynconstants.stubfile}"/>
</uptodate>
>
<filterchain>
<expandproperties/>
</filterchain>
</copy>
</target>
<!-- ################ GENERATE source, xml files ###################### -->
description="Generate server messages source files.">
<genmsg sourceProps="${msg.prop.dir}/access_control.properties"
destJava="${msg.javagen.dir}/org/opends/messages/AccessControlMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/admin.properties"
destJava="${msg.javagen.dir}/org/opends/messages/AdminMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/admin_tool.properties"
destJava="${msg.javagen.dir}/org/opends/messages/AdminToolMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/backend.properties"
destJava="${msg.javagen.dir}/org/opends/messages/BackendMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/config.properties"
destJava="${msg.javagen.dir}/org/opends/messages/ConfigMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/core.properties"
destJava="${msg.javagen.dir}/org/opends/messages/CoreMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/dsconfig.properties"
destJava="${msg.javagen.dir}/org/opends/messages/DSConfigMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/extension.properties"
destJava="${msg.javagen.dir}/org/opends/messages/ExtensionMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/jeb.properties"
destJava="${msg.javagen.dir}/org/opends/messages/JebMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/log.properties"
destJava="${msg.javagen.dir}/org/opends/messages/LoggerMessages.java"/>
<genmsg sourceProps="${msg.prop.dir}/plugin.properties"
destJava="${msg.javagen.dir}/org/opends/messages/PluginMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/protocol.properties"
destJava="${msg.javagen.dir}/org/opends/messages/ProtocolMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/quicksetup.properties"
destJava="${msg.javagen.dir}/org/opends/messages/QuickSetupMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/replication.properties"
destJava="${msg.javagen.dir}/org/opends/messages/ReplicationMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/schema.properties"
destJava="${msg.javagen.dir}/org/opends/messages/SchemaMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/task.properties"
destJava="${msg.javagen.dir}/org/opends/messages/TaskMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/tools.properties"
destJava="${msg.javagen.dir}/org/opends/messages/ToolMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/utility.properties"
destJava="${msg.javagen.dir}/org/opends/messages/UtilityMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/version.properties"
destJava="${msg.javagen.dir}/org/opends/messages/VersionMessages.java" />
<genmsg sourceProps="${msg.prop.dir}/runtime_information.properties"
destJava="${msg.javagen.dir}/org/opends/messages/RuntimeMessages.java" />
</target>
<target name="clean.server"
description="Remove all generated server messages source files.">
<delete includeemptydirs="true" failonerror="false">
</delete>
</target>
<!-- same as generate.messages but output is xml instead of java file -->
description="Create DS log reference docbook source archive (core docs).">
<genlogref sourceProps="${msg.prop.dir}/access_control.properties"
destJava="${msg.logref.dir}/log-ref-access-control.xml" />
<genlogref sourceProps="${msg.prop.dir}/admin.properties"
destJava="${msg.logref.dir}/log-ref-admin.xml" />
<!-- Ignore admin tool messages while documenting only serious errors.
<genlogref sourceProps="${msg.prop.dir}/admin_tool.properties"
destJava="${msg.logref.dir}/log-ref-admin-tool.xml" />
-->
<genlogref sourceProps="${msg.prop.dir}/backend.properties"
destJava="${msg.logref.dir}/log-ref-backend.xml" />
<genlogref sourceProps="${msg.prop.dir}/config.properties"
destJava="${msg.logref.dir}/log-ref-config.xml" />
<genlogref sourceProps="${msg.prop.dir}/core.properties"
destJava="${msg.logref.dir}/log-ref-core.xml" />
<genlogref sourceProps="${msg.prop.dir}/dsconfig.properties"
destJava="${msg.logref.dir}/log-ref-dsconfig.xml" />
<genlogref sourceProps="${msg.prop.dir}/extension.properties"
destJava="${msg.logref.dir}/log-ref-extension.xml" />
<genlogref sourceProps="${msg.prop.dir}/jeb.properties"
destJava="${msg.logref.dir}/log-ref-jeb.xml" />
<genlogref sourceProps="${msg.prop.dir}/log.properties"
destJava="${msg.logref.dir}/log-ref-log.xml" />
<genlogref sourceProps="${msg.prop.dir}/plugin.properties"
destJava="${msg.logref.dir}/log-ref-plugin.xml" />
<genlogref sourceProps="${msg.prop.dir}/protocol.properties"
destJava="${msg.logref.dir}/log-ref-protocol.xml" />
<!-- Ignore QuickSetup messages that users handle interactively.
<genlogref sourceProps="${msg.prop.dir}/quicksetup.properties"
destJava="${msg.logref.dir}/log-ref-quicksetup.xml" />
-->
<genlogref sourceProps="${msg.prop.dir}/replication.properties"
destJava="${msg.logref.dir}/log-ref-replication.xml"
writelogref="true" />
<!-- Ignore runtime info messages while documenting only serious errors.
<genlogref sourceProps="${msg.prop.dir}/runtime_information.properties"
destJava="${msg.logref.dir}/log-ref-runtime-information.xml" />
-->
<genlogref sourceProps="${msg.prop.dir}/schema.properties"
destJava="${msg.logref.dir}/log-ref-schema.xml" />
<genlogref sourceProps="${msg.prop.dir}/task.properties"
destJava="${msg.logref.dir}/log-ref-task.xml" />
<genlogref sourceProps="${msg.prop.dir}/tools.properties"
destJava="${msg.logref.dir}/log-ref-tools.xml" />
<genlogref sourceProps="${msg.prop.dir}/utility.properties"
destJava="${msg.logref.dir}/log-ref-utility.xml" />
<!-- Ignore version messages while documenting only serious errors.
<genlogref sourceProps="${msg.prop.dir}/version.properties"
destJava="${msg.logref.dir}/log-ref-version.xml />
-->
<jar destfile="${docgen.dir}/log-ref.jar">
<filename name="${resource.dir}/log-message-reference.xml"/>
</jar>
</target>
<!-- no need to clean: everything below build/ -->
<target name="-check.schema">
<dependset>
</dependset>
<condition property="schema.uptodate">
</condition>
</target>
description="Validate core admin component XML definition files."
>
<schemavalidate>
<schema namespace="http://www.opends.org/admin"
file="${admin.rules.dir}/admin.xsd"/>
<schema namespace="http://www.opends.org/admin-ldap"
file="${admin.rules.dir}/admin-ldap.xsd"/>
<schema namespace="http://www.opends.org/admin-cli"
file="${admin.rules.dir}/admin-cli.xsd"/>
</schemavalidate>
</target>
<target name="-check.admin">
<dependset>
<targetfileset dir="${admin.src.dir}" />
<targetfileset dir="${classes.dir}"
admin/messages/**/*.properties,admin/core.manifest"/>
</dependset>
<condition property="admin.uptodate">
<available file="${classes.dir}/admin/core.manifest"/>
</condition>
</target>
unless="admin.uptodate"
description="Generate admin messages source files."
>
<!-- Xalan-J Class Path : refer to it explicitly from each XSLT task. -->
</path>
includes="**/*Configuration.xml"/>
<pathconvert property="cfgFileList" pathsep=' ' refid="cfgFiles">
<!-- Glob not really needed: just to reduce length of the lists -->
<globmapper from="${basedir}/*" to="../../*"/>
</pathconvert>
<!-- Generate manifest file for core administration components -->
style="${admin.rules.dir}/manifestMO.xsl">
<param name="files" expression="${cfgFileList}"/>
<classpath refid="xalan.class.path" />
</xslt>
<!-- Now silence, please -->
<script language="javascript"><![CDATA[
// no way to get the log.level from ant, so we use cmdline
var level = 2; // info
var args = project.getProperty("sun.java.command").split("\\s");
for (var i=0; i < args.length; i++) {
if (args[i] == "-q" || args[i] == "--quiet") {
level = 1;
} else if (args[i] == "-v" || args[i] == "--verbose") {
level = 3;
} else if ( args[i] == "-d" || args[i] == "--debug") {
level = 4;
}
}
project.setProperty("log.level", level);
if (level > 1) {
var logger = project.getBuildListeners().firstElement();
logger.setMessageOutputLevel(level-1);
}
]]></script>
<!-- Generate introspection API for core administration components -->
includes="**/*Configuration.xml" style="${admin.rules.dir}/metaMO.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.java"/>
<classpath refid="xalan.class.path" />
</xslt>
includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)\.xml$$" to="\1/meta/package-info.java" />
<param name="type" expression="meta" />
<classpath refid="xalan.class.path" />
</xslt>
<!-- Generate client API for core administration components -->
includes="**/*Configuration.xml" style="${admin.rules.dir}/clientMO.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/client/\2CfgClient.java" />
<classpath refid="xalan.class.path" />
</xslt>
includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)\.xml$$" to="\1/client/package-info.java" />
<param name="type" expression="client" />
<classpath refid="xalan.class.path" />
</xslt>
<!-- Generate server API for core administration components -->
includes="**/*Configuration.xml" style="${admin.rules.dir}/serverMO.xsl">
<regexpmapper handledirsep="true"
<classpath refid="xalan.class.path" />
</xslt>
includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)\.xml$$" to="\1/server/package-info.java" />
<param name="type" expression="server" />
<classpath refid="xalan.class.path" />
</xslt>
<!-- Generate LDAP profile for core administration components -->
includes="**/*Configuration.xml" style="${admin.rules.dir}/ldapMOProfile.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties"/>
<classpath refid="xalan.class.path" />
</xslt>
<!-- Generate CLI profile for core administration components -->
includes="**/*Configuration.xml" style="${admin.rules.dir}/cliMOProfile.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties"/>
<classpath refid="xalan.class.path" />
</xslt>
<!-- Generate I18N messages for core administration components -->
includes="**/*Configuration.xml" style="${admin.rules.dir}/messagesMO.xsl">
<regexpmapper handledirsep="true"
from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
<classpath refid="xalan.class.path" />
</xslt>
<!-- restore log level -->
var level = project.getProperty("log.level");
project.getBuildListeners().firstElement().setMessageOutputLevel(level);
]]></script>
</target>
<target name="clean.admin"
description="Remove all generated admin messages source files."
>
<delete failonerror="false">
<fileset file="${classes.dir}/admin/core.manifest"/>
</delete>
</target>
<target name="-check.mibs">
<dependset>
<targetfileset dir="${snmp.gen.dir}/org/opends/server/snmp"/>
</dependset>
<condition property="mib.uptodate">
<available file="${snmp.gen.dir}/org/opends/server/snmp/DIRECTORY_SERVER_MIB.java"/>
</condition>
</target>
depends="init,-check.mibs" description="Generate SNMP source files.">
<mkdir dir="${snmp.gen.dir}/org/opends/server/snmp" />
-X:use-display-hint -d '${snmp.gen.dir}/org/opends/server/snmp'
-mc -desc -tp org.opends.server.snmp
'${snmp.mib.dir}/rfc2605.txt'
'${snmp.mib.dir}/mib_core.txt'
'${snmp.mib.dir}/rfc2021.txt'
'${snmp.mib.dir}/rfc2788.txt'"/>
</exec>
</target>
<target name="clean.snmp"
description="Remove all generated SNMP source files."
>
<delete includeemptydirs="true" failonerror="false">
</delete>
</target>
<target name="gen"
depends="gen.server,gen.admin,gen.snmp"/>
<!-- ####################### COMPILE ################################## -->
description="Compile DS source files."
>
<javac destdir="${classes.dir}">
<src path="${src.dir}"/>
<src path="${admin.src.dir}"/>
<src path="${msg.src.dir}"/>
<src path="${msg.javagen.dir}"/>
<src path="${ads.src.dir}"/>
<src path="${quicksetup.src.dir}"/>
<src path="${guitools.src.dir}"/>
<classpath>
<path refid="opendj.runtime.jars" />
<path refid="build.tools" />
<pathelement location="${java.home}/lib/javaws.jar"/>
</classpath>
</javac>
</target>
description="Compile QuickSetup source files."
>
<javac destdir="${quicksetup.classes.dir}">
<src path="${ads.src.dir}" />
<src path="${quicksetup.src.dir}" />
<classpath>
<pathelement location="${java.home}/lib/javaws.jar"/>
<pathelement location="${classes.dir}"/>
</classpath>
</javac>
<javac destdir="${quicksetup.classes.dir}">
<src path="${src.dir}"/>
<patternset includes="**/SetupUtils.java,
**/OperatingSystem.java,**/OpenDsException.java" />
<src path="${msg.src.dir}"/>
<patternset includes="**/Severity.java,**/Category.java,
**/Message.java,**/MessageBuilder.java,**/MessageDescriptor.java"/>
<src path="${msg.javagen.dir}"/>
<patternset includes="**/QuickSetupMessages.java"/>
<classpath>
<pathelement location="${classes.dir}"/>
</classpath>
</javac>
</target>
if="jdmk.present"
description="Compile SNMP Connection Handler extensions."
>
<javac destdir="${classes.dir}">
<src path="${snmp.gen.dir}" />
<src path="${snmp.src.dir}" />
<classpath>
<path refid="opendj.runtime.jars"/>
<path refid="jdmk.jars" />
</classpath>
<compilerarg value="-Xlint:-serial" />
</javac>
</target>
description="Compile DS, QuickSetup and SNMP extensions."/>
<!-- ####################### PROTO ################################# -->
<mkdir dir="${PROTO}" />
<local name="resetperms"/>
<available file="${PROTO}/template" property="reset"/>
<chmod perm="u+w" dir="${PROTO}/template" includes="**/*" if:set="reset"/>
</target>
description="Assemble example plugin source archive."
>
<local name="prefix" />
<property name="prefix" value="example-plugin" />
<local name="codebase" />
<zip destfile="${PROTO}/${prefix}.zip" whenempty="create">
<zipfileset dirmode="755" filemode="644"
prefix="${prefix}"
dir="${admin.rules.dir}/example-plugin"
includes="build.xml,README" />
<zipfileset dirmode="755" filemode="644"
prefix="${prefix}/lib"
dir="${build.dir}/build-tools"
includes="build-tools.jar" />
<zipfileset dirmode="755" filemode="644"
prefix="${prefix}/src"
dir="${admin.defn.dir}"
includes="**/*.xml" />
<zipfileset dirmode="755" filemode="644"
prefix="${prefix}/src/${codebase}"
dir="${admin.rules.dir}/example-plugin"
includes="*.java,*.xml" excludes="build.xml" />
<zipfileset dirmode="755" filemode="644"
dir="${admin.rules.dir}"
excludes="example-plugin/**" />
<zipfileset dirmode="755" filemode="644"
dir="${admin.rules.dir}/example-plugin"
includes="example-plugin.ldif" />
<zipfileset dirmode="755" filemode="644"
dir="${admin.rules.dir}/example-plugin"
includes="99-example-plugin.ldif" />
<zipfileset dirmode="755" filemode="644"
dir="${admin.rules.dir}/example-plugin"
includes="example_plugin.properties,example_plugin_fr.properties" />
<!-- empty dirs -->
<zipfileset dirmode="755" filemode="644"
prefix="${prefix}/src-generated"
dir="${admin.rules.dir}/example-plugin" excludes="**/*" />
<zipfileset dirmode="755" filemode="644"
prefix="${prefix}/ext"
dir="${admin.rules.dir}/example-plugin" excludes="**/*" />
</zip>
</target>
description="Assemble DS SNMP extension."
>
<fileset dir="${snmp.security.dir}"/>
</copy>
<mkdir dir="${PROTO}/lib/extensions" />
index="true">
<manifest>
<attribute name="Extension-Name" value="snmp-mib2605"/>
<attribute name="Implementation-Version" value="${VERSION-BUILD}"/>
<attribute name="Revision-Number" value="${REVISION_NUMBER}"/>
</manifest>
</jar>
</target>
<attribute name="dir"
description="directory, where the new file should be created." />
<sequential>
<mkdir dir="@{dir}"/>
<echo message="${VERSION_FULL}.${REVISION_NUMBER}"
file="@{dir}/buildinfo"/>
</sequential>
</macrodef>
<macrodef name="create.l10n.jar">
<attribute name="lang" />
<sequential>
<jar destfile="${PROTO}/lib/${SHORT_NAME}_@{lang}.jar"
compress="true" index="true">
<fileset dir="${msg.dir}"
includes="messages/**/*_@{lang}.properties"/>
includes="**/*_@{lang}.properties"/>
</jar>
</sequential>
</macrodef>
<macrodef name="create.subcmd.inc">
<attribute name="cmd" description="command name"/>
<attribute name="cname" description="class name"/>
<sequential>
<echo file="${build.man.dir}/scmd-@{cmd}.xml"
><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<refentry>
]]></echo>
<java fork="true" logerror="true" classname="@{cname}"
output="${build.man.dir}/scmd-@{cmd}.xml" append="true">
<classpath>
<pathelement location="${classes.dir}" />
<pathelement location="${msg.dir}"/>
</classpath>
<jvmarg line="-Dorg.forgerock.opendj.gendoc=true"/>
<jvmarg line="-Dorg.opends.server.InstanceRoot=${build.dir}/tmp"/>
<arg line="-?"/>
</java>
><![CDATA[</refentry>]]></echo>
</sequential>
</macrodef>
<condition property="subcmds.uptodate">
<or>
<and>
<available file="${build.man.dir}/scmd-dsconfig.xml" />
<available file="${build.man.dir}/scmd-dsframework.xml" />
<available file="${build.man.dir}/scmd-dsreplication.xml" />
<available file="${build.man.dir}/scmd-manage-account.xml" />
</and>
</or>
</condition>
</target>
unless="subcmds.uptodate"
>
<create.buildinfo dir="${build.dir}/tmp/config"/>
<create.subcmd.inc cmd="dsconfig"
<create.subcmd.inc cmd="dsframework"
<create.subcmd.inc cmd="dsreplication"
cname="org.opends.server.tools.dsreplication.ReplicationCliMain"/>
<create.subcmd.inc cmd="manage-account"
cname="org.opends.server.tools.ManageAccount"/>
</target>
<macrodef name="xsltproc">
<attribute name="os"
description="target OS: solaris|linux|bsd" />
<attribute name="files"
description="space separated list of docbook files to xlate" />
<attribute name="pathes"
description="pathes where to find xinclude files" />
<attribute name="prefer" default=""
description="indicates the call for the preferred OS" />
<sequential>
<local name="touchfile"/>
<local name="do"/>
<condition property="do">
<and>
<length string="@{os}" trim="true" when="gt" length="0"/>
<or>
<and>
<not><istrue value="@{prefer}" /></not>
</and>
<and>
when="greater" length="0"/>
<istrue value="@{prefer}" />
</and>
</or>
<not>
<uptodate targetfile="${touchfile}" >
<srcfiles refid="man.src.files" />
<srcfiles file="${src.man.dir}/common.xml" />
</uptodate>
</not>
</and>
</condition>
<arg line="--xinclude" />
<arg line="--stringparam profile.os @{os}" />
<arg line="--param man.output.in.separate.dir 1" />
<arg line="--stringparam man.output.base.dir ./@{os}/" />
<arg line="--param man.authors.section.enabled 0" />
<arg line="--param man.copyright.section.enabled 0" />
<arg line="--param man.hyphenate 1" />
<arg line="--param man.justify 1" />
<arg line="--param refentry.meta.get.quietly 1" />
<arg line="--path '@{pathes}'" />
<arg line="--nonet --novalid"/>
<arg line="${dbk.xsl}" />
<arg line="@{files}" />
<redirector>
<errorfilterchain>
<linecontainsregexp negate="true">
<regexp pattern="namesp. cut :|cannot add @xml:base"/>
</linecontainsregexp>
</errorfilterchain>
</redirector>
</exec>
<touch file="${touchfile}" if:set="do" />
</sequential>
</macrodef>
description="Generate man pages." if="dbk.xsl"
>
<pathconvert property="man.dir.pathes">
<path>
<pathelement location="${src.man.dir}" />
<pathelement location="${build.man.dir}"/>
</path>
</pathconvert>
prefer="true"/>
</target>
</target>
<macrodef name="copy.dbk.mans"
description="Copy docbook generated man pages to the given directory
and apply misc fixes. Both params are expected to be the parent
of the man[0-9]*/ directories.">
<attribute name="fromdir" />
<attribute name="todir" />
<sequential>
<fileset dir="@{fromdir}" includes="man*/*"/>
<filterchain>
<replacetokens>
<token key="VERS" value="${VERSION_SHORT}" />
<token key="VERS_FULL" value="${VERSION_FULL}" />
<token key="PRODUCT"
value="${PRODUCT_NAME} ${VERSION_FULL}" />
</replacetokens>
<tokenfilter>
<!-- replace stupid groff colored links with a ref -->
<replaceregex pattern="\\m\[blue\](.*)\\m\[\]"
replace="\1" flags="g" />
<replaceregex pattern="\\s-2\\u(\[[0-9]+\])\\d\\s\+2"
replace=" \1" flags="g" />
<!-- lines with '^.sp .' produce strange chars -->
<replaceregex pattern="^\.sp \..*"
replace=".sp" flags="g" />
</tokenfilter>
</filterchain>
<filtermapper><replacestring from="1M" to="1m"/></filtermapper>
</copy>
</sequential>
</macrodef>
description="Assemble man pages."
>
<local name="man2use"/>
</condition>
<copy.dbk.mans fromdir="${build.man.dir}/${man2use}"
todir="${PROTO}/man" />
</copy>
</target>
<macrodef name="add.symlinks">
<attribute name="script"
description="The script to parse for '#link's" />
<attribute name="dir"
description="The directory, where the links need to created." />
<attribute name="link" description="the source of the link to create." />
<attribute name="file"
description="The file where to add the link commands to execute." />
<sequential>
<local name="fileNames" />
<loadresource property="fileNames" if:set="isUnix">
<file file="@{script}" />
<filterchain>
<linecontains>
<contains value="#link" />
</linecontains>
<tokenfilter>
<replaceregex pattern="^\s*([^)]+)\s*[)].*"
replace="ln -sf '@{link}' '@{dir}/\1'" />
</tokenfilter>
</filterchain>
</loadresource>
<!-- symlink task does a native 'ln -s' on each anyway, so ... -->
<echo file="@{file}" message="${fileNames}" append="true" />
</sequential>
</macrodef>
description="Assemble main DS and QuickSetup bits."
>
<!-- per default empty dirs. All others get created as needed. -->
<mkdir dir="${PROTO}/template/changelogDb" />
<mkdir dir="${PROTO}/template/import-tmp" />
<!-- create jars -->
<copy todir="${PROTO}/lib" flatten="true">
<path refid="opendj.runtime.jars"/>
</copy>
<local name="prefix"/>
<property name="prefix"
<jar destfile="${PROTO}/lib/${SHORT_NAME}.jar" compress="true" index="true">
${quicksetup.globalcompile.classes.dir},org/opends/server/snmp/**" />
<!-- quicksetup.properties really needed -->
</zipfileset>
<fileset dir="${msg.javagen.dir}"
includes="org/opends/messages/descriptors.reg"/>
</jar>
<create.l10n.jar lang="fr"/>
<create.l10n.jar lang="ja"/>
<create.l10n.jar lang="de"/>
<create.l10n.jar lang="es"/>
<create.l10n.jar lang="ko"/>
<create.l10n.jar lang="zh_CN"/>
<create.l10n.jar lang="zh_TW"/>
<create.l10n.jar lang="pl"/>
<create.l10n.jar lang="ca_ES"/>
<fileset dir="${quicksetup.classes.dir}" />
<zipfileset prefix="messages"
file="${msg.prop.dir}/quicksetup.properties" />
</jar>
<manifestclasspath property="manifest.classpath"
jarfile="${PROTO}/lib/bootstrap.jar">
<classpath location="${PROTO}/lib/*.jar" />
</manifestclasspath>
<jar destfile="${PROTO}/lib/bootstrap.jar">
<manifest>
</manifest>
</jar>
<!-- populate ${PROTO}/template/ -->
<fileset dir="${config.dir}">
</fileset>
</copy>
file="${config.dir}/config.ldif" >
<filterchain>
<concatfilter append="${snmp.config.dir}/config.snmp.ldif" />
</filterchain>
</copy>
<create.buildinfo dir="${PROTO}/template/config" />
<classpath refid="build.tools" />
</taskdef>
<concatschema schemaDirectory="${resource.dir}/schema"
toFile="${PROTO}/template/config/upgrade/schema.ldif.${REVISION_NUMBER}" />
<fileset dir="${resource.dir}/schema" />
</copy>
<fileset dir="${resource.dir}/messages" />
</copy>
<fileset dir="${resource.dir}/MakeLDIF" />
</copy>
<copy todir="${PROTO}">
images/opendj_logo.png,legal-notices/*" />
</copy>
<!-- copy Mac specific stuff -->
<copy todir="${PROTO}" >
<filtermapper>
</filtermapper>
<filterchain>
<replacetokens>
<token key="version" value="${VERSION_FULL}" />
<token key="revision" value="${REVISION_NUMBER}" />
</replacetokens>
</filterchain>
</copy>
<copy todir="${PROTO}" >
<filtermapper>
</filtermapper>
</copy>
<!-- copy unix scripts -->
<copy todir="${PROTO}/bin">
<filterchain>
<fixcrlf eol="lf" />
<replacetokens>
<token key="VERS" value="${VERSION_SHORT}"/>
</replacetokens>
</filterchain>
</copy>
<copy todir="${PROTO}/bin">
<filterchain><fixcrlf eol="crlf" /></filterchain>
</copy>
<copy todir="${PROTO}/lib">
<filterchain>
<fixcrlf eol="lf" />
<replacetokens>
<token key="VERS" value="${VERSION_SHORT}"/>
</replacetokens>
</filterchain>
</copy>
<copy todir="${PROTO}">
<filterchain><fixcrlf eol="lf" /></filterchain>
</copy>
<!-- ant's symlink task is pretty inefficient and error prone. So we
just collect the links in a script and exec it later - even if not
needed that's still cheaper -->
<local name="script" />
<delete file="${script}" failonerror="false" quiet="true" />
<add.symlinks script="${scripts.dir}/_client-script.sh"
<add.symlinks script="${scripts.dir}/_mixed-script.sh"
<add.symlinks script="${scripts.dir}/_server-script.sh"
<echo file="${script}" append="true" message="ln -sf
'/lib/_server-script.sh' '${PROTO}/upgrade'${line.separator}" />
'${PROTO}/legal-notices/OpenDJ.LICENSE'${line.separator}" />
<arg value="${script}" />
</exec>
<!-- copy batch files -->
<copy todir="${PROTO}/bat">
<fileset dir="${scripts.dir}"
includes="*.bat" excludes="_*.bat,setcp.bat"/>
<filterchain><fixcrlf eol="crlf" /></filterchain>
</copy>
<copy todir="${PROTO}/lib">
<filterchain><fixcrlf eol="crlf" /></filterchain>
</copy>
<copy todir="${PROTO}">
<fileset dir="${resource.dir}"
includes="setup.bat,uninstall.bat,upgrade.bat"/>
<filterchain><fixcrlf eol="crlf" /></filterchain>
</copy>
<copy file="${PROTO}/legal-notices/CDDLv1_0.txt"
<echo level="warning" message="Not a UNIX like OS! Skipping symlinks."
unless:set="isUnix" />
</target>
<fail message="The license file '${license.file}' could not be found or is empty">
<condition>
<not>
<and>
when="greater" length="0"/>
</and>
</not>
</condition>
</fail>
</target>
description="Create and populate the DS proto directory."
>
<chmod perm="755">
<fileset dir="${PROTO}"
<fileset dir="${PROTO}/lib" includes="_*.sh" />
</chmod>
<chmod perm="444">
<fileset dir="${PROTO}/template" />
</chmod>
</target>
<delete dir="${PROTO}" failonerror="false"/>
</target>
<!-- ####################### DSML ################################## -->
<target name="-check.dsml">
<dependset>
<srcfileset dir="${dsml.dir}/schema"
includes="DSMLv2.xsd,bindings.xjb"/>
<targetfileset dir="${dsml.gen.dir}/org/opends/dsml/protocol"
includes="*.java"/>
</dependset>
<condition property="dsml.uptodate">
<available file="${dsml.gen.dir}/org/opends/dsml/protocol/ResultCode.java"/>
</condition>
</target>
description="Generate DSML source files."
>
<!-- xjc ant task screws up ant classloaders: use external variant! -->
<mkdir dir="${dsml.gen.dir}/org/opends/dsml/protocol" />
<!-- Don't gen package-info.java: conflicts with the one in src/dsml -->
<exec executable="xjc">
<arg value="-npa" />
<arg value="-verbose" />
<arg line="-target 2.1" />
<arg line="-p org.opends.dsml.protocol" />
<arg line="-d ${dsml.gen.dir}" />
<arg value="${dsml.dir}/schema/DSMLv2.xsd" />
<arg line="-b ${dsml.dir}/schema/bindings.xjb"/>
</exec>
</target>
<!-- Basically compile.server dep would be sufficient, but we need to make
sure, that the bundled OpenDJ.jar contains everything needed by DSML -->
description="Compile DSML source files."
>
<mkdir dir="${dsml.classes.dir}" />
<javac destdir="${dsml.classes.dir}">
<src path="${dsml.gen.dir}" />
<src path="${dsml.src.dir}" />
<classpath location="${PROTO}/lib/${SHORT_NAME}.jar"/>
<classpath location="${lib.dir}/jar/javax.servlet-api.jar"/>
<compilerarg value="-Xlint:-path" />
</javac>
</target>
description="Create the DSML web archive."
>
includes="*.xml" />
<zipfileset dir="${dsml.dir}/schema"
prefix="WEB-INF/classes/resources" includes="DSMLv2.xsd"/>
includes="${SHORT_NAME}*.jar"/>
</jar>
</target>
<target name="clean.dsml"
description="Remove all generated DSML source files."
>
</target>
<!-- ######################## DOCUMENTATION ########################### -->
<!-- Generate the Configuration guides. -->
<macrodef name="create.configguide">
<attribute name="dir" description="destination directory" />
<attribute name="jvmargx" default="" />
<sequential>
<mkdir dir="@{dir}" />
<copy todir="@{dir}">
<fileset dir="${configguide.resource.dir}" />
</copy>
<java fork="true" failonerror="true"
<classpath>
<fileset refid="opendj.runtime.jars"/>
<pathelement location="${classes.dir}" />
<pathelement location="${msg.dir}" />
</classpath>
<jvmarg value="-DGenerationDir=@{dir} @{jvmargx}"/>
<jvmarg value="-DOpendsWiki=${wiki.home}"/>
</java>
</sequential>
</macrodef>
description="Generate html Config Guide (standard)."
>
<create.configguide dir="${configguide.dir}" />
</target>
description="Generate html Config Guide with LDAP mapping."
>
</target>
description="Generate html Config Guides." />
<!-- Generate JavaDoc documentation from the source files -->
<property name="tag"
value="<div class="todo">To Do:</div>" />
<property name="todoParam" value="-tag todo:a:"${tag}"" />
</target>
<property name="todoParam"
value="-taglet taglets.ToDoTaglet -tagletpath ${taglets.jar}" />
</target>
<target name="api"
depends="compile.setup,compile.dsml,-setAltTodoTaglet,-setTodoTaglet"
description="Generate JavaDoc documentation."
>
<mkdir dir="${javadoc.dir}" />
<!-- appears in <head><title>...</title> -->
<local name="windowtitle" />
<!-- appears in <head><meta NAME="keywords" CONTENT="..."/> -->
<local name="doctitle" />
<!-- appears as heading in the <body> AND
as version info on the right of the nav_bar -->
<local name="header" />
<!-- appears after the bottom nav_bar as footer -->
<local name="bottom" />
<property name="windowtitle"
value="${PRODUCT_NAME} ${VERSION_FULL} API Documentation" />
<property name="doctitle"
value="${windowtitle}" />
<property name="header"
value="<b>${PRODUCT_NAME}
<font size="-1">Version
${VERSION_FULL}</font></b>" />
<property name="bottom"
value="<font size="-1">
${PRODUCT_NAME} is maintained by <a
href="${vendor.url}">${vendor.name}</a>."/>
<javadoc destdir="${javadoc.dir}"
author="true" verbose="true" use="true"
additionalparam="-breakiterator ${todoParam}"
doctitle="${doctitle}" windowtitle="${windowtitle}"
header="${header}" bottom="${bottom}"
linksource="yes"
maxmemory="${MEM}"
>
<classpath>
<path refid="run.classpath"/>
<pathelement location="${dsml.classes.dir}" />
</classpath>
<link href="${jdkAPI}" />
<packageset dir="${src.dir}" />
<packageset dir="${admin.src.dir}" />
<packageset dir="${ads.src.dir}" />
<packageset dir="${dsml.src.dir}" />
<packageset dir="${msg.src.dir}" />
</javadoc>
.todo { background-color: #FFCCCC; }
</concat>
</target>
<!-- ########################## PACKAGES ############################ -->
<!-- Package the Directory Server for distribution. -->
description="Create a generic zipped DS package."
>
<local name="prefix"/>
<property name="prefix" value="opendj${VERSION_SHORT}"/>
<filterset>
<filter token="CLIENT_BASEDIR" value="/opt/${prefix}"/>
</filterset>
</copy>
<zip destfile="${PROTO}.zip">
<zipfileset dir="${PROTO}" prefix="${prefix}"
filemode="644" dirmode="755"
includes="**/*"
excludes="bin/*,template/**/*,lib/_client-script.sh,
setup,uninstall,upgrade,
<zipfileset dir="${PROTO}" prefix="${prefix}"
filemode="755" dirmode="755"
includes="lib/_client-script.sh,lib/_script-util.sh,
<zipfileset dir="${PROTO}" prefix="${prefix}"
filemode="755" dirmode="755"
includes="bin/*" excludes="bin/README_WINDOWS.txt" />
<zipfileset dir="${PROTO}" prefix="${prefix}"
filemode="644" dirmode="755"
includes="bin/README_WINDOWS.txt" />
<zipfileset dir="${PROTO}" prefix="${prefix}"
filemode="755" dirmode="755"
includes="setup,uninstall,upgrade,
<zipfileset dir="${PROTO}" prefix="${prefix}"
filemode="444" dirmode="744"
includes="template/**/*" />
</zip>
<!-- print a time stamp in Unix 'date' format -->
<tstamp>
</tstamp>
<echo message="Package built: ${package.built.ts}"/>
</target>
description="Convinience target for 'ant clean pkg.generic'" />
<!-- Package the Directory Server for the RPM distribution. -->
description="Create an RPM DS package."
>
<classpath refid="build.tools" />
</taskdef>
<local name="prefix"/>
<local name="release"/>
<property name="release" value="1"/>
productName="${PRODUCT_NAME}" shortName="${PKG_NAME}"
referenceURL="${DOC_REFERENCE_HOME}"
sourceDirName="${PROTO}"
version="${VERSION_FULL}"
release="${release}.${PKG_QUALIFIER}"
overwrite="true" />
<copy todir="${package.dir}">
</copy>
</target>
<!-- Package the Directory Server for the DEB distribution. -->
description="Create a Debian DS package."
>
<local name="prefix"/>
<local name="release"/>
<property name="release" value="1"/>
<filterset>
<filter token="version" value="${VERSION-BUILD}"/>
<filter token="name" value="${PKG_NAME}"/>
<filter token="description" value="${PRODUCT_NAME}"/>
<filter token="prefix" value="${prefix}"/>
</filterset>
</copy>
<deb destfile="${package.dir}/${PKG_NAME}_${VERSION_FULL}-${release}${PKG_QUALIFIER}_all.deb"
>
<tarfileset dir="${PROTO}" prefix="${prefix}"
dirmode="755" filemode="644"
includes="**/*"
excludes="**/bat/**, **/*.app/**, **/*.bat, bin/*,template/**/*,
lib/*.exe,lib/*.sh,setup,uninstall*,upgrade,**/bootstrap.jar,
README" />
dirmode="755" filemode="644"
includes="README" />
<tarfileset dir="${PROTO}" prefix="${prefix}"
dirmode="755" filemode="755"
includes="lib/*.sh" />
<tarfileset dir="${PROTO}" prefix="${prefix}"
dirmode="755" filemode="755" followsymlinks="false"
includes="bin/*" excludes="bin/README_WINDOWS.txt" />
<tarfileset dir="${PROTO}" prefix="${prefix}"
dirmode="755" filemode="755"
includes="setup,upgrade" />
<tarfileset dir="${PROTO}" prefix="${prefix}"
dirmode="744" filemode="444"
includes="template/**/*"/>
</deb>
</target>
<!-- Package the Directory Server for SVR4 pkg distribution. -->
<property name="svr4.pkg.name"
value="${vendor.prefix}${PKG_NAME}${VERSION_SHORT}"/>
<property name="svr4.pkg.dir"
value="${svr4.tmpdir}/root/opt/opendj${VERSION_SHORT}"/>
<local name="man.ok" />
<condition property="man.ok">
<available file="${build.man.dir}/solaris" />
</condition>
<condition property="svr4.manCopy">
<and>
<isset property="dbk.xsl" />
<isset property="man.ok" />
</and>
</condition>
message="Solaris man pages not available. Packaging Linux man pages ..." />
value="${svr4.pkg.dir}/man=opendj${VERSION_SHORT}/man">
<isset property="svr4.manCopy" />
</condition>
<mkdir dir="${svr4.pkg.dir}"/>
failonerror="false" />
<tokenfilter >
<replacestring from="#marker#" to="" />
</tokenfilter>
</filterchain>
</copy>
</target>
<!-- proto contains non-solaris man pages -->
<copy.dbk.mans fromdir="${build.man.dir}/solaris"
todir="${svr4.pkg.dir}/man" />
</target>
description="Create a SVR4 DS package."
>
<!-- SMF/RBAC stuff - see also ${svr4.srcdir}/prototype.awk -->
<copy todir="${svr4.tmpdir}">
<filterset>
<filter token="DJ_DIR" value="opendj${VERSION_SHORT}" />
</filterset>
</copy>
<filterset>
<filter token="VERS" value="${VERSION_SHORT}" />
</filterset>
</copy>
<filterset>
<filter token="VERS" value="${VERSION_SHORT}" />
</filterset>
</copy>
<filterset>
<filter token="VERSION" value="${VERSION_FULL}" />
<filter token="SERIALNUM" value="${BUILD_NUMBER}" />
<filter token="BASEDIR" value="/opt" />
</filterset>
</copy>
error="${svr4.tmpdir}/prototype.error" failonerror="true"
>
<arg line="'${PROTO}=opendj${VERSION_SHORT}'
${svr4.proto.add}" />
</exec>
error="${svr4.tmpdir}/prototype.error" failonerror="true"
>
<arg line="-v TMPDIR='${svr4.tmpdir}'" />
<arg line="-v SRCDIR='${svr4.srcdir}'" />
<arg line="-v SVERS=${VERSION_SHORT}" />
<arg line="-f '${svr4.tmpdir}/s.awk'" />
<arg value="${svr4.tmpdir}/prototype" />
</exec>
<exec executable="pkgmk" failonerror="true">
<arg value="-o" />
<arg line="-f ${svr4.tmpdir}/prototype.final" />
<arg line="-d ${package.dir}" />
</exec>
<!-- create a single stream pkg -->
<exec executable="pkgtrans" failonerror="true">
<arg line="-s ${package.dir}" />
<arg value="${package.dir}/${svr4.pkg.name}.pkg" />
<arg value="${svr4.pkg.name}" />
</exec>
<!-- compress it (saves ~6.5 MB) -->
<exec executable="gzip" failonerror="true">
<arg value="-9" />
<arg value="-f" />
<arg value="${package.dir}/${svr4.pkg.name}.pkg" />
</exec>
</target>
<!-- ########################### TESTING ############################## -->
<target name="test.help"
description="Show info about test tuning parameters."
>
<echo message="Please read etc/test.help.txt !" />
</target>
description="Setup essential DS unit test environment."
>
<fileset dir="${lib.dir}/jar">
<selector refid="test.libs"/>
</fileset>
</path>
<!-- If we are to perform coverage tests, then set that up -->
<pathelement location="${emma.dir}/emma_ant.jar" />
</path>
<copy todir="${unittest.classes.dir}">
</copy>
</path>
<mkdir dir="${unittest.resource.dir}" />
<mkdir dir="${unittest.classes.dir}" />
</target>
<!-- If we were asked to run only the tests that failed, then we overwrite
the testng.xml that we just generated with testng-failed.xml, which
TestNG generated -->
if="test.failures"
>
<!-- Ensure that some of the tests failed last time. -->
<available property="testng-failed.xml.exists"
file="${unittest.report.dir}/testng-failed.xml"/>
<fail message="No unit tests failed in the previous run."
unless="testng-failed.xml.exists"/>
<copy file="${unittest.report.dir}/testng-failed.xml"
tofile="${unittest.resource.dir}/testng.xml"
>
<!-- We replace the 'Failed suite [OpenDS]' with 'OpenDS' so we don't
end up with 'Failed suite [Failed suite [OpenDS]]]' etc. -->
<filterset>
<filter token="Failed suite [OpenDS]" value="OpenDS"/>
<filter token="default(failed)" value="default"/>
</filterset>
</copy>
<echo message="Will run the failed unit tests only"/>
</target>
<!-- Prep the default TestNG XML file -->
unless="test.failures"
>
<not>
<or>
<isset property="test.packages" />
<isset property="test.classes" />
<isset property="test.methods" />
</or>
</not>
</condition>
<!-- do not run tests dependent upon creation of the .zip file -->
<condition property="test.packages"
value="org.opends.server.*,org.opends.messages.*"
>
<and>
<not>
<or>
<isset property="test.classes" />
<isset property="test.methods" />
</or>
</not>
<not>
</not>
</and>
</condition>
<!-- run tests dependent upon creation of the .zip file -->
<condition property="test.packages"
value="org.opends.server.*,org.opends.messages.*,
>
<and>
<not>
<or>
<isset property="test.classes" />
<isset property="test.methods" />
</or>
</not>
</and>
</condition>
</condition>
classpathref="build.tools" />
<preptestng file="${testng.dir}/testng.xml"
tofile="${unittest.resource.dir}/testng.xml"
grouplist="${test.groups}"
packagelist="${test.packages}"
classList="${test.classes}"
methodList="${test.methods}" />
</target>
if="jdmk.present"
>
<!-- Compile the SNMP test cases -->
<classpath>
<path refid="run.classpath" />
<path refid="opendj.test.jars"/>
<path refid="testng.jars" />
</classpath>
</javac>
</target>
<!-- Compile the test cases -->
<javac srcdir="${unittest.testng.src.dir}"
destdir="${unittest.classes.dir}"
<classpath>
<path refid="run.classpath" />
<path refid="opendj.test.jars"/>
<path refid="testng.jars" />
</classpath>
</javac>
</target>
<!-- Phased out for IDE users to be able to create a proper testng.xml
without actually running the tests -->
<target name="test.prepare"
description="Prepare to run DS unit tests." />
<taskdef resource="testngtasks">
<classpath refid="testng.jars" />
</taskdef>
<property name="TESTASSERT" value="false" />
<condition property="org.opends.test.suppressOutput"
value="false" else="true"
>
</condition>
<property name="org.opends.server.debug.target"
value="org.opends.server:level=warning,category=caught|data|database-access|message|protocol,stack,cause"
/>
<!-- If the debug port was set, we pass the options into the 'testng'
target below. E.g.:
-Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
-->
<condition property="jvm.debug.arg1"
value="-Xdebug" else="-Dopends.bogus.debug.arg1"
>
<isset property="test.remote.debug.port" />
</condition>
<condition property="jvm.debug.arg2"
value="-Xnoagent" else="-Dopends.bogus.debug.arg2"
>
<isset property="test.remote.debug.port" />
</condition>
<condition property="jvm.debug.arg3"
value="-Djava.compiler=NONE" else="-Dopends.bogus.debug.arg3"
>
<isset property="test.remote.debug.port" />
</condition>
<condition property="jvm.debug.arg4"
value="-Xrunjdwp:transport=dt_socket,server=y,suspend=${test.remote.debug.suspend},address=${test.remote.debug.port}"
else="-Dopends.bogus.debug.arg4"
>
<isset property="test.remote.debug.port" />
</condition>
<!-- Cleanout the old reports. Otherwise, the old testng-failed.xml
will hang around even if all of the tests pass -->
<mkdir dir="${unittest.report.dir}" />
<!-- Our testng listener will remove this file if all of the tests
passed. This allows us to generate the coverage report even if the
tests failed and still fail the build -->
<touch file="${unittest.report.dir}/.tests-failed-marker"/>
<emma enabled="${coverage.enabled}">
metadatafile="${coverage.data.dir}/metadata.emma" merge="true" />
</emma>
verbose="${testng.verbosity0to5}" enableAssert="${TESTASSERT}"
listeners="org.opends.server.TestListener
useDefaultListeners="false"
suiteRunnerClass="org.opends.server.SuiteRunner"
>
<classpath>
<pathelement location="${coverage.instr.dir}" />
<pathelement location="${unittest.classes.dir}" />
<pathelement location="${resource.dir}" />
<path refid="run.classpath" />
<path refid="emma.jars" />
<path refid="opendj.test.jars"/>
<!-- Needed by quicksetup tests -->
<path refid="build.tools" />
<path refid="testng.jars" />
</classpath>
<jvmarg value="-Demma.coverage.out.file=${coverage.data.dir}/unit.emma" />
<jvmarg value="-Demma.coverage.out.merge=false" />
<jvmarg value="-Dorg.opends.server.BuildRoot=${basedir}" />
<jvmarg value="-Dorg.opends.server.BuildDir=${build.dir}" />
<jvmarg value="-Dorg.opends.server.RunningUnitTests=true" />
<jvmarg value="-Dorg.opends.server.snmp.opendmk=${opendmk.lib.dir}"/>
<jvmarg value="-Dorg.opends.test.suppressOutput=${org.opends.test.suppressOutput}" />
<jvmarg value="-Dorg.opends.test.pauseOnFailure=${org.opends.test.pauseOnFailure}" />
<jvmarg value="-Dorg.opends.server.debug.target=${org.opends.server.debug.target}" />
<jvmarg value="-Dorg.opends.test.copyClassesToTestPackage=${org.opends.test.copyClassesToTestPackage}" />
<jvmarg value="-Dtest.progress=${test.progress}" />
<jvmarg value="-Xms${MEM}" />
<jvmarg value="-Xmx${MEM}" />
<jvmarg value="${jvm.debug.arg1}" />
<jvmarg value="${jvm.debug.arg2}" />
<jvmarg value="${jvm.debug.arg3}" />
<jvmarg value="${jvm.debug.arg4}" />
</testng>
<!-- Our testng listener will create this file if any of the tests
failed. This allows us to generate the coverage report even if the
tests failed -->
<available property="testng.tests.failed"
file="${unittest.report.dir}/.tests-failed-marker"/>
<!-- Delete all of the report suite sub-directories since we only have
a single suite -->
<emma enabled="${coverage.enabled}" >
<report sourcepath="${src.dir}" >
<fileset dir="${coverage.data.dir}"
includes="unit.emma,metadata.emma" />
<txt outfile="${coverage.report.dir}/coverage.txt" />
<html outfile="${coverage.report.dir}/index.html" />
<xml outfile="${coverage.report.dir}/coverage.xml" />
</report>
</emma>
<!-- We delay failing until after the coverage report is generated -->
</target>
<!-- Internal target to prepare to generate a code coverage report -->
<target name="test.enable.coverage">
<mkdir dir="${coverage.dir}" />
<mkdir dir="${coverage.data.dir}" />
<mkdir dir="${coverage.instr.dir}" />
<mkdir dir="${coverage.report.dir}" />
</target>
<target name="test.enable.slow">
<!-- props are read-only, once set. So this prevents the fallback to
value='exclude=slow' in test -->
<not>
<or>
<isset property="test.packages" />
<isset property="test.classes" />
<isset property="test.methods" />
</or>
</not>
</condition>
</target>
<target name="test.enable.assertions">
<property name="TESTASSERT" value="true"/>
</target>
<target name="test.all"
depends="test.enable.slow,test.enable.assertions,test"
description="Run all unit tests (including 'slow' ones)."/>
description="Run DS unit tests + coverage report." />
description="Run all unit tests (including 'slow' ones) + coverage report" />
description="HTMLize unit test results.">
<junitreport todir="${unittest.report.dir}">
</junitreport>
</target>
<!-- ##################### PRE COMMIT CHECKS ######################### -->
<!-- Check modified files to see if any copyright fixes are needed -->
description="Check modified files: copyright info."
>
<taskdef name="checkprecommit"
classname="org.opends.build.tools.CheckPrecommit"
>
<classpath refid="build.tools" />
</taskdef>
<checkprecommit />
</target>
<!-- check if the english generated files are different from the ones used
for localization and copy the files that are different to a directory
named diff -->
includes="*.properties">
</fileset>
</copy>
<condition property="dir_empty">
<length length="0">
<fileset refid="fs"/>
</length>
</condition>
<fail unless="dir_empty" message="
Generated admin message properties files differ from existing files: Copy all
files from ${msgl10n.diff.dir}/diff to ${msgl10n.prop.dir}
and include them for commit to resolve." />
</target>
<!-- Ensure that the source code meets basic style requirements. -->
<mkdir dir="${checkstyle.cache.dir}" />
<taskdef resource="checkstyletask.properties"
classpath="${checkstyle.dir}/checkstyle-all-4.1.jar" />
<checkstyle config="${checkstyle.dir}/opends-checkstyle.xml">
excludes="**/PublicAPI.java" />
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-checkstyle.xml">
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-checkstyle.xml">
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-checkstyle.xml">
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-checkstyle.xml">
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-checkstyle.xml">
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-checkstyle.xml">
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-doctarget-checkstyle.xml">
includes="**/*.java" />
includes="**/*.java" excludes="**/PublicAPI.java"/>
</checkstyle>
<checkstyle config="${checkstyle.dir}/opends-unittest-checkstyle.xml">
</checkstyle>
</target>
<!-- The build target that should be used before committing code -->
<target name="precommit"
depends="clean,check.style,check.eol+copy,check.l10nmessages,
pkg.generic,dsml,test"
description="Perform needed checks before committing code." />
<!-- ############################# MISC ############################### -->
description="Archive the server source into a zip file."
>
</zip>
</target>
<!-- The build target that should be used for build part of nightly builds -->
depends="clean,check.style,compile.dsml,api,guide,src.zip" />
<!-- The build target that should be used for nightly builds -->
description="Build nightly incl. tests." />
<!-- The build target that should be used to build everything. -->
<!-- target name="all" description="Build using all defined targets."
depends="nightly" / -->
description="Remove all generated source files incl. build dirs."
>
<delete file="${dynconstants.file}" />
<delete dir="eclipse-build" failonerror="false" />
</target>
description="Remove all files and dirs producible by this build."
>
</target>
description="Create a temp. data instance dir for internal testing."
>
<copy todir="${instance.dir}">
<fileset dir="${PROTO}/template" />
</copy>
<!-- inital password is 'password' -->
<replaceregexp file="${instance.dir}/config/config.ldif"
match="ds-cfg-listen-port: 389"
replace="ds-cfg-listen-port: 1389"/>
<echo message="Remember to set INSTANCE_ROOT:${line.separator}
setenv INSTANCE_ROOT '${instance.dir}'${line.separator}
export INSTANCE_ROOT='${instance.dir}'" />
</target>
<!-- don't include in any dependency settings - the developer should call it
explicitly if needed! -->
<target name="clean.instance"
description="Reomve the current instance.dir unconditionally!"
>
</target>
<!-- Internal target to run the Directory Server directly -->
failonerror="true"
>
<classpath refid="run.classpath"/>
<jvmarg value="-Dorg.opends.server.scriptName=start-ds"/>
<jvmarg value="-Dorg.opends.server.InstallRoot=${PROTO}"/>
<jvmarg value="-Dorg.opends.server.InstanceRoot=${instance.dir}"/>
<arg value="--configClass=org.opends.server.extensions.ConfigFileHandler"/>
<arg value="--configFile=${instance.dir}/config/config.ldif"/>
<arg value="--nodetach"/>
</java>
</target>
<!-- Internal target to run directly dsconfig -->
failonerror="true"
>
<classpath refid="run.classpath"/>
<jvmarg value="-Dorg.opends.server.scriptName=dsconfig" />
<jvmarg value="-Dorg.opends.server.InstallRoot=${PROTO}"/>
<jvmarg value="-Dorg.opends.server.InstanceRoot=${instance.dir}"/>
</java>
</target>
<!-- ####################### ECLIPSE ################################## -->
<!-- The src tree layout is so stupid -> need to package stuff like
message property files (res bundles) to avoid classpath
overlapping, which actually means, that we need to re-build
this jar, if a *.properties/*Message stuff gets changed. =8-( -->
<jar destfile="${lib.dir}/opendj-resources.jar">
<fileset dir="${build.dir}/classes"
includes="**/meta/*.properties,**/*.manifest"/>
</jar>
<!-- there is per default no JRE variable in eclipse anymore :( -->
failonerror="true"/>
</target>
description="Generate stuff required to make eclipse IDE happy.">
<fail unless="${jdmk.present}"
message=":${line.separator}${line.separator}
Download the OpenDMK from https://opendmk.java.net and set property${line.separator}
opendmk.lib.dir build to the path, which contains the corresponding jars.
${line.separator} (see etc/build.properties)"/>
</target>
<!-- ####################### NETBEANS ################################## -->
<!-- Netbeans target to debug the Directory Server. -->
transport="dt_socket"
>
<classpath refid="run.classpath"/>
</nbjpdastart>
<classpath refid="run.classpath"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-Dorg.opends.server.scriptName=start-ds"/>
<jvmarg value="-Dorg.opends.server.InstallRoot=${PROTO}"/>
<jvmarg value="-Dorg.opends.server.InstanceRoot=${instance.dir}"/>
<jvmarg value="-Dorg.opends.server.debug.enabled=true"/>
<arg value="--configClass=org.opends.server.extensions.ConfigFileHandler"/>
<arg value="--configFile=${instance.dir}/config/config.ldif"/>
<arg value="--nodetach"/>
</java>
</target>
<!-- Netbeans target to profile the Directory Server. -->
<nbprofiledirect>
<classpath refid="run.classpath"/>
</nbprofiledirect>
<classpath refid="run.classpath"/>
<jvmarg value="${profiler.info.jvmargs.agent}"/>
<jvmarg value="-Dorg.opends.server.scriptName=start-ds"/>
<jvmarg value="-Dorg.opends.server.InstallRoot=${PROTO}"/>
<jvmarg value="-Dorg.opends.server.InstanceRoot=${instance.dir}"/>
<arg value="--configClass=org.opends.server.extensions.ConfigFileHandler"/>
<arg value="--configFile=${instance.dir}/config/config.ldif"/>
<arg value="--nodetach"/>
</java>
</target>
<!-- Netbeans target to debug dsconfig. -->
transport="dt_socket"
>
<classpath refid="run.classpath"/>
</nbjpdastart>
<classpath refid="run.classpath"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-Dorg.opends.server.scriptName=dsconfig" />
<jvmarg value="-Dorg.opends.server.InstallRoot=${PROTO}"/>
<jvmarg value="-Dorg.opends.server.InstanceRoot=${instance.dir}"/>
<jvmarg value="-Dorg.opends.server.debug.enabled=true"/>
</java>
</target>
</project>