| |
| <!-- This file is an ANT build script. ANT is a Java based build tool. --> |
| <!-- It is availale from http://jakarta.apache.org/ant/ --> |
| |
| |
| <!-- ================================================================= --> |
| <!-- NOTE: all directories are relative to jakarta-log4j/ --> |
| <!-- the parent of build/ --> |
| <!-- ================================================================= --> |
| <project name="log4j" default="usage" basedir="." > |
| |
| |
| <!-- The build.properties file defines the parth to local jar files --> |
| <property file="build.properties"/> |
| |
| <!-- Read the system environment variables and stores them in properties, --> |
| <!-- prefixed with "env". --> |
| <property environment="env"/> |
| |
| <property name="version" value="1.2.1"/> |
| |
| <!-- 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"/> |
| |
| <!-- Destination for compiled files --> |
| <property name="javac.dest" value="dist/classes"/> |
| |
| <!-- Destination for generated jar files --> |
| <property name="jar.dest" value="dist/lib"/> |
| |
| <property name="jar.filename" value="log4j-${version}.jar"/> |
| |
| |
| <!-- Destination for documentation files generated or not --> |
| <property name="docs" value="docs"/> |
| |
| <!-- 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}"/> |
| |
| <!-- Original manifest.mf file before filtering. --> |
| <property name="manifest.src" value="build/manifest.mf"/> |
| |
| <!-- Directory where release images go. --> |
| <property name="dist.images" value="dist/images"/> |
| |
| <!-- Directory for temporary files. --> |
| <property name="dist.tmp" value="dist/tmp"/> |
| |
| |
| <!-- Construct compile classpath --> |
| <path id="compile.classpath"> |
| <pathelement location="${build.home}/classes"/> |
| <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}"/> |
| </path> |
| |
| |
| <!-- ================================================================= --> |
| <!-- Default target --> |
| <!-- ================================================================= --> |
| |
| <target name="usage"> |
| <echo> |
| |
| These are the targets supported by this ANT build scpript: |
| |
| build - compile all project files, if a certain library is missing, |
| then the compilation of its dependents are skipped. |
| |
| javadoc - build project javadoc files |
| |
| jar - build log4j-core and log4j jar files |
| |
| dist - will create a complete distribution in dist/ |
| Setting the env variable NO_JAVADOC will build the distribution |
| without running the javadoc target. |
| </echo> |
| </target> |
| |
| <target name="jaxpCheck"> |
| <available classname="javax.xml.parsers.DocumentBuilderFactory" |
| property="jaxp-present"/> |
| </target> |
| |
| <target name="jaxp" depends="jaxpCheck" if="jaxp-present"> |
| <echo message="JAXP present."/> |
| </target> |
| |
| |
| <target name="jmxCheck"> |
| <available classname="javax.management.MBeanInfo" property="jmx-present"> |
| <classpath> |
| <pathelement location="${jmx.jar}"/> |
| </classpath> |
| </available> |
| </target> |
| <target name="jmx" depends="jmxCheck" if="jmx-present"> |
| <echo message="JMX is present."/> |
| </target> |
| |
| |
| <target name="jmsCheck"> |
| <available classname="javax.jms.Message" property="jms-present"> |
| <classpath> |
| <pathelement location="${jms.jar}"/> |
| </classpath> |
| </available> |
| </target> |
| <target name="jms" depends="jmsCheck" if="jms-present"> |
| <echo message="JMS is present."/> |
| </target> |
| |
| <target name="jndiCheck"> |
| <available classname="javax.naming.Context" property="jndi-present"/> |
| </target> |
| <target name="jndi" depends="jndiCheck" if="jndi-present"> |
| <echo message="JNDI is present."/> |
| </target> |
| |
| <target name="javamailCheck"> |
| <available classname="javax.mail.Message" property="javamail-present"> |
| <classpath> |
| <pathelement location="${javamail.jar}"/> |
| </classpath> |
| </available> |
| </target> |
| <target name="javamail" depends="javamailCheck" if="javamail-present"> |
| <echo message="JAVAMAIL is present."/> |
| </target> |
| |
| <!-- ================================================================= --> |
| <!-- Initialize variables --> |
| <!-- NOTE: all directories are relative to jakarta-log4j/ --> |
| <!-- ================================================================= --> |
| <target name="init"> |
| <tstamp /> |
| </target> |
| |
| <target name="build" depends="init, build.core, build.examples, build.xml, |
| build.javamail, build.jms, build.jmx"/> |
| |
| <target name="build.core" depends="init"> |
| <mkdir dir="${javac.dest}" /> |
| <javac srcdir="${java.source.dir}" |
| destdir="${javac.dest}" |
| includes="${stem}/**/*.java, ${stem}/xml/XMLLayout.java," |
| excludes="misc/*, **/UnitTest*.java, |
| **/StressCategory.java, |
| **/doc-files/*, |
| ${stem}/xml/**, |
| ${stem}/test/serialization/**, |
| ${stem}/net/SMTPAppender.java, |
| ${stem}/net/JMS*.java, |
| ${stem}/jmx/*.java, |
| ${stem}/or/jms/*.java" |
| deprecation="${deprecation}" |
| debug="on"> |
| <classpath refid="compile.classpath"/> |
| </javac> |
| |
| </target> |
| |
| <target name="build.examples" depends="build.core"> |
| <mkdir dir="${javac.dest}" /> |
| <javac srcdir="${basedir}" |
| destdir="${javac.dest}" |
| includes="examples/**/*.java" |
| classpath="${classpath}" |
| excludes="misc/*" |
| deprecation="${deprecation}" |
| debug="on"/> |
| <rmic base="${javac.dest}" |
| classname="examples.NumberCruncherServer" |
| /> |
| </target> |
| |
| <target name="build.xml" depends="init, jaxp" if="jaxp-present"> |
| <javac srcdir="${java.source.dir}" |
| destdir="${javac.dest}" |
| includes="${stem}/xml/**/*.java" |
| excludes="${stem}/xml/examples/doc-files/**.java, |
| ${stem}/xml/Transform.java" |
| deprecation="${deprecation}" |
| classpath="${classpath}"> |
| <classpath refid="compile.classpath"/> |
| </javac> |
| <copy file="${BSTEM}/xml/log4j.dtd" |
| tofile="${javac.dest}/${stem}/xml/log4j.dtd" /> |
| </target> |
| |
| <target name="build.javamail" depends="init, javamail" |
| if="javamail-present"> |
| <javac srcdir="${java.source.dir}" |
| destdir="${javac.dest}" |
| deprecation="${deprecation}" |
| includes="${stem}/net/SMTPAppender.java"> |
| <classpath refid="compile.classpath"/> |
| </javac> |
| </target> |
| |
| <target name="build.jms" depends="init, jms, jndi" if="jms-present"> |
| <javac deprecation="${deprecation}" |
| srcdir="${java.source.dir}" |
| destdir="${javac.dest}" |
| includes="${stem}/net/JMS*.java"> |
| <classpath refid="compile.classpath"/> |
| </javac> |
| </target> |
| |
| <target name="build.jmx" depends="init, jmx, jndi" if="jmx-present"> |
| <javac deprecation="${deprecation}" |
| srcdir="${java.source.dir}" |
| destdir="${javac.dest}" |
| includes="${stem}/jmx/*.java" |
| excludes="${stem}/jmx/T.java"> |
| <classpath refid="compile.classpath"/> |
| </javac> |
| </target> |
| |
| |
| <!-- ================================================================= --> |
| <!-- Remove all generated (compiled) class files. --> |
| <!-- ================================================================= --> |
| <target name="clean" depends="init"> |
| <delete dir="${javac.dest}/" /> |
| </target> |
| |
| <!-- ================================================================= --> |
| <!-- Runs checkstyle. Available from http://checkstyle.sf.net --> |
| <!-- ================================================================= --> |
| <target name="checkstyle" depends="init"> |
| <taskdef resource="checkstyletask.properties" |
| classpath="build/lib/checkstyle-all-2.1.jar"/> |
| |
| <!-- by default checkstyle supports the Sun coding standard. --> |
| <checkstyle lcurlyMethod="nlow" |
| lcurlyOther="nlow" |
| lcurlyType="nlow" |
| maxMethodLen="500" |
| maxConstructorLen="500"> |
| <fileset dir="src/java/org/apache/log4j/chainsaw" includes="**/*.java"/> |
| </checkstyle> |
| </target> |
| |
| <!-- ================================================================= --> |
| <!-- Runs Chainsaw --> |
| <!-- ================================================================= --> |
| |
| <target name="chainsaw" depends="build"> |
| <!-- Need to fork to avoid problems --> |
| <java classname="org.apache.log4j.chainsaw.Main" fork="yes" |
| classpath="${javac.dest}"> |
| </java> |
| </target> |
| |
| <!-- ================================================================= --> |
| <!-- Remove the temporary manifest file, actual work is done in the --> |
| <!-- dependencies. --> |
| <!-- ================================================================= --> |
| <target name="jar" depends="log4j.jar"> |
| <delete file="${jar.dest}/manifest.mf"/> |
| </target> |
| |
| <target name="prejar" depends="build"> |
| <mkdir dir="${jar.dest}"/> |
| <filter token="version" value="${version}" /> |
| <copy file="${manifest.src}" tofile="${jar.dest}/manifest.mf" |
| filtering="true"/> |
| </target> |
| |
| <!-- ================================================================= --> |
| <!-- Create log4j.jar, excluding tests and other odds and ends. --> |
| <!-- ================================================================= --> |
| <target name="log4j.jar" depends="prejar"> |
| <delete> |
| <fileset dir="${jar.dest}"> |
| <include name="*.jar"/> |
| </fileset> |
| </delete> |
| |
| <jar jarfile="${jar.dest}/${jar.filename}" basedir="${javac.dest}" |
| includes="${stem}/*.class, ${stem}/xml/log4j.dtd, |
| ${stem}/config/*.class, |
| ${stem}/helpers/*.class, |
| ${stem}/spi/*.class, |
| ${stem}/net/*.class, |
| ${stem}/jdbc/*.class, |
| ${stem}/varia/*.class, |
| ${stem}/chainsaw/*.class, |
| ${stem}/nt/*.class, |
| ${stem}/xml/*.class, |
| ${stem}/jmx/*.class, |
| ${stem}/or/*.class, |
| ${stem}/or/sax/*.class, |
| ${stem}/or/jms/*.class, |
| ${stem}/config/*.class" |
| excludes="**/UnitTest**" |
| manifest="${jar.dest}/manifest.mf" |
| /> |
| </target> |
| |
| |
| <!-- ================================================================= --> |
| <!-- This target builds the javadoc files. --> |
| <!-- ================================================================= --> |
| <target name="javadoc" depends="init" unless="env.NO_JAVADOC"> |
| |
| <mkdir dir="${javadoc.dest}" /> |
| |
| <javadoc sourcepath="${java.source.dir}" |
| destdir="${javadoc.dest}" |
| packagenames="org.apache.log4j, |
| org.apache.log4j.config, |
| org.apache.log4j.helpers, |
| org.apache.log4j.jmx, |
| org.apache.log4j.net, |
| org.apache.log4j.nt, |
| org.apache.log4j.or, |
| org.apache.log4j.jdbc, |
| org.apache.log4j.or.sax, |
| org.apache.log4j.or.jms, |
| org.apache.log4j.performance, |
| org.apache.log4j.spi, |
| org.apache.log4j.varia, |
| org.apache.log4j.chainsaw, |
| org.apache.log4j.xml, |
| org.apache.log4j.xml.examples" |
| version="true" |
| protected="true" |
| author="true" |
| use="true" |
| overview="${docs}/overview.html" |
| doctitle="log4j version ${version}<br>API Specification" |
| windowtitle="Log4j Version ${version}" |
| header="<b>Log4j ${version}</b>" |
| bottom="Copyright 2000-2002 Apache Software Foundation."> |
| |
| <link offline="true" |
| href="http://java.sun.com/products/jdk/1.2/docs/api" |
| packageListLoc="${packaging.dir}"/> |
| <classpath refid="compile.classpath"/> |
| </javadoc> |
| </target> |
| |
| <!-- ================================================================= --> |
| <!-- Build a complete distribution. Results go to ${dist.images} --> |
| <!-- ================================================================= --> |
| <target name="dist" depends="init, clean, javadoc, jar"> |
| |
| <delete verbose="true"> |
| <fileset dir="."> |
| <patternset> |
| <include name="**/*.bak"/> |
| <include name="dist/velocity.log"/> |
| <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}/test/output.*"/> |
| <include name="${BSTEM}/nt/EventLogCategories.dbg"/> |
| <include name="${BSTEM}/nt/*.h"/> |
| <include name="${BSTEM}/nt/*.obj"/> |
| <include name="${BSTEM}/nt/*.idb"/> |
| <include name="${BSTEM}/nt/EventLogCategories.rc"/> |
| <include name="${BSTEM}/nt/EventLogCategories.RES"/> |
| <include name="${BSTEM}/nt/EventLogCategories.res"/> |
| <include name="${BSTEM}/nt/MSG00001.bin"/> |
| <include name="${BSTEM}/nt/NTEventLogAppender.lib"/> |
| <include name="${BSTEM}/nt/NTEventLogAppender.exp"/> |
| <include name="${BSTEM}/nt/vc50.idb"/> |
| <include name="${BSTEM}/net/test/loop.log"/> |
| <include name="${BSTEM}/net/test/loop.log.1"/> |
| <include name="${jar.dest}/manifest.mf"/> |
| <include name="${javac.dest}/*.class"/> |
| </patternset> |
| </fileset> |
| </delete> |
| |
| <mkdir dir="${dist.images}" /> |
| |
| <mkdir dir="${dist.tmp}/jakarta-log4j-${version}" /> |
| |
| <copy todir="${dist.tmp}/jakarta-log4j-${version}"> |
| <fileset dir="${base}" |
| includes="src/java/**, |
| docs/**, |
| examples/**, |
| build/*, |
| build.xml, |
| build.properties.sample, |
| manifest.mf, |
| INSTALL, |
| LICENSE.txt, |
| dist/lib/log4j*.jar, |
| dist/classes/**, |
| contribs/**" |
| excludes="make/make.loc, |
| **/*.bak, **/goEnv.bat, |
| **/Makefile, **/goEnv.bat, |
| docs/pub-support/*, |
| dist/classes/org/**, |
| src/java/org/apache/log4j/test/**/*, |
| **/.#*"/> |
| </copy> |
| |
| |
| <fixcrlf srcdir="${dist.tmp}/jakarta-log4j-${version}" |
| includes="build.sh" cr="remove"/> |
| <fixcrlf srcdir="${dist.tmp}/jakarta-log4j-${version}" |
| includes="build.bat" cr="add"/> |
| <chmod dir="${dist.tmp}/jakarta-log4j-${version}" |
| includes="build.sh" perm="+x"/> |
| |
| <tar tarfile="${dist.images}/jakarta-log4j-${version}.tar" |
| basedir="${dist.tmp}" |
| includes="jakarta-log4j-${version}/**" /> |
| |
| <gzip src="${dist.images}/jakarta-log4j-${version}.tar" |
| zipfile="${dist.images}/jakarta-log4j-${version}.tar.gz" /> |
| |
| <zip zipfile="${dist.images}/jakarta-log4j-${version}.zip" |
| basedir="${dist.tmp}" |
| includes="jakarta-log4j-${version}/**" /> |
| |
| |
| <delete dir="${dist.tmp}" /> |
| </target> |
| |
| </project> |
| |