Ant Javac setting
<?xml version="1.0"?>
<!--
The BSD License for the JGoodies Animation
Copyright (c) 2001-2009 JGoodies Karsten Lentzsch. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
o Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
o Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
o Neither the name of JGoodies Karsten Lentzsch nor the names of
its contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
$Id: build.xml,v 1.11 2006/06/16 18:33:59 karsten Exp $
This is a build file for use with the Jakarta Ant build tool, see
http://jakarta.apache.org/ant/index.html
To build, go to the directory where this file is located and run
ant <target>
with one of the following targets:
clean removes temporary files and directories
compile compiles the core, extras, tutorial and tests
javadoc creates the API documentation
test compiles and runs the unit tests
jar creates a library jar
create-dist-dir creates a distribution tree: docs, sources, jar
create-dist-zip creates a zipped distribution
create-maven-bundle creates a Maven bundle
create-all creates the distribution zip and Maven bundle
To run the unit tests you MUST set the junit.jar property,
for example in your user build.properties file.
-->
<project default="create-all" basedir="." name="JGoodies Animation" >
<!-- ***************************************************************** -->
<!-- Give users a chance to override build properties. -->
<!-- ***************************************************************** -->
<property file="${user.home}/animation.build.properties" />
<property file="${user.home}/build.properties" />
<property file="${basedir}/build.properties" />
<property file="${basedir}/default.properties" />
<!-- ***************************************************************** -->
<!-- P A T H S -->
<!-- ***************************************************************** -->
<path id="classpath.core">
<pathelement location="${build.core.dir}" />
</path>
<path id="classpath.tests">
<pathelement location="${build.core.dir}" />
<pathelement location="${build.test.dir}" />
<pathelement location="${junit.jar}" />
</path>
<path id="classpath.tutorial">
<pathelement location="${lib.binding.jar}" />
<pathelement location="${lib.forms.jar}" />
<pathelement location="${build.core.dir}" />
</path>
<!-- ***************************************************************** -->
<!-- C L E A N -->
<!-- ***************************************************************** -->
<target name="clean"
description="Removes all temporary files and directories." >
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<!-- ***************************************************************** -->
<!-- P R E P A R A T I O N -->
<!-- ***************************************************************** -->
<target name="prepare"
description="Prepares the build and distribution targets." >
<tstamp>
<format property="DATE" pattern="yyyy-MM-dd hh:mm:ss" />
</tstamp>
<mkdir dir="${build.core.dir}" />
<mkdir dir="${build.tutorial.dir}" />
<available
property="junit.task.present"
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
/>
<available
property="junit.jar.present"
file="${junit.jar}"
/>
</target>
<!-- ***************************************************************** -->
<!-- C O M P I L A T I O N -->
<!-- ***************************************************************** -->
<target name="compile"
depends="compile-core, compile-tests, compile-tutorial"
description="Compiles the library core, test, and tutorial." />
<!-- ***************************************************************** -->
<target name="compile-core" depends="prepare"
description="Compiles the core sources." >
<javac
srcdir ="${src.core.dir}"
destdir ="${build.core.dir}"
encoding ="${build.encoding}"
executable ="${build.compile.executable}"
fork ="${build.compile.fork}"
debug ="${build.compile.debug}"
depend ="${build.compile.depend}"
deprecation ="${build.compile.deprecation}"
nowarn ="${build.compile.nowarn}"
optimize ="${build.compile.optimize}"
source ="${build.compile.source}"
target ="${build.compile.target}"
verbose ="${build.compile.verbose}"
bootclasspath="${build.boot.classpath}" />
</target>
<!-- ***************************************************************** -->
<target name="compile-tests" depends="compile-core" if="junit.jar.present"
description="Compiles the unit tests." >
<mkdir dir="${build.test.dir}"/>
<javac
srcdir ="${src.test.dir}"
destdir ="${build.test.dir}"
encoding ="${build.encoding}"
executable ="${build.compile.executable}"
fork ="${build.compile.fork}"
debug ="${build.compile.debug}"
depend ="${build.compile.depend}"
deprecation ="${build.compile.deprecation}"
nowarn ="${build.compile.nowarn}"
optimize ="${build.compile.optimize}"
source ="${build.compile.source}"
target ="${build.compile.target}"
verbose ="${build.compile.verbose}"
bootclasspath="${build.boot.classpath}"
classpathref ="classpath.tests" />
</target>
<!-- ***************************************************************** -->
<target name="compile-tutorial" depends="compile-core"
description="Compiles the tutorial." >
<javac
srcdir ="${src.tutorial.dir}"
destdir ="${build.tutorial.dir}"
encoding ="${build.encoding}"
executable ="${build.compile.executable}"
fork ="${build.compile.fork}"
debug ="${build.compile.debug}"
depend ="${build.compile.depend}"
deprecation ="${build.compile.deprecation}"
nowarn ="${build.compile.nowarn}"
optimize ="${build.compile.optimize}"
source ="${build.compile.source}"
target ="${build.compile.target}"
verbose ="${build.compile.verbose}"
bootclasspath="${build.boot.classpath}"
classpathref ="classpath.tutorial" />
</target>
<!-- ***************************************************************** -->
<!-- J A V A D O C -->
<!-- ***************************************************************** -->
<target name="javadoc" depends="prepare"
description="Creates the API documentation using JavaDoc." >
<mkdir dir="${build.javadocs.dir}" />
<javadoc
sourcepath="${src.core.dir}"
packagenames="${javadoc.packages}"
destdir="${build.javadocs.dir}"
encoding="${build.encoding}"
access="protected"
author="true"
version="true"
use="true"
link="${javadoc.link}"
windowtitle="${Name} ${spec.version} API"
doctitle="${Name} ${spec.version} API"
bottom="${copyright.message}" >
</javadoc>
</target>
<!-- ***************************************************************** -->
<!-- U N I T T E S T S -->
<!-- ***************************************************************** -->
<target name="test" depends="compile-tests" if="junit.task.present"
description="Compiles and runs the unit tests." >
<mkdir dir="${build.reports.dir}"/>
<junit printsummary="yes" haltonfailure="no" >
<classpath refid="classpath.tests"/>
<formatter type="plain" />
<batchtest fork="yes" todir="${build.reports.dir}">
<fileset dir="${src.test.dir}" includes="**/*Test.java" />
</batchtest>
</junit>
</target>
<!-- ***************************************************************** -->
<!-- J A R -->
<!-- ***************************************************************** -->
<target name="jar" depends="compile-core"
description="Creates the library jar." >
<jar
destfile="${build.core.jar}" >
<fileset dir="${build.core.dir}" />
<manifest>
<attribute name ="Built-By"
value="${user.name}"/>
<attribute name ="Specification-Title"
value="${spec.title}" />
<attribute name ="Specification-Version"
value="${spec.version}" />
<attribute name ="Specification-Vendor"
value="${spec.vendor}" />
<attribute name ="Implementation-Title"
value="${impl.title}" />
<attribute name ="Implementation-Version"
value="${impl.version} ${DATE}" />
<attribute name ="Implementation-Vendor"
value="${impl.vendor}" />
</manifest>
</jar>
</target>
<!-- ***************************************************************** -->
<!-- P A C K A G E -->
<!-- ***************************************************************** -->
<target name="package" depends="clean, compile, javadoc, test, jar"
description="Creates the distribution directory tree." >
<mkdir dir="${dist.dir}" />
<!-- Copy the examples. -->
<!-- Copy the libraries. -->
<copy todir="${dist.lib.dir}" >
<fileset dir="${lib.dir}"
includes="forms-*.jar, binding-*.jar, jlme*.jar" />
</copy>
<!-- Copy the source directories. -->
<copy todir="${dist.src.dir}" >
<fileset dir="${src.dir}"
includes="examples/**/*, test/**/*, tutorial/**/*" />
</copy>
<!-- Copy the distribution files. -->
<copy todir="${dist.dir}" >
<fileset dir="${top.dir}"
includes="*.txt, *.html, *.xml, *.properties"
excludes="todo.txt" />
</copy>
<!-- Copy the library jar file. -->
<copy tofile="${dist.core.jar}" file="${build.core.jar}" />
</target>
<!-- ***************************************************************** -->
<!-- C R E A T E -->
<!-- ***************************************************************** -->
<target name="create-all" depends="create-dist-zip, create-maven-bundle"
description="Creates the distribution zip and Maven bundle." >
</target>
<target name="create-dist-dir" depends="clean, compile, javadoc, test, jar"
description="Creates the distribution directory tree." >
<mkdir dir="${dist.dir}" />
<!-- Compile the documentation. -->
<copy todir="${dist.docs.dir}" >
<fileset dir="${docs.dir}"
excludes="**/*.psd, **/*.sxw" />
</copy>
<move todir="${dist.docs.dir}" file="${build.javadocs.dir}" />
<!-- Copy the libraries. -->
<copy todir="${dist.lib.dir}" >
<fileset dir="${lib.dir}"
includes="forms-*.jar, binding-*.jar" />
</copy>
<!-- Copy the source directories. -->
<copy todir="${dist.src.dir}" >
<fileset dir="${src.dir}"
excludes="unused,
unused/**/*" />
</copy>
<!-- Copy the distribution files. -->
<copy todir="${dist.dir}" >
<fileset dir="${top.dir}"
includes="*.txt, *.html, *.xml, *.properties"
excludes="todo.txt" />
</copy>
<!-- Copy the library jar file. -->
<copy tofile="${dist.core.jar}" file="${build.core.jar}" />
</target>
<!-- ***************************************************************** -->
<target name="create-dist-zip" depends="create-dist-dir"
description="Packages the distribution as a zip file." >
<zip
destfile="${dist.zip}"
basedir="${dist.root.dir}"
includes="${dist.subdir}/**/*" />
</target>
<!-- ***************************************************************** -->
<target name="create-maven-bundle" depends="create-dist-dir"
description="Creates a Maven bundle for the Ibiblio upload." >
<!-- Copy the Maven pom template. -->
<copy tofile="${dist.maven.pom}" file="${build.maven.pom.template}" />
<!-- Replace the version in the pom.xml. -->
<replace file="${dist.maven.pom}"
token="@impl.version"
value="${impl.version}" />
<copy tofile="${dist.maven.bin.jar}" file="${build.core.jar}" />
<jar
destfile="${dist.maven.src.jar}"
basedir="${dist.src.dir}" />
<jar
destfile="${dist.maven.bundle}"
basedir="${build.maven.dir}" />
</target>
</project>
Related examples in the same category