poi/build.xml
2002-02-10 04:32:07 +00:00

1040 lines
44 KiB
XML

<!-- ===========================================================================
* =========================== *
| POI Build System |
* =========================== *
by
Nicola Ken Barozzi <barozzi@nicolaken.com>
Marc Johnson <mjohnson at apache dot org>
extends
* =========================== *
| Apache Cocoon Build System |
* =========================== *
by
Stefano Mazzocchi <stefano@apache.org>
Carsten Ziegeler <cziegeler@apache.org>
Installing the build tools
==========================
The POI build system is based on Apache Ant, which is a Java building tool
originally developed for the Tomcat project but now used in many other
Apache projects and extended by many developers.
Ant is a little but very handy tool that uses a build file written in XML
(this file) as building instructions. For more information refer to
"http://jakarta.apache.org/ant/".
To make things easier for you, the POI distribution contains a precompiled
version of Ant and the build scripts take care of running it.
The only thing that you have to make sure, is the "JAVA_HOME" environment
property should be set to match the JVM you want to use.
That's all you have to do to be ready to go.
Building instructions
=====================
Ok, let's build the baby. First, make sure your current working directory is
where this very file is located. Then type
./build.sh (unix)
.\build.bat (win32)
if everything is right and all the required packages are visible, this action
will generate a jar file in the "./build/poi" directory.
Note, that if you do further development, compilation time is reduced since
Ant is able of detecting which files have changed and to recompile them at need.
Also, you'll note that reusing a single JVM instance for each task, increases
tremendously the performance of the whole build system, compared to other
tools (i.e. make or shell scripts) where a new JVM is started for each task.
Building on another directory
=============================
Sometimes you might want to build on an external directory to keep the
distribution clean: no worries, this is just an environment property away.
Suppose you want to use the "../build" directory instead, you simply tipe
[unix] ./build.sh -Dbuild.root=../build
[win32] .\build.bat -Dbuild.root=..\build
By using the -Dxxx=yyy argument, you are setting environments in the JVM: Ant
is designed to give higher priority to system environments to allow you to
modify _any_ <property> that you can find in the building instructions below,
so it's just a matter of understanding what property you want to change
and you don't have to touch this file (which you shouldn't need to do).
Build targets
=============
The build system is not only responsible of compiling the project into a jar
file, but is also responsible for creating the HTML documentation, javadocs,
distributions and web site. In fact, the file you have here is _exactly_ what
is used by project maintainers to take care of everything in the project,
no less and no more.
To know more about the available targets take a look at this file, which is
pretty self-explanatory or type
[unix] ./build.sh -projecthelp
[win32] .\build.bat -projecthelp
and concentrate on the target descriptions that start with a star '*': these
are the one you should call, the others are internal targets that are called
by the main ones.
Build Dependencies
==================
Some components are optional and require special jar files to be compiled
and added to the web application. Some if these jars are already included
in the distribution while others not.
For each optional package which is not available, a warning is
printed. If you don't like these warnings, specify the property "omit.opt.warnings"
(build -Domit.opt.warnings).
Distribution Version
====================
When preparing a distribution for release, specify the version ID on
the command line: -Dversion="dev-1.2.1", for example.
Specifying a subset of unit tests to be executed
================================================
Specify the package on the command line:
-Dtest.specific="org.apache.poi.util" will select only the util
tests to be run. If you've run any other unit tests in a prior
session, you'll need to specify the 'clean' target to remove
extraneous test classes from execution:
./build.sh clean test -Dtest.specific="org/apache/poi/util"
or
.\build.bat clean test -Dtest.specific="org/apache/poi/util"
Happy hacking from the POI Dev Team :)
============================================================================ -->
<project default="interactive" basedir="." name="POI">
<!--
Give user a chance to override without editing this file
(and without typing -D each time he compiles it)
-->
<property file=".ant.properties"/>
<property file="${user.home}/.ant.properties"/>
<!--
these are here only for those who use jikes compiler. For other
developers this part makes no difference.
-->
<property name="build.compiler.emacs" value="on"/>
<!-- property name="build.compiler.warnings" value="true"/ -->
<property name="build.compiler.pedantic" value="false"/>
<property name="build.compiler.depend" value="true"/>
<property name="build.compiler.fulldepend" value="true"/>
<!-- =================================================================== -->
<!-- Indentify Classpath -->
<!-- =================================================================== -->
<path id="classpath">
<fileset dir="./lib/core">
<include name="*.jar"/>
</fileset>
<fileset dir="./lib/optional">
<include name="*.jar"/>
</fileset>
</path>
<path id="scratchpad.classpath">
<fileset dir="./lib/core">
<include name="*.jar"/>
</fileset>
<fileset dir="./lib/optional">
<include name="*.jar"/>
</fileset>
<fileset dir="./src/scratchpad/lib">
<include name="*.jar"/>
</fileset>
<!-- FIXME : how to build a path that references a property set in 'init' target ? -->
<pathelement path="./build/cocoon/classes"/>
</path>
<!-- =================================================================== -->
<!-- Initialization target -->
<!-- =================================================================== -->
<target name="init">
<tstamp/>
<property name="fullname" value="POI"/>
<property name="Name" value="Poi"/>
<property name="name" value="poi"/>
<property name="version" value="1.1-dev"/>
<property name="short.version" value="1.1"/>
<property name="year" value="2001-2002"/>
<echo message="--------------------------------------------------------------"/>
<echo message=" ${fullname} [${year}] "/>
<echo message="--------------------------------------------------------------"/>
<echo message="Building with ${ant.version}"/>
<echo message="using build file ${ant.file}"/>
<echo message="--------------------------------------------------------------"/>
<property name="debug" value="on"/>
<property name="optimize" value="off"/>
<property name="deprecation" value="off"/>
<property name="nowarn" value="on"/>
<property name="build.compiler" value="classic"/>
<property name="target.vm" value="1.2"/>
<property name="src.dir" value="./src"/>
<property name="java.dir" value="${src.dir}/java"/>
<property name="test.dir" value="${src.dir}/testcases"/>
<property name="test.specific" value=""/>
<property name="lib.dir" value="./lib"/>
<property name="bin.dir" value="./bin"/>
<property name="tools.dir" value="./tools"/>
<property name="docs.dir" value="${src.dir}/documentation/xdocs"/>
<property name="images.dir" value="${src.dir}/documentation/images"/>
<property name="resource.dir" value="${src.dir}/resources"/>
<property name="packages" value="org.apache.poi.*"/>
<property name="context.dir" value="${src.dir}/documentation"/>
<property name="scratchpad.dir" value="${src.dir}/scratchpad"/>
<property name="scratchpad.src" value="${scratchpad.dir}/src"/>
<property name="scratchpad.lib" value="${scratchpad.dir}/lib"/>
<property name="scratchpad.name" value="poi-scratchpad"/>
<property name="build.root" value="./build"/>
<property name="build.dir" value="${build.root}/${name}"/>
<property name="build.src" value="${build.dir}/src"/>
<property name="build.test" value="${build.dir}/testcases"/>
<property name="build.dest" value="${build.dir}/classes"/>
<property name="build.docs" value="${build.dir}/docs"/>
<property name="build.xdocs" value="${build.dir}/xdocs"/>
<property name="build.docs.printer" value="${build.dir}/printer-docs"/>
<property name="build.javadocs" value="${build.dir}/javadocs"/>
<property name="build.context" value="${build.dir}/documentation"/>
<property name="build.scratchpad" value="${build.dir}/scratchpad"/>
<property name="build.scratchpad.src" value="${build.scratchpad}/src"/>
<property name="build.scratchpad.dest" value="${build.scratchpad}/classes"/>
<property name="build.patchqueue" value="${build.dir}/patchqueue"/>
<property name="dist.root" value="./dist"/>
<property name="dist.name" value="${name}-${version}"/>
<property name="dist.dir" value="${dist.root}/${dist.name}"/>
<property name="dist.src.dir" value="${dist.root}/source/${dist.name}"/>
<property name="dist.bin.dir" value="${dist.root}/bin/${dist.name}"/>
<property name="dist.target" value="${dist.root}"/>
<property name="site" value="../xml-site/targets/${name}"/>
<property name="build.announce" value="${build.dir}/Announcement.xml"/>
<property name="announce2txt" value="./documentation/stylesheets/announcement2txt.xsl"/>
<!--
The location of tools.jar, relative to the JAVA_HOME home.
-->
<property name="tools.jar" value="${java.home}/../lib/tools.jar"/>
<available file="${tools.jar}" property="tools.jar.present"/>
<filter token="Name" value="${fullname}"/>
<filter token="name" value="${fullname}"/>
<filter token="year" value="${year}"/>
<filter token="version" value="${version}"/>
<filter token="date" value="${TODAY}"/>
<filter token="log" value="true"/>
<filter token="verbose" value="true"/>
<filter token="install.war" value="${install.war}"/>
<!-- Add filters for loading database information from database.properties file -->
<property file="database.properties"/>
<filter token="database-driver" value="${database-driver}"/>
<filter token="database-url" value="${database-url}"/>
<filter token="database-user" value="${database-user}"/>
<filter token="database-password" value="${database-password}"/>
<!-- compile the ant tasks -->
<mkdir dir="${tools.dir}/anttasks"/>
<javac srcdir="${tools.dir}/src" destdir="${tools.dir}/anttasks"/>
</target>
<!-- =================================================================== -->
<!-- Interactive build -->
<!-- =================================================================== -->
<target name="interactive" description="Interactive Build" depends="init">
<echo message="--------------------------------------------------------------"/>
<echo message="| | _ \/ _ \_ _| |"/>
<echo message="| | _/ (_) | | |"/>
<echo message="| |_| \___/___| |"/>
<echo message="--------------------------------------------------------------"/>
<echo message=" ${fullname} [${year}] "/>
<echo message="--------------------------------------------------------------"/>
<echo message="Building with ${ant.version}"/>
<echo message="using build file ${ant.file}"/>
<echo message="--------------------------------------------------------------"/>
<echo message=" These are the most common build targets."/>
<echo message=" You can also invoke them directly; see build.xml for more info. "/>
<echo message=" Builds will be in /build directory, distributions in /dist."/>
<echo message=" "/>
<echo message=" compile ------ compiles the source code "/>
<echo message=" docs --------- generates the html docs"/>
<echo message=" cleandocs ---- cleans the build docs directory"/>
<echo message=" javadocs ----- generates the API documentation"/>
<echo message=" test --------- performs the jUnit tests"/>
<echo message=" clean -------- cleans the build directory"/>
<echo message=" dist --------- creates src and bin distributions"/>
<echo message=" "/>
<taskdef name="user-input" classname="UserInput"
classpath="./tools/anttasks"/>
<property name="input.selection" value="compile"/>
<user-input name="input.selection">Please select a target </user-input>
<antcall target="${input.selection}"/>
</target>
<!-- =================================================================== -->
<!-- Print out warnings for optional components -->
<!-- =================================================================== -->
<target name="optional-warnings"
description="Outputs warnings if some optional jars are missing from the environment">
</target>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the source code -->
<!-- =================================================================== -->
<target name="prepare-src" depends="prepare,generate-java-code">
<mkdir dir="${build.src}"/>
<mkdir dir="${build.dest}"/>
<copy todir="${build.src}" filtering="on">
<fileset dir="${java.dir}"/>
</copy>
<mkdir dir="${build.scratchpad.src}"/>
<mkdir dir="${build.scratchpad.dest}"/>
<copy todir="${build.scratchpad.src}" filtering="on">
<fileset dir="${scratchpad.src}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Set a variable if the generated java code is already up-to-date. -->
<!-- =================================================================== -->
<target name="generate-java-code-check" depends="init"><!--
<uptodate property="generate-java-code.notrequired"
targetfile="${build.src}/org/apache/cocoon/components/browser/BrowserImpl.java" >
<srcfiles dir="${java.dir}/org/apache/cocoon/components/browser"
includes="BrowserImpl.xml,BrowserImpl.xsl"/>
</uptodate>-->
</target>
<!-- =================================================================== -->
<!-- Generate the Java code from XML using XSLT -->
<!-- =================================================================== -->
<target name="generate-java-code" depends="generate-java-code-check"
unless="generate-java-code.notrequired"><!--
<style basedir="${java.dir}/org/apache/cocoon/components/browser"
destdir="${build.src}/org/apache/cocoon/components/browser"
includes="BrowserImpl.xml"
extension=".java"
style="${java.dir}/org/apache/cocoon/components/browser/BrowserImpl.xsl"/>-->
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile" depends="prepare-src"
description="Compiles the source code">
<copy todir="${build.dest}">
<fileset dir="${build.src}">
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
</fileset>
</copy>
<echo message="Compiling with Java ${ant.java.version}, debug ${debug}, optimize ${optimize}, deprecation ${deprecation}"/>
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}"
nowarn="${nowarn}">
<classpath refid="classpath"/>
</javac>
<copy todir="${build.scratchpad.dest}">
<fileset dir="${build.scratchpad.src}">
<include name="**/Manifest.mf"/>
<include name="**/*.xsl"/>
<include name="**/*.roles"/>
<include name="**/*.xconf"/>
<include name="META-INF/**"/>
</fileset>
</copy>
<javac srcdir="${build.scratchpad.src}"
destdir="${build.scratchpad.dest}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}">
<classpath refid="scratchpad.classpath"/>
</javac>
</target>
<target name="generate-records" depends="prepare"
description="Generates the record source code">
<java classname="org.apache.poi.hssf.util.RecordGenerator" fork="yes">
<arg value="src/records/definitions"/>
<arg value="src/records/styles"/>
<arg value="src/java"/>
<arg value="src/testcases"/>
<classpath>
<path refid="classpath"/>
<pathelement location="${build.dest}"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- Creates the jar file -->
<!-- =================================================================== -->
<target name="all" depends="package" description="Default target"/>
<target name="package" depends="compile" description="Generates the jar package">
<jar jarfile="${build.dir}/${name}.jar" manifest="${build.src}/Manifest.mf">
<fileset dir="${build.dest}">
<include name="**"/>
<include name="META-INF/**"/>
</fileset>
</jar>
<jar jarfile="${build.dir}/${scratchpad.name}.jar">
<fileset dir="${build.scratchpad.dest}">
<include name="**"/>
</fileset>
</jar>
</target>
<!-- =================================================================== -->
<!-- Gets pending patches from bugzilla and cleans html -->
<!-- =================================================================== -->
<target name="prepare-patchqueue" depends="init" description="Patch queue 2 mail">
<mkdir dir="${build.patchqueue}"/>
<get src="http://nagoya.apache.org/bugzilla/buglist.cgi?bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;email1=&amp;emailtype1=substring&amp;emailassigned_to1=1&amp;email2=&amp;emailtype2=substring&amp;emailreporter2=1&amp;bugidtype=include&amp;bug_id=&amp;changedin=&amp;votes=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;product=Cocoon+2&amp;short_desc=%5BPATCH%5D&amp;short_desc_type=anywordssubstr&amp;long_desc=&amp;long_desc_type=allwordssubstr&amp;bug_file_loc=&amp;bug_file_loc_type=allwordssubstr&amp;keywords=&amp;keywords_type=anywords&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=&amp;cmdtype=doit&amp;namedcmd=cocoon+patch+queue&amp;newqueryname=&amp;order=Reuse+same+sort+as+last+time"
dest="${build.patchqueue}/bugzillapatchqueue.html"
verbose="true"
usetimestamp="true"
ignoreerrors="true"/>
<taskdef name="jtidy" classname="JTidyTask"
classpath="${tools.dir}/anttasks"/>
<jtidy src="${build.patchqueue}/bugzillapatchqueue.html"
dest="${build.patchqueue}/bugzillapatchqueue.xhtml"
log="${build.patchqueue}/bugzillapatchqueue.log"
summary="true"
warn="true"/>
</target>
<!-- =================================================================== -->
<!-- Transforms bugzilla patches html into xml -->
<!-- =================================================================== -->
<target name="patchqueue-xml" depends="prepare-patchqueue">
<copy file="${tools.dir}/src/bugzilla2patchqueue.xsl" tofile="${build.patchqueue}/bugzilla2patchqueue.xsl"/>
<style basedir="${build.patchqueue}"
destdir="${build.patchqueue}"
includes="bugzillapatchqueue.xhtml"
extension=".xml"
style="bugzilla2patchqueue.xsl"/>
</target>
<!-- =================================================================== -->
<!-- Makes patches.xml for xdocs using bugzilla patches xml -->
<!-- =================================================================== -->
<target name="patchqueue-xdocs" depends="patchqueue-xml">
<copy file="${tools.dir}/src/patchqueue2xdocs.xsl" tofile="${build.patchqueue}/patchqueue2xdocs.xsl"/>
<style basedir="${build.patchqueue}"
destdir="${build.patchqueue}"
includes="bugzillapatchqueue.xml"
extension=".xdoc"
style="patchqueue2xdocs.xsl"/>
<copy file="${build.patchqueue}/bugzillapatchqueue.xdoc" tofile="${docs.dir}/patches.xml"/>
</target>
<!-- =================================================================== -->
<!-- Sends a notification of the current patch queue to the mailing list -->
<!-- =================================================================== -->
<target name="patchqueue" depends="patchqueue-xdocs">
<copy file="${tools.dir}/src/patchqueue2text4dev.xsl" tofile="${build.patchqueue}/patchqueue2text4dev.xsl"/>
<style basedir="${build.patchqueue}"
destdir="${build.patchqueue}"
includes="bugzillapatchqueue.xml"
extension=".txt"
style="patchqueue2text4dev.xsl"/>
</target>
<!-- =================================================================== -->
<!-- Sends a notification of the current patch queue to the mailing list -->
<!-- =================================================================== -->
<target name="patchqueue-notify" depends="patchqueue">
<mail from="patch-queue@nicolaken.com"
tolist="cocoon-dev@xml.apache.org"
mailhost="192.4.0.155"
subject="DO NOT REPLY [PATCH QUEUE] Summary ${TODAY}"
files="${build.patchqueue}/bugzillapatchqueue.txt"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the docs -->
<!-- =================================================================== -->
<target name="prepare-docs" depends="init">
<mkdir dir="${build.context}"/>
<mkdir dir="${build.context}/images"/>
<mkdir dir="${build.docs}"/>
<mkdir dir="${build.dir}/work"/>
<!-- make filtered copy of XML docs -->
<copy todir="${build.context}" filtering="on">
<fileset dir="${context.dir}">
<exclude name="images/**"/>
</fileset>
</copy>
<!-- Add changes and todo -->
<!--
<copy file="changes.xml" tofile="${build.context}/xdocs/changes.xml" filtering="on"/>
<copy file="todo.xml" tofile="${build.context}/xdocs/todo.xml" filtering="on"/>
<replace file="${build.context}/xdocs/changes.xml" token="src/documentation/xdocs/dtd/" value="dtd/"/>
<replace file="${build.context}/xdocs/todo.xml" token="src/documentation/xdocs/dtd/" value="dtd/"/>
-->
<!-- Copy images -->
<copy todir="${build.context}/images" filtering="off">
<fileset dir="${context.dir}/images"/>
</copy>
<!-- Copy entity catalog and entities -->
<copy todir="${build.context}/resources/entities" filtering="on">
<fileset dir="${resource.dir}/entities"/>
</copy>
<mkdir dir="${build.context}/WEB-INF/classes"/>
<move todir="${build.context}/WEB-INF/classes">
<fileset dir="${build.context}/resources/entities">
<include name="CatalogManager.properties"/>
</fileset>
</move>
</target>
<!-- =================================================================== -->
<!-- Set a variable if the generated docs are already up-to-date. -->
<!-- =================================================================== -->
<target name="docs_check" depends="init">
<uptodate property="docs.notrequired" targetfile="${build.docs}/index.html" >
<srcfiles dir="." includes="changes.xml,todo.xml"/>
<srcfiles dir="${context.dir}/xdocs" includes="**/*.xml"/>
</uptodate>
</target>
<!-- =================================================================== -->
<!-- If generated docs is already up-to-date, print a message saying so. -->
<!-- =================================================================== -->
<target name="docs_done" if="docs.notrequired">
<echo message="-------------------------------------------------------------"/>
<echo message="Not rebuilding docs, as they are up-to-date:"/>
<echo message=" ${build.docs}/index.html is more recent than"/>
<echo message=" todo.xml, changes.xml, ${context.dir}/xdocs/*.xml"/>
<echo message="-------------------------------------------------------------"/>
</target>
<!-- =================================================================== -->
<!-- The documentation system (nearly beta...) -->
<!-- =================================================================== -->
<target name="docs"
depends="package, prepare-docs, docs_check, docs_done"
unless="docs.notrequired"
description="* Generates the documentation">
<java classname="org.apache.cocoon.Main" fork="true" dir="${build.context}" failonerror="true">
<arg value="-c."/>
<arg value="-d../docs"/>
<arg value="-w../work"/>
<arg value="-l../work/cocoon.log"/>
<arg value="-uINFO"/>
<arg value="index.html"/>
<classpath>
<path refid="classpath"/>
<fileset dir="${build.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${tools.jar}"/>
<pathelement location="${build.context}/WEB-INF/classes"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- Copies the tools.jar to javac.jar in web-inf/lib -->
<!-- =================================================================== -->
<target name="prepare-tools-lib" depends="package" if="tools.jar.present">
<!-- NOTE: java.home is normally set by the JVM to the /jre directory -->
<copy file="${tools.jar}" tofile="${build.war}/WEB-INF/lib/javac.jar"/>
</target>
<!-- =================================================================== -->
<!-- Set a variable if the generated printer docs are already up-to-date. -->
<!-- =================================================================== -->
<target name="printer-docs_check" depends="init">
<uptodate property="printer-docs.notrequired" targetfile="${build.docs.printer}/index.html" >
<srcfiles dir="." includes="changes.xml,todo.xml"/>
<srcfiles dir="${docs.dir}" includes="**/*.xml"/>
</uptodate>
</target>
<!-- =================================================================== -->
<!-- If generated printer docs is already up-to-date, print a message saying so. -->
<!-- =================================================================== -->
<target name="printer-docs_done" if="printer-docs.notrequired">
<echo message="-------------------------------------------------------------"/>
<echo message="Not rebuilding printer docs, as they are up-to-date:"/>
<echo message=" ${build.docs.printer}/index.html is more recent than"/>
<echo message=" todo.xml, changes.xml, ${docs.dir}/*.xml"/>
<echo message="-------------------------------------------------------------"/>
</target>
<!-- =================================================================== -->
<!-- Create the announcements -->
<!-- =================================================================== -->
<target name="announcement" depends="prepare" description="* Creates the announcement for new releases">
<copy file="announcement.xml" tofile="${build.announce}" filtering="on"/>
<style basedir="${build.dir}" destdir="./" style="${announce2txt}"
includes="Announcement.xml" extension=".txt"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the printer-docs -->
<!-- =================================================================== -->
<target name="prepare-printer-docs" depends="prepare-docs">
<mkdir dir="${build.dir}/printer_documentation"/>
<!-- copy prepared docs -->
<copy todir="${build.dir}/printer_documentation" filtering="off">
<fileset dir="${build.context}">
</fileset>
</copy>
<!-- copy printer skin -->
<copy todir="${build.dir}/printer_documentation/stylesheets" filtering="off" overwrite="yes">
<fileset dir="${build.context}/stylesheets/printer_skin">
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Generate printer-friendly HTML docs -->
<!-- =================================================================== -->
<target name="printer-docs" depends="package, prepare-printer-docs, printer-docs_check, printer-docs_done"
unless="printer-docs.notrequired"
description="* Generates printer-friendly documentation">
<mkdir dir="${build.docs.printer}"/>
<java classname="org.apache.cocoon.Main" fork="true" dir="${build.dir}/printer_documentation" failonerror="true">
<arg value="-c."/>
<arg value="-d../printer-docs"/>
<arg value="-w../work-printer"/>
<arg value="-l../work-printer/cocoon.log"/>
<arg value="-uINFO"/>
<arg value="index.html"/>
<classpath>
<path refid="classpath"/>
<fileset dir="${build.dir}">
<include name="*.jar"/>
</fileset>
<pathelement location="${tools.jar}"/>
<pathelement location="${build.context}/WEB-INF/classes"/>
</classpath>
</java>
</target>
<!-- =================================================================== -->
<!-- Creates the web site -->
<!-- =================================================================== -->
<target name="site" depends="docs, javadocs"
description="Generates the web site (for site maintainers only)">
<mkdir dir="${site}"/>
<copy todir="${site}" filtering="off">
<fileset dir="${build.docs}">
</fileset>
</copy>
<copy todir="${site}/apidocs" filtering="off">
<fileset dir="${build.javadocs}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Set a variable if javadoc is already up-to-date. -->
<!-- =================================================================== -->
<target name="javadocs_check">
<uptodate property="javadocs.notrequired" targetfile="${build.javadocs}/packages.html" >
<srcfiles dir= "${build.src}" includes="**/*.java"/>
</uptodate>
</target>
<!-- =================================================================== -->
<!-- If javadoc is already up-to-date, print a message saying so. -->
<!-- =================================================================== -->
<target name="javadocs_done" if="javadocs.notrequired">
<echo message="-------------------------------------------------------------"/>
<echo message="Not rebuilding Javadocs, as they are up-to-date:"/>
<echo message=" ${build.javadocs}/packages.html is more recent than"/>
<echo message=" ${build.src}/**/*.java"/>
<echo message="-------------------------------------------------------------"/>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadocs" depends="prepare-src, javadocs_check, javadocs_done"
unless="javadocs.notrequired"
description="* Generates the API documentation">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
destdir="${build.javadocs}"
author="true"
version="true"
use="false"
noindex="true"
windowtitle="${Name} API"
doctitle="${Name}"
bottom="Copyright &#169; ${year} POI project. All Rights Reserved."
stylesheetfile="${resource.dir}/javadoc.css">
<classpath refid="classpath"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Creates the source distribution -->
<!-- =================================================================== -->
<target name="dist-src" depends="docs, javadocs"
description="Prepares the source distribution">
<!-- Simply copy all and add the html docs -->
<mkdir dir="${dist.root}"/>
<mkdir dir="${dist.src.dir}"/>
<mkdir dir="${dist.src.dir}/lib"/>
<mkdir dir="${dist.src.dir}/src"/>
<mkdir dir="${dist.src.dir}/src/java"/>
<mkdir dir="${dist.src.dir}/src/documentation"/>
<mkdir dir="${dist.src.dir}/src/resources"/>
<mkdir dir="${dist.src.dir}/src/scratchpad"/>
<mkdir dir="${dist.src.dir}/src/testcases"/>
<mkdir dir="${dist.src.dir}/docs"/>
<mkdir dir="${dist.src.dir}/docs/apidocs"/>
<mkdir dir="${dist.src.dir}/tools"/>
<!--
<copy todir="${dist.src.dir}/bin">
<fileset dir="${bin.dir}"/>
</copy> -->
<copy todir="${dist.src.dir}/tools">
<fileset dir="${tools.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/documentation">
<fileset dir="${build.context}"/>
</copy>
<copy todir="${dist.src.dir}/lib">
<fileset dir="${lib.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/resources" filtering="on">
<fileset dir="${resource.dir}">
<exclude name="**/*.gif"/>
<exclude name="**/*.jpg"/>
<exclude name="**/*.png"/>
</fileset>
</copy>
<copy todir="${dist.src.dir}/src/resources" filtering="off">
<fileset dir="${resource.dir}">
<include name="**/*.gif"/>
<include name="**/*.jpg"/>
<include name="**/*.png"/>
</fileset>
</copy>
<copy todir="${dist.src.dir}/src/java" filtering="on">
<fileset dir="${java.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/scratchpad" filtering="off">
<fileset dir="${scratchpad.dir}"/>
</copy>
<copy todir="${dist.src.dir}/src/testcases" filtering="off">
<fileset dir="${test.dir}"/>
</copy>
<copy todir="${dist.src.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy todir="${dist.src.dir}/docs/apidocs">
<fileset dir="${build.javadocs}"/>
</copy>
<copy todir="${dist.src.dir}">
<fileset dir="${docs.dir}">
<include name="changes.xml, todo.xml"/>
</fileset>
</copy>
<copy todir="${dist.src.dir}" filtering="on">
<fileset dir=".">
<include name="README.txt"/>
<include name="legal/*"/>
<include name="*.bat"/>
<include name="*.sh"/>
<include name="*.xml"/>
</fileset>
</copy>
<chmod perm="+x" file="${dist.src.dir}/build.sh"/>
<chmod perm="+x" file="${dist.src.dir}/tools/bin/antRun"/>
<fixcrlf srcdir="${dist.src.dir}" includes="**.sh" eol="lf"/>
<fixcrlf srcdir="${dist.src.dir}" includes="antRun" eol="lf"/>
<fixcrlf srcdir="${dist.src.dir}" includes="**.bat" eol="crlf"/>
</target>
<!-- =================================================================== -->
<!-- Packages the source distribution as .zip -->
<!-- =================================================================== -->
<target name="dist-src-zip" depends="dist-src"
description="Generates the source distribution as a .zip file">
<zip zipfile="${dist.target}/${dist.name}-src.zip"
basedir="${dist.root}/source"/>
</target>
<!-- =================================================================== -->
<!-- Packages the source distribution with .tar.gzip -->
<!-- =================================================================== -->
<target name="dist-src-tgz" depends="dist-src"
description="Generates the source distribution as a .tar.gz file">
<tar tarfile="${dist.target}/${dist.name}-src.tar"
basedir="${dist.root}/source"
longfile="gnu"/>
<gzip zipfile="${dist.target}/${dist.name}-src.tar.gz"
src="${dist.target}/${dist.name}-src.tar"/>
</target>
<!-- =================================================================== -->
<!-- Creates the binary distribution -->
<!-- =================================================================== -->
<target name="dist-bin" depends="package, docs, javadocs"
description="Prepares the binary distribution">
<!-- Copy the html docs -->
<mkdir dir="${dist.root}"/>
<mkdir dir="${dist.bin.dir}"/>
<mkdir dir="${dist.bin.dir}/lib"/>
<mkdir dir="${dist.bin.dir}/docs"/>
<mkdir dir="${dist.bin.dir}/docs/apidocs"/>
<copy file="${build.dir}/${name}.jar" tofile="${dist.bin.dir}/lib/${name}-${version}.jar"/>
<copy todir="${dist.bin.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy todir="${dist.bin.dir}/docs/apidocs">
<fileset dir="${build.javadocs}"/>
</copy>
<copy todir="${dist.bin.dir}">
<fileset dir="${docs.dir}">
<include name="changes.xml, todo.xml"/>
</fileset>
</copy>
<copy todir="${dist.bin.dir}" filtering="on">
<fileset dir=".">
<include name="README.txt"/>
<include name="legal/*"/>
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Packages the binary distribution as .zip -->
<!-- =================================================================== -->
<target name="dist-bin-zip" depends="dist-bin"
description="Generates the binary distribution as a .zip file">
<zip zipfile="${dist.target}/${dist.name}-bin.zip"
basedir="${dist.root}/bin"/>
</target>
<!-- =================================================================== -->
<!-- Packages the binary distribution with .tar.gzip -->
<!-- =================================================================== -->
<target name="dist-bin-tgz" depends="dist-bin"
description="Generates the binary distribution as a .tar.gz file">
<tar tarfile="${dist.target}/${dist.name}-bin.tar"
basedir="${dist.root}/bin"
longfile="gnu"/>
<gzip zipfile="${dist.target}/${dist.name}-bin.tar.gz"
src="${dist.target}/${dist.name}-bin.tar"/>
</target>
<!-- =================================================================== -->
<!-- Build all distributions -->
<!-- =================================================================== -->
<target name="dist-info" depends="init">
<echo>**********************************************</echo>
<echo>*</echo>
<echo>* Build all distributions:</echo>
<echo>* - source distribution for windows/unix.</echo>
<echo>* - binary distribution for windows/unix.</echo>
<echo>*</echo>
<echo>* This may take a while...</echo>
<echo>*</echo>
<echo>***********************************************</echo>
<echo/>
</target>
<!-- =================================================================== -->
<!-- Build all distributions -->
<!-- =================================================================== -->
<target name="dist"
depends="dist-info, dist-bin-tgz, dist-bin-zip, dist-src-tgz, dist-src-zip"
description="* Generates all distributions (source/binary)">
</target>
<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
<target name="clean" depends="init" description="* Cleans the build directories">
<delete dir="${build.dir}"/>
</target>
<target name="cleandocs" depends="init" description="* Cleans the build docs directories">
<delete dir="${build.docs}"/>
</target>
<target name="distclean" depends="clean" description="* Cleans everything to the original state">
<delete dir="${build.root}"/>
<delete file="${dist.target}/${Name}-${version}.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}.tar"/>
<delete file="${dist.target}/${Name}-${version}.zip"/>
<delete file="${dist.target}/${Name}-${version}-src.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}-src.tar"/>
<delete file="${dist.target}/${Name}-${version}-src.zip"/>
<delete file="${dist.target}/${Name}-${version}-bin.tar.gz"/>
<delete file="${dist.target}/${Name}-${version}-bin.tar"/>
<delete file="${dist.target}/${Name}-${version}-bin.zip"/>
<delete dir="${dist.root}"/>
</target>
<!-- =================================================================== -->
<!-- Test targets -->
<!-- =================================================================== -->
<target name="test" depends="compile" description="Perform jUnit tests">
<mkdir dir="${build.test}"/>
<!-- Copy test files to build test dir -->
<copy todir="${build.test}" filtering="on">
<fileset dir="${test.dir}/${test.specific}"/>
</copy>
<!-- Compile tests -->
<javac srcdir="${build.test}"
destdir="${build.test}"
debug="${debug}"
optimize="${optimize}"
deprecation="${deprecation}"
target="${target.vm}">
<classpath refid="classpath"/>
<classpath>
<pathelement path="${build.dest}" />
</classpath>
</javac>
<junit printsummary="yes" haltonfailure="yes" fork="yes">
<sysproperty key="UTIL.testdata.path"
value="${test.dir}/org/apache/poi/util/data"/>
<sysproperty key="HSSF.testdata.path"
value="${test.dir}/org/apache/poi/hssf/data"/>
<classpath>
<pathelement location="${build.test}" />
<pathelement location="${build.dest}" />
<pathelement path="${java.class.path}" />
</classpath>
<classpath refid="classpath"/>
<formatter type="plain" usefile="no" />
<batchtest>
<fileset dir="${build.test}">
<include name="**/test/*TestCase.class"/>
<include name="**/*Test.class" />
<include name="**/Test*.class" />
<exclude name="**/AllTest.class" />
<exclude name="**/*$$*Test.class" />
</fileset>
</batchtest>
</junit>
</target>
<!-- =================================================================== -->
<!-- Fix line endings in src -->
<!-- =================================================================== -->
<target name="fixsrclf" depends="init" description="Fix lf in src directory (internal use only!)">
<fixcrlf srcdir="${java.dir}" includes="**/*.java" eol="lf"/>
</target>
</project>
<!-- End of file -->