blob: 63804ffd96602618cba423fde6de1043d5bd5273 [file] [log] [blame]
<project name="Functor" default="test" basedir=".">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
Commons-Functor Ant Build File
$Id$
-->
<!-- ========== Initialize Properties ===================================== -->
<property file="build.properties"/> <!-- Component local -->
<property file="../build.properties"/> <!-- Commons (sandbox) local -->
<property file="${user.home}/build.properties"/> <!-- User local -->
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="functor"/>
<!-- The primary package name of this component -->
<property name="component.package" value="org.apache.commons.functor"/>
<!-- The title of this component -->
<property name="component.title" value="Functor - Function Objects for Java"/>
<!-- The current version number of this component -->
<property name="component.version" value="1.0-SNAPSHOT"/>
<!-- The base directory for compilation targets -->
<property name="build.home" location="target"/>
<!-- The base directory for component configuration files -->
<property name="conf.home" location="src/conf"/>
<!-- The base directory for distribution targets -->
<property name="dist.home" location="dist"/>
<!-- The base directory for component sources -->
<property name="source.home" location="src/main/java"/>
<!-- The base directory for unit test sources -->
<property name="test.home" location="src/test/java"/>
<!-- ========== Compiler Defaults ========================================= -->
<!-- Should Java compilations set the 'debug' compiler option? -->
<property name="compile.debug" value="true"/>
<!-- Should Java compilations set the 'deprecation' compiler option? -->
<property name="compile.deprecation" value="false"/>
<!-- Should Java compilations set the 'optimize' compiler option? -->
<property name="compile.optimize" value="true"/>
<!-- Construct compile classpath -->
<path id="compile.classpath">
<pathelement location="${build.home}/classes"/>
</path>
<path id="javadoc.classpath">
<pathelement location="${build.home}/classes"/>
</path>
<!-- ========== Test Execution Defaults =================================== -->
<available property="jre.dom.available" classname="java.lang.CharSequence" />
<fileset id="xmlLibs" dir="${ant.home}/lib">
<include name="xml-apis.jar" unless="jre.dom.available" />
<include name="xercesImpl.jar" unless="jre.dom.available" />
</fileset>
<!-- Construct unit test classpath -->
<path id="test.classpath">
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/test-classes"/>
<pathelement location="${test.home}"/>
<fileset refid="xmlLibs" />
</path>
<available property="xalan.available"
classname="org.apache.xalan.processor.TransformerFactoryImpl"/>
<property name="test.entry" value="org.apache.commons.functor.TestAll"/>
<property name="junit.fork" value="true" />
<property name="junit.forkmode" value="once" />
<!-- ========== Executable Targets ======================================== -->
<target name="init" description="Initialize and evaluate conditionals">
<tstamp/>
<echo message="-------- ${component.name} ${component.version} --------"/>
<filter token="name" value="${component.package}"/>
<filter token="version" value="${component.version}"/>
</target>
<target name="prepare" depends="init" description="Prepare build directory">
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
<mkdir dir="${build.home}/conf"/>
<mkdir dir="${build.home}/test-classes"/>
<mkdir dir="${build.home}/junit-reports/xml"/>
</target>
<target name="static" depends="prepare" description="Copy static files to build directory">
<copy todir="${build.home}/conf" filtering="on">
<fileset dir="${conf.home}" includes="*.MF"/>
</copy>
</target>
<target name="compile" depends="static" description="Compile shareable components">
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
</target>
<target name="compile-tests" depends="compile"
description="Compile unit test cases">
<javac srcdir="${test.home}"
destdir="${build.home}/test-classes"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="test.classpath"/>
</javac>
</target>
<target name="clean" description="Clean build and distribution directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
</target>
<target name="javadoc" depends="prepare" description="Create component Javadoc documentation">
<mkdir dir="${dist.home}"/>
<mkdir dir="${dist.home}/docs"/>
<mkdir dir="${dist.home}/docs/api"/>
<tstamp>
<format property="current.year" pattern="yyyy"/>
</tstamp>
<javadoc destdir="${dist.home}/docs/api"
sourcepath="${source.home}"
packagenames="org.apache.commons.*"
author="false"
version="true"
doctitle="&lt;h1&gt;${component.title} (Version ${component.version})&lt;/h1&gt;"
windowtitle="${component.title} (Version ${component.version})"
bottom="Copyright (c) 2003-${current.year} The Apache Software Foundation.">
<classpath refid="javadoc.classpath"/>
</javadoc>
</target>
<target name="dist" depends="test,javadoc" description="Create binary distribution">
<mkdir dir="${dist.home}"/>
<copy file="LICENSE.txt" todir="${dist.home}"/>
<copy file="NOTICE.txt" todir="${dist.home}"/>
<mkdir dir="${build.home}/classes/META-INF"/>
<copy file="LICENSE.txt" tofile="${build.home}/classes/META-INF/LICENSE.txt"/>
<copy file="NOTICE.txt" tofile="${build.home}/classes/META-INF/NOTICE.txt"/>
<jar jarfile="${dist.home}/commons-${component.name}-${component.version}.jar"
basedir="${build.home}/classes">
<manifest>
<attribute name="Specification-Title" value="Commons Functor"/>
<attribute name="Specification-Version" value="${component.version}"/>
<attribute name="Specification-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Title" value="Commons Functor"/>
<attribute name="Implementation-Version" value="${component.version}"/>
<attribute name="Implementation-Vendor" value="The Apache Software Foundation"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
</manifest>
</jar>
</target>
<!-- ========== Unit Test Targets ========================================= -->
<target name="run-tests" depends="compile-tests">
<delete>
<fileset dir="${build.home}/junit-reports/xml"/>
</delete>
<junit printsummary="withOutAndErr" showoutput="true"
fork="${junit.fork}" forkmode="${junit.forkmode}" failureproperty="tests.failed">
<formatter type="xml" />
<formatter type="plain" />
<test name="${test.entry}" todir="${build.home}/junit-reports/xml" />
<classpath refid="test.classpath" />
</junit>
</target>
<target name="run-reports" if="xalan.available">
<junitreport todir="${build.home}/junit-reports">
<fileset dir="${build.home}/junit-reports/xml" includes="TEST-*.xml" />
<report format="frames" todir="${build.home}/junit-reports" />
</junitreport>
</target>
<target name="test" description="Run tests" depends="run-tests,run-reports">
<fail if="tests.failed">Tests failed</fail>
</target>
<!-- ========== Gump Targets ============================================== -->
<target name="gump" depends="clean,test,dist"/>
</project>