blob: 44f8add84be1336986c80731b198be515dd2d03c [file] [log] [blame]
<project name="log4j" default="usage" basedir="." >
<!-- The build.properties file defines the parth to local jar files -->
<property file="build.properties"/>
<property name="version" value="1.3alpha-6"/>
<!-- The base directory relative to which most targets are built -->
<property name="base" value="."/>
<!-- The directory where source files are stored. -->
<property name="java.source.dir" value="src/java/"/>
<!-- The directory where the package-list file is found, ./ or -->
<!-- build/ -->
<property name="packaging.dir" value="build"/>
<!-- Deprecation warning? -->
<property name="deprecation" value="on"/>
<!-- Destination for compiled files -->
<property name="javac.dest" value="classes"/>
<!-- Source directory for the examples/ -->
<property name="examples.src" value="examples/src"/>
<!-- Destination for compiled files for examples/ -->
<property name="examples.javac.dest" value="examples/classes"/>
<!-- Destination for generated jar files -->
<property name="jar.dest" value="${basedir}"/>
<!-- The jar file that the jar task will generate -->
<property name="log4j.jar" value="log4j-${version}.jar"/>
<!-- the jar file for Chainsaw that will be generated -->
<property name="log4j-chainsaw.jar" value="log4j-chainsaw-${version}.jar"/>
<!-- Destination for documentation files -->
<property name="docs.dest" value="./docs"/>
<!-- Source directory for xml docs -->
<property name="xdocs.src" value="./src/xdocs"/>
<!-- Javac with debug on/off. Log4j without debug on is hard to debug, so leave this settint on. -->
<property name="debug" value="on"/>
<!-- Destination for javadoc generated files -->
<property name="javadoc.dest" value="docs/api"/>
<!-- Icons source directory. -->
<property name="icons.source" value="icons"/>
<!-- The stem where most log4j source code is located. -->
<property name="stem" value="org/apache/log4j"/>
<!-- Some targets needs a more precise stem. -->
<property name="BSTEM" value="${java.source.dir}/${stem}"/>
<!-- Directory where release images go. -->
<property name="dist.images" value="dist/images"/>
<!-- Directory for temporary files. -->
<property name="dist.tmp" value="dist/tmp"/>
<!-- Note that this property is duplicated in ugli.xml -->
<property name="path2ugli.properties" value="./classes/ugli.properties"/>
<!-- Construct compile classpath -->
<path id="compile.classpath">
<pathelement location="${javac.dest}"/>
<pathelement location="${javamail.jar}"/>
<pathelement location="${activation.jar}"/>
<pathelement location="${jaxp.jaxp.jar}"/>
<pathelement location="${jaxp.parser.jar}"/>
<pathelement location="${jms.jar}"/>
<pathelement location="${jmx.jar}"/>
<pathelement location="${jmx-extra.jar}"/>
<pathelement location="${servlet-api.jar}"/>
<pathelement location="${jdbc-stdext.jar}"/>
<pathelement location="${jndi.jar}"/>
<pathelement location="${jakarta-oro.jar}"/>
</path>
<!-- Construct classpath for building the html pages-->
<path id="site.classpath">
<fileset dir="${logging-site}/lib">
<include name="*.jar"/>
</fileset>
</path>
<!-- ================================================================= -->
<!-- Default target -->
<!-- ================================================================= -->
<target name="usage">
<echo>
These are the targets supported by this ANT build scpript:
build.core - compile core log4j classes. This target is dependent on JAXP, JNDI.
build.jms - build classes dependent on the JMS API.
build.db - build classes dependent on JDBC API
build.smtp - build classes dependent on Java Mail API
build.xml - build classes in the org.apache.log4j.xml package
build - compile all project files
log4j.jar - build the core log4j jar
log4j-'dep'.jar - where 'dep' is one of "optional", "jms", "db", "smtp" and "xml".
jar - build all jar files
build.chainsaw - build chainsaw classes
chainsaw.har - build chainsaw.jar
chainsaw - run chainsaw
javadoc - build project javadoc files
dist - will create a complete distribution in dist/
</echo>
</target>
<target name="jaxpCheck">
<available classname="javax.xml.parsers.DocumentBuilderFactory"
property="jaxp-present"/>
<fail unless="jaxp-present">
Could not find the JAXP API.
Please set the jaxp-api.jar property in the build.properties file.
</fail>
</target>
<target name="jndiCheck">
<available classname="javax.naming.Context" property="jndi-present">
<classpath refid="compile.classpath"/>
</available>
<fail unless="jndi-present">
The JNDI API is required to build ContextJNDISelector, which has
become a core log4j class. The JNDI API ships with JDK 1.3 and
later. For JDK 1.2, you can get the JNDI API from
http://java.sun.com/products/jndi/downloads/index.html
</fail>
</target>
<target name="jndi" depends="jndiCheck" if="jndi-present">
<echo message="JNDI is present."/>
</target>
<target name="oroCheck" >
<available classname="org.apache.oro.text.perl.Perl5Util" property="oro-present">
<classpath refid="compile.classpath"/>
</available>
<fail unless="oro-present">
Missing org.apache.oro.* classes.
Please make sure to that the "jakarta-oro.jar" poperty in build.properties
file is set correctly.
</fail>
</target>
<target name="jmsCheck" depends="jndiCheck">
<available classname="javax.jms.Message" property="jms-present">
<classpath refid="compile.classpath"/>
</available>
<fail unless="jms-present">
Missing java.jms.* classes.
Please make sure to that the "jms.jar" poperty in build.properties
file is set correctly.
</fail>
</target>
<target name="javamailCheck">
<available classname="javax.mail.Message" property="javamail-present">
<classpath refid="compile.classpath"/>
</available>
<fail unless="javamail-present">
Missing java.mail.* classes.
Please make sure to that the "jms.jar" poperty in build.properties
file is set correctly.
</fail>
</target>
<target name="servletAPICheck">
<available classname="javax.servlet.ServletContext" property="servletAPI-present">
<classpath refid="compile.classpath"/>
</available>
<fail unless="servletAPI-present">
Missing javax.servlet.* classes.
Please make sure to that the "servlet-api.jar" poperty in build.properties
file is set correctly.
</fail>
</target>
<target name="jdbcExtensionCheck">
<available classname="javax.sql.DataSource" property="jdbcExtension-present">
<classpath refid="compile.classpath"/>
</available>
<fail unless="jdbcExtension-present">
Missing javax.sql.* classes.
Please make sure to that the "jdbc-stdext.jar" poperty in build.properties
file is set correctly.
</fail>
</target>
<target name="init">
<tstamp />
<mkdir dir="${javac.dest}/"/>
<mkdir dir="${examples.javac.dest}/" />
</target>
<target name="build" description="Compile all log4j components."
depends="build.core, build.oro, build.jms, build.smtp, build.db,
build.examples, build.chainsaw"/>
<target name="requiredepsCheck"
depends="jndiCheck,jmsCheck,oroCheck,javamailCheck,servletAPICheck,jdbcExtensionCheck,jaxpCheck"
description="Compile all log4j components - fail if dependencies do not exist"
>
<condition property="alldeps.exist">
<and>
<isset property="jndi-present"/>
<isset property="oro-present"/>
<isset property="jms-present"/>
<isset property="javamail-present"/>
<isset property="servletAPI-present"/>
<isset property="jdbcExtension-present"/>
<isset property="jaxp-present"/>
</and>
</condition>
<fail unless="alldeps.exist">
Some jar files required to perform a full compile of log4j are not
available on the classpath. Update build.properties as needed.
</fail>
</target>
<target name="build.core" depends="init, jndiCheck, jaxpCheck">
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
includes="org/apache/ugli/**/*.java,
${stem}/**/*.java"
excludes="org/apache/ugli/impl/JDK14*.java,
**/UnitTest*.java,
**/StressCategory.java,
**/doc-files/*,
${stem}/chainsaw/**,
${stem}/db/**,
${stem}/test/serialization/**,
${stem}/net/SMTPAppender.java,
${stem}/net/JMS*.java,
${stem}/varia/LogFilePatternReceiver*.java,
${stem}/rule/LikeRule.java,
${stem}/or/jms/*.java,
${stem}/selector/servlet/*.java"
deprecation="on"
debug="${debug}"
>
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="build.chainsaw" depends="build.core, build.oro, build.xml">
<ant antfile="build-chainsaw.xml" target="build.chainsaw"/>
</target>
<target name="chainsaw.jar" depends="build.chainsaw, log4j.jar,
log4j-xml.jar,
log4j-optional.jar">
<ant antfile="build-chainsaw.xml" target="chainsaw.jar"/>
</target>
<target name="chainsaw" depends="log4j.jar, log4j-xml.jar, log4j-optional.jar"
description="Builds and runs Chainsaw v2" >
<ant antfile="build-chainsaw.xml" target="chainsaw"/>
</target>
<target name="webstart" depends="build.chainsaw">
<ant antfile="build-chainsaw.xml" target="webstart"/>
</target>
<!-- ================================================= -->
<!-- Compile examples -->
<!-- ================================================= -->
<target name="build.examples" depends="build.core">
<mkdir dir="${examples.javac.dest}" />
<javac srcdir="${examples.src}"
destdir="${examples.javac.dest}"
includes="**/*.java"
excludes="**/jmx/*.java"
deprecation="${deprecation}"
debug="${debug}"
>
<classpath refid="compile.classpath"/>
</javac>
<rmic base="${examples.javac.dest}" classname="factor.NumberCruncherServer" />
</target>
<target name="ugli.jar">
<ant antfile="ugli.xml" target="jar"/>
</target>
<target name="build.xml" depends="init, jaxpCheck">
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
includes="${stem}/xml/**/*.java"
excludes="${stem}/xml/DOMConfigurator.java,
${stem}/xml/examples/doc-files/**.java"
deprecation="${deprecation}"
debug="${debug}"
>
<classpath refid="compile.classpath"/>
</javac>
<copy file="${BSTEM}/xml/log4j.dtd"
tofile="${javac.dest}/${stem}/xml/log4j.dtd" />
<copy file="${BSTEM}/xml/logger.dtd"
tofile="${javac.dest}/${stem}/xml/logger.dtd" />
</target>
<target name="log4j-xml.jar" depends="init, jaxpCheck, build.xml">
<jar jarfile="log4j-xml.jar" basedir="${javac.dest}"
includes="${stem}/xml/*.class,
${stem}/xml/*.dtd"
excludes="${stem}/xml/DOMConfigurator.class,
${stem}/xml/XMLLayout.class"
>
<manifest>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j-xml"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</target>
<target name="build.smtp" depends="init, javamailCheck">
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
debug="${debug}"
deprecation="${deprecation}"
includes="${stem}/net/SMTPAppender.java"
>
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="log4j-smtp.jar" depends="init, build.smtp"
if="javamail-present">
<jar jarfile="log4j-smtp.jar" basedir="${javac.dest}"
includes="${stem}/spi/TriggeringEventEvaluator.class,
${stem}/net/SMTPAppender.class,
${stem}/net/DefaultEvaluator.class"
>
<manifest>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j-jms"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</target>
<!-- Jakarta-ORO dependencies -->
<target name="build.oro" depends="init, oroCheck">
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
deprecation="${deprecation}"
includes="${stem}/varia/LogFilePatternReceiver*.java,
${stem}/rule/LikeRule.java"
debug="${debug}"
>
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="log4j-oro.jar" depends="init, oroCheck, build.oro">
<jar jarfile="log4j-oro.jar" basedir="${javac.dest}"
includes="${stem}/varia/LogFilePatternReceiver*.class,
${stem}/rule/LikeRule.class"
>
<manifest>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j-oro"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</target>
<!-- JMS API dependencies -->
<target name="build.jms" depends="init, jmsCheck, jndi">
<javac srcdir="${java.source.dir}"
debug="${debug}"
deprecation="${deprecation}"
destdir="${javac.dest}"
includes="${stem}/net/JMS*.java"
>
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="log4j-jms.jar" depends="init, build.jms"
if="jms-present">
<jar jarfile="log4j-jms.jar" basedir="${javac.dest}"
includes="${stem}/net/JMSAppender.class,
${stem}/net/JMSSink.class,
${stem}/net/JMSReceiver.class,
${stem}/or/jms/*.class"
>
<manifest>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j-jms"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</target>
<target name="build.servletAPI" depends="init, servletAPICheck">
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
debug="${debug}"
deprecation="${deprecation}"
includes="${stem}/selector/servlet/*.java">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="build.db" depends="init, jdbcExtensionCheck">
<javac srcdir="${java.source.dir}"
destdir="${javac.dest}"
deprecation="${deprecation}"
debug="${debug}"
includes="${stem}/db/**.java">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="log4j-db.jar" depends="init, jdbcExtensionCheck">
<jar jarfile="log4j-db.jar" basedir="${javac.dest}"
includes="${stem}/db/**.class"
>
<manifest>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j-db"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</target>
<target name="log4j-optional.jar" depends="init, build.core">
<jar jarfile="log4j-optional.jar" basedir="${javac.dest}"
includes="${stem}/net/Multicast*.class,
${stem}/net/UDP*.class,
${stem}/net/SocketHub*.class,
${stem}/net/Telnet*.class"
>
<manifest>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j-db"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</target>
<!-- ================================================================= -->
<!-- Remove all generated (compiled) class files. -->
<!-- ================================================================= -->
<target name="clean" depends="init" description="Delete all compiled files.">
<delete>
<fileset dir="${javac.dest}/" includes="**/*"/>
<fileset dir="${examples.javac.dest}/" includes="**/*"/>
<fileset dir="." includes="log4j*.jar"/>
<fileset dir="." includes="ugli-*.jar"/>
</delete>
</target>
<!-- ================================================================= -->
<!-- Actual work is done in the dependencies. -->
<!-- ================================================================= -->
<target name="jar" depends="ugli.jar, log4j.jar, log4j-optional.jar,
chainsaw.jar, log4j-jms.jar, log4j-smtp.jar,
log4j-db.jar, log4j-oro.jar, log4j-xml.jar">
</target>
<!-- ================================================================= -->
<!-- Create log4j.jar, excluding tests and other odds and ends. -->
<!-- ================================================================= -->
<target name="log4j.jar" depends="build.core, build.servletAPI">
<delete file="${log4j.jar}" verbose="true"/>
<delete file="${path2ugli.properties}"/>
<!-- Much depends on setting up ugli.properties file correctly -->
<propertyfile file="${path2ugli.properties}" comment="log4j implementation">
<entry key="ugli.factoryAdapterClass" value="org.apache.ugli.impl.Log4jLoggerFA"/>
</propertyfile>
<jar jarfile="${jar.dest}/${log4j.jar}" basedir="${javac.dest}"
includes="ugli.properties,
org/apache/ugli/**/*.class
${stem}/*.class,
${stem}/joran/**/*.class,
${stem}/config/*.class,
${stem}/helpers/*.class,
${stem}/spi/**/*.class,
${stem}/net/*.class,
${stem}/html/**/*.class,
${stem}/filter/*.class,
${stem}/rule/*.class,
${stem}/rolling/**/*.class,
${stem}/xml/*.class,
${stem}/scheduler/*.class,
${stem}/selector/*.class,
${stem}/selector/servlet/*.class,
${stem}/pattern/*.class,
${stem}/or/*.class,
${stem}/or/sax/*.class,
${stem}/varia/ListAppender.class
${stem}/plugins/*.class,
${stem}/config/*.class"
excludes="org/apache/ugli/**/JDK14*.class,
**/UnitTest**,
${stem}/xml/Log4jEntityResolver.class,
${stem}/xml/UtilLoggingEntityResolver.class,
${stem}/xml/SAXErrorHandler.class,
${stem}/xml/UtilLoggingXMLDecoder.class,
${stem}/xml/XMLDecoder.class,
${stem}/net/SMTPAppender.class,
${stem}/net/DefaultEvaluator.class,
${stem}/spi/TriggeringEventEvaluator.class,
${stem}/net/JMSAppender.class,
${stem}/net/JMSSink.class,
${stem}/net/JMSReceiver.class,
${stem}/**/*BeanInfo.class
${stem}/varia/LogFilePatternReceiver*.class,
${stem}/rule/LikeRule.class,
${stem}/net/Multicast*.class,
${stem}/net/UDP*.class,
${stem}/net/SocketHub*.class,
${stem}/net/Telnet*.class,
${stem}/pattern/StackPatternConverter.class,
${stem}/DUMMY.java"
>
<manifest>
<attribute name="Manifest-version" value="1.0"/>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
<!-- remove ugli.properties when done -->
<delete file="${path2ugli.properties}"/>
</target>
<!-- ================================================================= -->
<!-- This target builds the javadoc files. -->
<!-- ================================================================= -->
<target name="javadoc" depends="init">
<mkdir dir="${javadoc.dest}" />
<javadoc sourcepath="${java.source.dir}"
destdir="${javadoc.dest}"
packagenames="org.apache.log4j,
org.apache.log4j.db,
org.apache.log4j.db.dialect,
org.apache.log4j.plugins,
org.apache.log4j.config,
org.apache.log4j.helpers,
org.apache.log4j.net,
org.apache.log4j.nt,
org.apache.log4j.or,
org.apache.log4j.or.sax,
org.apache.log4j.or.jms,
org.apache.log4j.pattern,
org.apache.log4j.rolling,
org.apache.log4j.rolling.helper,
org.apache.log4j.selector,
org.apache.log4j.spi,
org.apache.log4j.filter,
org.apache.log4j.varia,
org.apache.log4j.rule,
org.apache.log4j.xml,
org.apache.log4j.xml.examples,
org.apache.joran,
org.apache.joran.action,
org.apache.log4j.joran,
org.apache.log4j.joran.action,
org.apache.ugli,
org.apache.ugli.impl"
additionalparam="-breakiterator"
version="true"
protected="true"
author="true"
use="true"
overview="${docs.dest}/overview.html"
doctitle="log4j version ${version}&lt;br&gt;API Specification"
windowtitle="Log4j Version ${version}"
header="&lt;b&gt;Log4j ${version}&lt;/b&gt;"
bottom="Copyright 2000-2005 Apache Software Foundation.">
<link href="http://java.sun.com/products/j2se/1.3/docs/api/"/>
<link href="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"/>
<classpath refid="compile.classpath"/>
<classpath path="${regexp.oro.jar}"/>
</javadoc>
</target>
<!-- ============================================== -->
<!-- Build the site files using Anakia -->
<!-- ============================================== -->
<target name="prepareSite">
<available classname="org.apache.velocity.anakia.AnakiaTask"
property="AnakiaTask.present">
<classpath refid="site.classpath"/>
</available>
</target>
<target name="checkSite" depends="prepareSite" unless="AnakiaTask.present">
<echo>
AnakiaTask is not present! Please check to make sure that
velocity.jar is in your classpath.
</echo>
</target>
<target name="site" depends="checkSite" if="AnakiaTask.present">
<taskdef name="anakia" classname="org.apache.velocity.anakia.AnakiaTask">
<classpath refid="site.classpath"/>
</taskdef>
<mkdir dir="${docs.dest}/css"/>
<copy file="${logging-site}/docs/css/site.css" tofile="${docs.dest}/css/site.css"/>
<anakia basedir="${xdocs.src}" destdir="${docs.dest}/"
extension=".html"
style="site.vsl"
projectFile="stylesheets/project.xml"
excludes="**/stylesheets/**, empty.xml"
includes="**/*.xml"
lastModifiedCheck="true"
templatePath="${logging-site}/src/xdocs/stylesheets">
</anakia>
</target>
<!-- ================================================================= -->
<!-- Build a complete distribution. Results go to ${dist.images} -->
<!-- ================================================================= -->
<target name="dist" depends="init, clean, requiredepsCheck, javadoc, jar, site">
<delete verbose="true">
<fileset dir=".">
<patternset>
<include name="**/*.bak"/>
<include name="${BSTEM}/**/temp*"/>
<include name="${BSTEM}/performance/test"/>
<include name="${BSTEM}/test/current.*"/>
<include name="${BSTEM}/test/current.*"/>
<include name="${BSTEM}/examples/test"/>
<include name="${BSTEM}/test/logging.*"/>
<include name="${BSTEM}/test/log4j.properties"/>
<include name="${$BSTEM}/test/socket.lcf"/>
<include name="${BSTEM}/test/file"/>
<include name="${BSTEM}/net/test/loop.log"/>
<include name="${BSTEM}/net/test/loop.log.1"/>
</patternset>
</fileset>
</delete>
<mkdir dir="${dist.images}" />
<mkdir dir="${dist.tmp}/logging-log4j-${version}" />
<copy todir="${dist.tmp}/logging-log4j-${version}">
<fileset dir="${base}"
includes="src/java/**,
docs/**,
examples/**,
build.xml,
build.properties.sample,
INSTALL.txt,
LICENSE.txt,
ugli-*.jar,
log4j-*.jar"
excludes="**/*.bak,
**/goEnv.bat,
docs/pub-support/*,
src/java/org/apache/log4j/test/**/*,
**/.#*"
/>
</copy>
<tar tarfile="${dist.images}/logging-log4j-${version}.tar"
basedir="${dist.tmp}"
includes="logging-log4j-${version}/**" />
<gzip src="${dist.images}/logging-log4j-${version}.tar"
zipfile="${dist.images}/logging-log4j-${version}.tar.gz" />
<zip zipfile="${dist.images}/logging-log4j-${version}.zip"
basedir="${dist.tmp}"
includes="logging-log4j-${version}/**" />
<delete dir="${dist.tmp}" />
</target>
</project>