Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

429 lines (361 sloc) 17.777 kb
<!-- $Id: build.xml,v 1.57 2009/07/23 06:48:27 jhunter Exp $ -->
<!--
For instructions on how to build JDOM, please view the README.txt file.
-->
<project default="package" basedir=".">
<!-- =================================================================== -->
<!-- Initialization target -->
<!-- =================================================================== -->
<target name="init">
<tstamp/>
<!--
Give user a chance to override without editing this file
(and without using -D arguments each time they build).
The build properties a user is likely to override include:
- lib.dir The directory where to look for the default JAR
files. Defaults to ./lib
- xml-apis.jar The JAR containing the DOM, SAX and JAXP classes.
Defaults to ${lib.dir}/xml-apis.jar
- parser.jar The JAR containing the XML parser to use.
Defaults to ${lib.dir}/xerces.jar
- jaxen.lib.dir The directory containing the Jaxen JAR libraries.
Defaults to ${lib.dir}
-->
<property file="${user.home}/jdom.build.properties" />
<property file="${basedir}/build.properties" />
<property name="Name" value="JDOM"/>
<property name="name" value="jdom2"/>
<property name="version" value="2.alpha"/>
<property name="version.impl" value="${version}"/>
<property name="version.spec" value="2.alpha"/>
<property name="year" value="2011"/>
<property name="instrument" value="true" />
<echo message="----------- ${Name} ${version} ------------"/>
<property name="compile.debug" value="true" />
<property name="compile.optimize" value="true" />
<property name="compile.target" value="1.6" />
<property name="compile.source" value="1.6" />
<property name="compile.deprecation" value="true" />
<property name="build" value="./build"/>
<property name="core" value="./core" />
<property name="core.src" value="${core}/src/java" />
<property name="core.build" value="${build}/core" />
<property name="about" value="./core/package" />
<property name="about.src" value="${about}" />
<property name="about.build" value="${build}/about" />
<property name="metainf" value="./core/package/META-INF" />
<property name="metainf.build" value="${build}/META-INF" />
<property name="contrib" value="./contrib" />
<property name="contrib.src" value="${contrib}/src/java" />
<property name="contrib.build" value="${build}/contrib" />
<property name="junit" value="./test" />
<property name="junit.src" value="${junit}/src/java" />
<property name="junit.build" value="${build}/junit" />
<property name="junit.xml" value="${build}/junit.xml" />
<property name="junit.report" value="${build}/junit.report" />
<property name="junit.instrumented" value="${build}/instrumented" />
<property name="samples" value="./core/samples/" />
<property name="samples.src" value="${samples}/" />
<property name="samples.build" value="${build}/samples"/>
<property name="lib.dir" value="./lib"/>
<property name="packages" value="org.jdom2.*"/>
<property name="build.javadocs" value="${build}/apidocs"/>
<property name="dist.root" value="./dist"/>
<property name="dist.dir" value="${dist.root}/${name}-${version}"/>
<property name="package.dir" value="./package"/>
<property name="coverage.out" value="${build}/coverage" />
<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"/>
<!-- Default JAR libraries -->
<property name="parser.jar" value="${lib.dir}/xercesImpl.jar" />
<property name="xmlapi.jar" value="${lib.dir}/xml-apis.jar" />
<property name="jaxen.jar" value="${lib.dir}/jaxen-1.1.3.jar" />
<property name="junit.jar" value="${lib.dir}/junit-4.8.2.jar" />
<property name="isorelax.jar" value="${contrib}/lib/isorelax.jar" />
<!-- Compilation class path -->
<path id="base.class.path">
<pathelement location="${jaxen.jar}" />
<pathelement location="${parser.jar}" />
<pathelement location="${xmlapi.jar}" />
<pathelement location="${junit.jar}" />
<pathelement location="${isorelax.jar}" />
</path>
<path id="core.class.path">
<path refid="base.class.path"/>
<pathelement location="${core.build}"/>
</path>
<path id="junit.class.path">
<pathelement location="${junit.instrumented}" />
<pathelement location="${junit.build}"/>
<path refid="core.class.path"/>
<fileset dir="${lib.dir}/cobertura" includes="*.jar" />
</path>
</target>
<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="usage">
<echo message=""/>
<echo message=""/>
<echo message="JDOM Build file"/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=" available targets are:"/>
<echo message=""/>
<echo message=" - package [default] -> generates ./build/jdom2.jar and other supporting files"/>
<echo message=" - compile -> compiles the source code"/>
<echo message=" - javadoc -> generates the API documentation in ./build/javadocs"/>
<echo message=" - junit -> runs the JUnit tests"/>
<echo message=" - coverage -> generates test coverage metrics"/>
<echo message=" - eclipse -> generates an Eclipse project (source folders, jars, etc)"/>
<echo message=" - clean -> restores the distribution to its original and clean state"/>
<echo message=""/>
<echo message=" See the comments inside the build.xml file for more details."/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=""/>
</target>
<!-- =================================================================== -->
<!-- Prepares the build directory -->
<!-- =================================================================== -->
<target name="prepare" depends="init">
<mkdir dir="${build}"/>
<mkdir dir="${core.build}"/>
<mkdir dir="${about.build}"/>
<mkdir dir="${samples.build}"/>
<mkdir dir="${junit.build}"/>
<mkdir dir="${contrib.build}"/>
<mkdir dir="${metainf.build}"/>
</target>
<!-- =================================================================== -->
<!-- Prepares the source code -->
<!-- =================================================================== -->
<target name="prepare-src" depends="prepare">
<!-- copy src files -->
<copy todir="${core.build}" filtering="yes">
<fileset dir="${core.src}"/>
</copy>
<copy todir="${about.build}" filtering="yes">
<fileset dir="${about.src}"/>
</copy>
<copy todir="${samples.build}" filtering="yes">
<fileset dir="${samples.src}"/>
</copy>
<copy todir="${contrib.build}" filtering="yes">
<fileset dir="${contrib.src}"/>
</copy>
<copy todir="${junit.build}" filtering="yes">
<fileset dir="${junit.src}"/>
</copy>
</target>
<!-- =================================================================== -->
<!-- Compiles the source directory -->
<!-- =================================================================== -->
<target name="compile.core" depends="prepare-src"
description="Compiles the core source code">
<javac srcdir="${core.build}"
destdir="${core.build}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="base.class.path"/>
</javac>
</target>
<target name="compile.about" depends="prepare-src"
description="Compiles the about source code">
<javac srcdir="${about.build}"
destdir="${about.build}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="core.class.path"/>
</javac>
</target>
<target name="compile.samples" depends="compile.core"
description="Compiles the sample source code">
<javac srcdir="${samples.build}"
destdir="${samples.build}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="core.class.path" />
</javac>
</target>
<target name="compile.contrib" depends="compile.core"
description="Compiles the contrib source code">
<javac srcdir="${contrib.build}"
destdir="${contrib.build}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="core.class.path" />
</javac>
</target>
<target name="compile.junit" depends="compile.core"
description="Compiles the junit source code">
<javac srcdir="${junit.build}"
destdir="${junit.build}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="core.class.path" />
</javac>
</target>
<target name="compile" depends="compile.core, compile.about, compile.junit, compile.contrib, compile.samples"
description="Compiles all JDOM code (core, samples, junit, contrib)" />
<!-- =================================================================== -->
<!-- Compiles the "About" code -->
<!-- =================================================================== -->
<target name="about" depends="compile.about"
description="Compiles the About code" />
<!-- =================================================================== -->
<!-- Creates the class package -->
<!-- =================================================================== -->
<target name="package" depends="compile"
description="Creates the class package">
<fixcrlf srcdir="." includes="**/*.bat" excludes="build*.*" eol="crlf"/>
<fixcrlf srcdir="." includes="**/*.sh" excludes="build*.*" eol="lf"/>
<!-- Filters defined specifically for updating the manifest -->
<filter token="version.spec" value="${version.spec}"/>
<filter token="version.impl" value="${version.impl}"/>
<copy todir="${metainf.build}/META-INF" filtering="yes">
<fileset dir="${metainf}"/>
<fileset dir=".">
<include name="LICENSE.txt"/>
</fileset>
</copy>
<jar jarfile="${build}/${name}.jar" manifest="${metainf.build}/META-INF/MANIFEST.MF">
<fileset dir="${core.build}" includes="**/*.class" />
<fileset dir="${about.build}" includes="**/*.class" />
<fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" />
</jar>
<jar jarfile="${build}/${name}-contrib.jar" >
<fileset dir="${contrib.build}" includes="**/*.class" />
<fileset dir="${metainf.build}" excludes="**/MANIFEST.MF" />
</jar>
</target>
<!-- =================================================================== -->
<!-- Creates the API documentation -->
<!-- =================================================================== -->
<target name="javadoc" depends="prepare-src"
description="Creates the API documentation">
<mkdir dir="${build.javadocs}"/>
<javadoc packagenames="${packages}"
sourcepath="${core.build}"
destdir="${build.javadocs}"
author="true"
version="true"
use="true"
splitindex="true"
noindex="false"
windowtitle="${Name} v${version}"
doctitle="${Name} v${version}&lt;br&gt;API Specification"
header="&lt;b&gt;${Name}&lt;br&gt;&lt;font size='-1'&gt;${version}&lt;/font&gt;&lt;/b&gt;"
bottom="Copyright &#169; ${year} Jason Hunter, Brett McLaughlin. All Rights Reserved.">
<classpath refid="base.class.path"/>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Clean targets -->
<!-- =================================================================== -->
<target name="clean" depends="init"
description="Removes build files">
<delete dir="${build}"/>
</target>
<target name="distclean" depends="clean"
description="Removes the dist files">
<delete dir="${dist.root}"/>
</target>
<!-- =================================================================== -->
<!-- JUnit and Test Coverage targets -->
<!-- =================================================================== -->
<target name="coverage.setup" description="Set up code-coverage metrics" depends="compile.core">
<taskdef classpathref="junit.class.path" resource="tasks.properties"/>
<deltree dir="${junit.instrumented}"/>
<mkdir dir="${junit.instrumented}" />
<property name="cobertura.datafile" value="${junit.instrumented}/cobertura.ser"/>
<cobertura-instrument todir="${junit.instrumented}" datafile="${cobertura.datafile}">
<fileset dir="${core.build}">
<include name="**/*.class"/>
<!-- exclude name="**/**/jaxen/**/*.class"/ -->
</fileset>
</cobertura-instrument>
<property name="forkjunit" value="true" />
</target>
<target name="junit" depends="compile.core, compile.junit"
description="Run all the JUnit tests">
<delete dir="${junit.report}" />
<mkdir dir="${junit.report}" />
<delete dir="${junit.xml}" />
<mkdir dir="${junit.xml}" />
<!-- this may already be set true in the cobertura task. -->
<property name="forkjunit" value="false" />
<junit fork="${forkjunit}" forkmode="once" haltonerror="false" haltonfailure="false"
failureproperty="junit.failed" printsummary="true" timeout="100000"
showoutput="true" includeantruntime="true" >
<sysproperty key="net.sourceforge.cobertura.datafile"
file="${cobertura.datafile}" />
<classpath refid="junit.class.path" />
<formatter type="xml"/>
<batchtest haltonerror="false" haltonfailure="false"
failureproperty="junit.failed" todir="${junit.xml}" >
<fileset dir="${junit.build}">
<include name="**/Test*.java"/>
<exclude name="**/generate/**" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${junit.report}">
<fileset dir="${junit.xml}">
<include name="TEST-*.xml"/>
</fileset>
<report format="frames" todir="${junit.report}"/>
</junitreport>
</target>
<target name="coverage" depends="coverage.setup, junit"
description="Run the code coverage tool.">
<deltree dir="${coverage.out}"/>
<mkdir dir="${coverage.out}" />
<cobertura-report srcdir="${core.build}" destdir="${coverage.out}" datafile="${cobertura.datafile}"/>
<echo message="See ${coverage.out}/index.html for results." />
</target>
<!-- =================================================================== -->
<!-- Eclipse targets -->
<!-- =================================================================== -->
<target name="eclipse" description="Set up your eclipse project (source folders, jars, etc.)">
<echo file="./.classpath" xml:space="preserve"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="core/src/java"/>
<classpathentry kind="src" path="core/package"/>
<classpathentry kind="src" path="core/samples"/>
<classpathentry kind="src" path="test/src/java"/>
<classpathentry kind="src" path="test/resources"/>
<classpathentry kind="src" path="contrib/src/java" excluding="org/jdom/contrib/ids/doc-files/|org/jdom/contrib/input/scanner/doc-files/|org/jdom2/contrib/ids/doc-files/|org/jdom2/contrib/ids/doc-files/|org/jdom2/contrib/input/scanner/doc-files/|org/jdom2/contrib/input/scanner/doc-files/|org/jdom2/contrib/schema/"/>
<classpathentry kind="src" path="contrib/samples"/>
<classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/ids/doc-files"/>
<classpathentry kind="src" path="contrib/src/java/org/jdom2/contrib/input/scanner/doc-files"/>
<classpathentry kind="lib" path="lib/junit-4.8.2.jar"/>
<classpathentry kind="lib" path="lib/xercesImpl.jar"/>
<classpathentry kind="lib" path="lib/xml-apis.jar"/>
<classpathentry kind="lib" path="lib/jaxen-1.1.3.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="ebuild"/>
</classpath>
]]>
</echo>
</target>
</project>
<!-- End of file -->
Jump to Line
Something went wrong with that request. Please try again.