blob: 10c81ee3fda2305a6f7167530fb8e7b3233f0975 [file] [log] [blame]
<project name="chainsaw" default="usage" basedir="." >
<!-- When building a Java Web Start distribution of Chainsaw, some Receivers with external dependencies need to be packaged into a seperate Jar -->
<property name="webstart-dependant-receivers.jar" value="webstart-dependant-receivers.jar-${version}.jar"/>
<!-- Construct compile classpath -->
<path id="compile.classpath">
<pathelement location="${javac.dest}"/>
<pathelement location="${vfs.jar}"/>
</path>
<path id="runtime.classpath">
<fileset dir=".">
<include name="log4j-*.jar"/>
</fileset>
<pathelement location="${vfs.jar}"/>
<pathelement location="${jaxp.parser.jar}"/>
<pathelement location="${jakarta-.oro.jar}"/>
<pathelement location="${jms.jar}"/>
</path>
<target name="usage">
<echo>
This build file cannot be invoked directly but only through
its parent build file, build.xml.
</echo>
</target>
<!-- This target is invoked through the build.chainsaw target in the parent build file
which depends on build.core ensuring that log4j core gets built before. -->
<target name="build.chainsaw" depends="vfs">
<mkdir dir="${javac.dest}" />
<javac deprecation="${deprecation}"
srcdir="${java.source.dir}"
debug="${debug}"
destdir="${javac.dest}">
<patternset>
<include name="${stem}/chainsaw/**/*.java"/>
<include name="${stem}/varia/ListModelAppender.java"/>
<exclude name="${stem}/chainsaw/vfs/**/*.java" unless="vfs-present"/>
</patternset>
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="log4jCheck">
<condition property="log4jJarsPresent">
<and>
<available filepath="${base}" file="${log4j.jar}"/>
<available filepath="${base}" file="log4j-xml.jar"/>
<available filepath="${base}" file="log4j-optional.jar"/>
</and>
</condition>
<fail unless="log4jJarsPresent">
One or more of the following files are missing:
${log4j.jar}, log4j-xml.jar log4j-optional.jar
</fail>
</target>
<target name="vfsCheck">
<available classname="org.apache.commons.vfs.FileObject" property="vfs-present">
<classpath refid="compile.classpath"/>
</available>
</target>
<target name="vfs" depends="vfsCheck" unless="vfs-present">
<echo>
Could not find vfs classes (http://jakarta.apache.org/commons/sandbox/vfs/).
Did you forget to set "vfs.jar" property in
build.properties to point to a valid vfs jar file?
Chainsaw will be built but will not include support
for VFSLogFilePatternReceiver
</echo>
</target>
<!-- ================================================================= -->
<!-- Runs Chainsaw -->
<!-- ================================================================= -->
<target name="chainsaw" depends="chainsaw.jar, log4jCheck"
description="Build and run Chainsaw v2 from jar file (generates Chainsaw jar if necessary)" >
<!-- Need to fork to avoid problems -->
<java classname="org.apache.log4j.chainsaw.LogUI" fork="yes">
<sysproperty key="log4j.debug" value="${log4j.debug}"/>
<classpath refid="runtime.classpath"/>
</java>
</target>
<!-- ================================================================= -->
<!-- Create log4j-chainsaw.jar, excluding everything else -->
<!-- ================================================================= -->
<target name="chainsaw.jar" depends="build.chainsaw">
<delete>
<fileset dir="${jar.dest}">
<include name="${log4j-chainsaw.jar}"/>
</fileset>
</delete>
<copy todir="${javac.dest}">
<fileset dir="src/java" includes="**/chainsaw/**/*"/>
</copy>
<!-- JavaDoc up some Receiver and other stuff we want to be able to ship with Chainsaw-->
<javadoc sourcepath="${java.source.dir}"
destdir="${javac.dest}"
version="true"
author="true"
use="true"
overview="${jar.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-2003 Apache Software Foundation."
>
<fileset dir="src/java" defaultexcludes="yes">
<include name="**/*Receiver.java" />
</fileset>
<classpath refid="compile.classpath"/>
</javadoc>
<jar jarfile="${jar.dest}/${log4j-chainsaw.jar}" basedir="${javac.dest}"
includes="${stem}/chainsaw/*.class,
${stem}/**/*.html,
**/*.css,
**/resources/*,
${stem}/**/*BeanInfo.class,
${stem}/chainsaw/**/*.class,
${stem}/varia/ListModelAppender.class,
${stem}/chainsaw/layout/*,
${stem}/chainsaw/icons/*.gif,
${stem}/chainsaw/*.jpg,
${stem}/chainsaw/**/*.xml,
${stem}/chainsaw/**/*.html,
${stem}/chainsaw/**/*.properties,
${stem}/chainsaw/receivers/known.receivers,
${stem}/chainsaw/icons/*.jpg,
${stem}/chainsaw/icons/LICENCE"
excludes="**/UnitTest**">
<!-- we need to exclude the JMS + DB Receiver BeanInfo for webstart purposes -->
<exclude name="**/JMS*BeanInfo.class" if="webstart" />
<exclude name="**/DB*BeanInfo.class" if="webstart" />
<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>
<attribute name="Main-Class" value="org.apache.log4j.chainsaw.LogUI"/>
<attribute name="Class-Path" value="${log4j.jar}"/>
</manifest>
</jar>
</target>
<!-- ================================================================= -->
<!-- These targets are for when we need to create a Java Web start -->
<!-- distribution of Chainsaw -->
<!-- ================================================================= -->
<target name="webstart-dependant-receivers.jar" depends="build.chainsaw">
<delete>
<fileset dir="${jar.dest}">
<include name="${webstart-dependant-receivers.jar}"/>
</fileset>
</delete>
<jar jarfile="${jar.dest}/${webstart-dependant-receivers.jar}" basedir="${javac.dest}"
includes="${stem}/**/JMSReceiver*.class, ${stem}/**/DBReceiver*.class">
<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>
</target>
<target name="webstart" >
<property name="webstart" value="true"/>
<antcall target="chainsaw.jar"/>
<antcall target="webstart-dependant-receivers.jar"/>
<input
message="Please enter key password:"
addproperty="keypass"
/>
<signjar verbose="false" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" >
<fileset dir=".">
<include name="*.jar"/>
</fileset>
</signjar>
<zip destfile="chainsaw-bundle.zip" >
<zipfileset dir=".">
<include name="*.jar"/>
</zipfileset>
<fileset file="${jakarta-oro.jar}"/>
<fileset file="src/chainsaw.bat"/>
</zip>
</target>
</project>