blob: 53d204a150f1abe3528fd6cd294be58672402691 [file] [log] [blame]
<project name="chainsaw" default="chainsaw.jar" basedir="." >
<!-- Deprecation warning? -->
<property name="deprecation" value="on"/>
<!-- Javac with debug on/off. Log4j without debug on is hard to debug, so leave this setting on. -->
<property name="debug" value="on"/>
<property name="version" value="2.0alpha-1"/>
<!-- The directory where source files are stored. -->
<property name="java.source.dir" value="src/java/"/>
<!-- The stem where most log4j source code is located. -->
<property name="stem" value="org/apache/log4j"/>
<!-- The build.properties file defines the parth to local jar files -->
<property file="build.properties"/>
<!-- Destination for generated jar files -->
<property name="javac.dest" value="${basedir}/build"/>
<!-- the jar file for Chainsaw that will be generated -->
<property name="log4j-chainsaw.jar" value="log4j-chainsaw-${version}.jar"/>
<!-- Destination for generated jar files -->
<property name="jar.dest" value="${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}"/>
<fileset dir="${deps.dir}">
<include name="*.jar"/>
</fileset>
</path>
<path id="runtime.classpath">
<fileset dir="${deps.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${jakarta-oro.jar}"/>
<pathelement location="${log4j-chainsaw.jar}"/>
</path>
<!-- 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="**/*.java"/>
<exclude name="org/apache/log4j/chainsaw/vfs/**/*.java" unless="vfs-present"/>
</patternset>
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="log4jCheck">
<available classname="org.apache.log4j.Logger" property="log4jJarsPresent">
<classpath refid="compile.classpath"/>
</available>
<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>
<echo>VFS Present: ${vfs-present}</echo>
</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>
<target name="JmDNSCheck">
<available classname="javax.jmdns.JmDNS" property="jmdns-present">
<classpath refid="compile.classpath"/>
</available>
<echo>JmDNS Present: ${jmdns-present}</echo>
</target>
<target name="BuildZeroConfJar" depends="JmDNSCheck, build.chainsaw" if="jmdns-present">
<javac deprecation="${deprecation}"
srcdir="zeroconf"
debug="${debug}"
destdir="${javac.dest}">
<patternset>
<include name="**/*.java"/>
</patternset>
<classpath refid="compile.classpath"/>
</javac>
<jar jarfile="${jar.dest}/log4j-zeroconf.jar" basedir="${javac.dest}"
includes="${stem}/**/net/ZeroConf*.class,${stem}/**/net/Zeroconf*.class" excludes="**/*Test*.class">
<manifest>
<attribute name="Manifest-version" value="1.0"/>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j ZeroConf optional extras"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</manifest>
</jar>
</target>
<target name="getdeps">
<mkdir dir="deps-dl"/>
<get src="http://www.apache.org/dist/jakarta/commons/logging/binaries/commons-logging-1.0.4.zip" dest="deps-dl/commons-logging-1.0.4.zip" verbose="true" usetimestamp="true"/>
<unzip src="deps-dl/commons-logging-1.0.4.zip" dest="deps-dl/unpack">
<patternset>
<include name="commons-logging-1.0.4/commons-logging*.jar"/>
</patternset>
</unzip>
<move todir="${deps.dir}" >
<fileset dir="deps-dl">
<include name="**/*.jar"/>
</fileset>
<mapper type="flatten"/>
</move>
</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, BuildZeroConfJar">
<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/" 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}/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**">
<!-- VFS stuff goes in it's own Jar -->
<exclude name="**/vfs/*" />
<!-- 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>
<jar jarfile="${jar.dest}/log4j-chainsaw-vfs.jar" basedir="${javac.dest}"
includes="${stem}/chainsaw/vfs/*.class" >
<manifest>
<attribute name="Manifest-version" value="1.0"/>
<section name="org/apache/log4j/">
<attribute name="Implementation-Title" value="log4j VFS"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
</section>
</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="shellscript-taskdef">
<javac deprecation="${deprecation}"
srcdir="anttasks-src"
debug="${debug}"
destdir="${javac.dest}">
<patternset>
<include name="**/*.java"/>
</patternset>
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${javac.dest}">
<fileset dir="anttasks-src">
<include name="*.jnlp"/>
</fileset>
</copy>
<taskdef name="createshellscripts" classpathref="compile.classpath" classname="org.apache.chainsaw.ant.CreateShellScripts" />
</target>
<target name="webstart" depends="shellscript-taskdef">
<tstamp />
<property name="chainsaw-bundle.zip" value="chainsaw-bundle-${DSTAMP}.zip" />
<property name="chainsaw.dmg" value="chainsaw-${DSTAMP}.dmg" />
<property name="webstart-bundle.zip" value="webstart-bundle-${DSTAMP}.zip" />
<property name="webstart" value="true"/>
<antcall target="chainsaw.jar"/>
<antcall target="webstart-dependant-receivers.jar"/>
<delete dir="webstart-dist"></delete>
<!-- TODO Now copy all the jars into a new webstart-dist directory -->
<copy todir="webstart-dist">
<fileset file="packaging/chainsaw.*"/>
<fileset dir="lib" />
<fileset dir=".">
<include name="log4j-chain*.jar"/>
<include name="log4j-zeroconf*.jar"/>
<!--<include name="webstart*.jar"/> -->
</fileset>
</copy>
<!-- TODO When zeroconf is ready, remove this! -->
<delete>
<fileset dir="webstart-dist">
<include name="*zeroconf*"/>
<include name="jmdns*"/>
</fileset>
</delete>
<createshellscripts outputLocation="webstart-dist" scriptType="shell">
<fileset dir="webstart-dist" includes="*.jar"/>
</createshellscripts>
<!-- Webstart distribution can't have VFS because of stupid classloading rules, so we exclude it-->
<createshellscripts outputLocation="webstart-dist" scriptType="webstart">
<fileset dir="webstart-dist" includes="*.jar">
<exclude name="commons*.jar"/>
<exclude name="*vfs*.jar"/>
</fileset>
</createshellscripts>
<input
message="Please enter key password:"
addproperty="keypass"
/>
<signjar verbose="false" keystore="${keystore}" alias="${alias}" storepass="${storepass}" keypass="${keypass}" >
<fileset dir="webstart-dist">
<include name="*.jar"/>
</fileset>
</signjar>
<zip destfile="${chainsaw-bundle.zip}" >
<zipfileset dir="webstart-dist">
<include name="*.jar"/>
<include name="*.bat"/>
<include name="*.sh"/>
</zipfileset>
</zip>
</target>
<!-- This target can only be run on an OS X computer and requires
see http://www.loomcom.com/jarbundler/
-->
<target name="iSaw" depends="webstart">
<delete dir="iSaw-Dist" failonerror="false"/>
<delete dir="Chainsaw.app" failonerror="false"/>
<delete dir="Chainsaw-app" failonerror="false"/>
<mkdir dir="iSaw-dist" />
<mkdir dir="Chainsaw-app" />
<copy file="${webstart-dependant-receivers.jar}" todir="iSaw-dist"/>
<copy file="${log4j-chainsaw.jar}" todir="iSaw-dist"/>
<copy todir="iSaw-dist">
<fileset dir="lib"/>
</copy>
<taskdef name="jarbundler"
classpath="antlibs/jarbundler-1.4.jar"
classname="com.loomcom.ant.tasks.jarbundler.JarBundler" />
<jarbundler dir="."
name="Chainsaw"
mainclass="org.apache.log4j.chainsaw.LogUI"
icon="packaging/logo.icns"
version="1.99.99"
infostring="Chainsaw"
aboutmenuname="Chainsaw"
bundleid="org.apache.log4j.chainsaw.ChainsawBundle"
developmentregion="English"
signature="chainsaw"
jvmversion="1.4+"
vmoptions="-Xms32m -Xmx256m"
smalltabs="true"
antialiasedgraphics="true"
antialiasedtext="true"
liveresize="true"
growboxintrudes="false"
screenmenu="true" >
<jarfileset dir="iSaw-dist">
<include name="**/*.jar" />
</jarfileset>
</jarbundler>
<move file="Chainsaw.app" todir="Chainsaw-app" />
<echo message="Creating DMG image"/>
<exec executable="hdiutil">
<arg line="create -srcfolder Chainsaw-app ${chainsaw.dmg}"/>
</exec>
</target>
<!-- NOTE: you'll need JSch in your Ant ext libs area for this to work -->
<target name="distribution" depends="webstart, iSaw" description="Builds the complete distribution (Webstart, zip + OSX)">
<delete dir="distribution" failonerror="false"/>
<mkdir dir="distribution"/>
<copy todir="distribution">
<fileset dir=".">
<include name="**/${chainsaw-bundle.zip}"/>
<include name="${chainsaw.dmg}" />
</fileset>
</copy>
<zip destfile="distribution/${webstart-bundle.zip}" >
<zipfileset dir="webstart-dist" includes="*.jnlp"/>
<zipfileset dir="webstart-dist" prefix="lib" includes="*.jar"/>
</zip>
<!-- TODO copy, unpack the os X image template, update the files, close the image, move into distribution directory -->
<input addproperty="dist.password" message="Please type in your remote password: (Warning:What you type will appear in plain text on console.)"></input>
<echo message="${dist.user}, ${dist.password}, ${dist.dest}, ${dist.keyfile}" />
<!-- NOTE: you HAVE to use key based authentication, otherwise it just won't work -->
<scp todir="${dist.user}@people.apache.org:${dist.dest}" passphrase="${dist.password}" keyfile="${dist.keyfile}" verbose="true">
<fileset dir="distribution">
<include name="**/*.*"/>
</fileset>
</scp>
</target>
<!-- ================================================================= -->
<!-- Remove all generated (compiled) class files. -->
<!-- ================================================================= -->
<target name="clean" description="Delete all compiled files.">
<mkdir dir="${javac.dest}" />
<delete dir="${javac.dest}"/>
<delete>
<fileset dir="${jar.dest}" includes="log4j-chainsaw*.jar"/>
</delete>
</target>
</project>