blob: f74991a2cfac7d346427dddc4450f451f229538a [file] [log] [blame]
<!--
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.
-->
<project name="Validator" default="dist" basedir=".">
<!--
"Validator" component of the Apache Commons Subproject
$Id$
-->
<!-- ========== Initialize Properties ===================================== -->
<property file="build.properties"/> <!-- Component local -->
<property file="../build.properties"/> <!-- Commons local -->
<property file="${user.home}/build.properties"/> <!-- User local -->
<!-- ========== External Dependencies ===================================== -->
<!-- The directories corresponding to your necessary dependencies -->
<property name="junit.home" value="/usr/local/junit3.8.1"/>
<property name="commons.home" value="../../jakarta-commons"/>
<property name="sandbox.home" value="../../jakarta-commons-sandbox"/>
<property name="beanutils.home" value="${commons.home}/beanutils"/>
<property name="collections.home" value="${commons.home}/collections"/>
<property name="digester.home" value="${commons.home}/digester"/>
<property name="logging.home" value="${commons.home}/logging"/>
<!-- ========== Derived Values ============================================ -->
<!-- The locations of necessary jar files -->
<property name="junit.jar" value="${junit.home}/junit.jar"/>
<property name="commons-beanutils.jar" value="${beanutils.home}/dist/commons-beanutils.jar"/>
<property name="commons-digester.jar" value="${digester.home}/dist/commons-digester.jar"/>
<property name="commons-logging.jar" value="${logging.home}/dist/commons-logging.jar"/>
<property name="commons-collections.jar" value="${collections.home}/dist/commons-collections.jar"/>
<!-- ========== Component Declarations ==================================== -->
<!-- The name of this component -->
<property name="component.name" value="validator"/>
<!-- The primary package name of this component -->
<property name="component.package" value="org.apache.commons.validator"/>
<!-- The title of this component -->
<property name="component.title" value="Commons Validator"/>
<!-- The current version number of this component -->
<property name="component.version" value="1.5.0-SNAPSHOT"/>
<!-- The base directory for compilation targets -->
<property name="build.home" value="target"/>
<!-- The base directory for component resources -->
<property name="resources.home" value="src/main/resources"/>
<!-- The base directory for distribution targets -->
<property name="dist.home" value="dist"/>
<!-- The base directory for release targets -->
<property name="release.home" value="release" />
<!-- The base directory for component sources -->
<property name="source.home" value="src/main/java"/>
<!-- The base directory for unit test sources -->
<property name="test.home" value="src/test"/>
<!-- The base directory for example sources -->
<property name="example.home" value="src/example"/>
<!-- Directory where test results are stored -->
<property name="test.results.dir" value="${build.home}/test-results" />
<!-- Directory where binary release files are staged -->
<property name="stage.bin.dir" value="${release.home}/stage/bin"/>
<!-- Directory where source release files are staged -->
<property name="stage.src.dir" value="${release.home}/stage/src"/>
<!-- Directory where release builds are prepared for upload -->
<property name="upload.dir" value="${release.home}/upload"/>
<!-- Base file name for upload files -->
<property name="upload.file.base" value="${component.name}-${component.version}"/>
<!-- Download lib dir -->
<property name="download.lib.dir" value="lib"/>
<!-- ========== Compiler Defaults ========================================= -->
<!-- source JDK version (should be same as maven.compile.source) -->
<property name="compile.source" value="1.5"/>
<!-- target JDK version (should be same as maven.compile.target) -->
<property name="compile.target" value="1.5"/>
<!-- 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"/>
<pathelement location="${commons-beanutils.jar}"/>
<pathelement location="${commons-digester.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${commons-collections.jar}"/>
<path refid="downloaded.lib.classpath"/>
</path>
<!-- Construct compile classpath -->
<path id="downloaded.lib.classpath">
<pathelement location="${download.lib.dir}/commons-beanutils.jar"/>
<pathelement location="${download.lib.dir}/commons-digester.jar"/>
<pathelement location="${download.lib.dir}/commons-logging.jar"/>
<pathelement location="${download.lib.dir}/commons-collections.jar"/>
<pathelement location="${download.lib.dir}/junit.jar"/>
</path>
<!-- ========== Test Execution Defaults =================================== -->
<!-- Construct unit test classpath -->
<path id="test.classpath">
<pathelement location="${build.home}/classes"/>
<pathelement location="${build.home}/tests"/>
<pathelement location="${commons-beanutils.jar}"/>
<pathelement location="${commons-digester.jar}"/>
<pathelement location="${commons-logging.jar}"/>
<pathelement location="${commons-collections.jar}"/>
<pathelement location="${junit.jar}"/>
<pathelement location="${xerces.jar}"/>
<path refid="downloaded.lib.classpath"/>
</path>
<!-- Should all tests fail if one does? -->
<property name="test.failonerror" value="true"/>
<!-- ========== Example Execution Defaults ================================ -->
<!-- Construct example classpath -->
<path id="example.classpath">
<path refid="test.classpath"/>
<pathelement location="${build.home}/example" />
</path>
<!-- ========== Executable Targets ======================================== -->
<target name="init"
description="Initialize and evaluate conditionals">
<echo message="-------- ${component.name} ${component.version} --------"/>
<filter token="name" value="${component.name}"/>
<filter token="package" value="${component.package}"/>
<filter token="version" value="${component.version}"/>
<filter token="compilesource" value="${compile.source}"/>
<filter token="compiletarget" value="${compile.target}"/>
<available property="jsdoc.found" type="file" file="${jsdoc.home}/jsdoc.pl"/>
</target>
<target name="prepare" depends="init,download-dependencies"
description="Prepare build directory">
<mkdir dir="${build.home}"/>
<mkdir dir="${build.home}/classes"/>
<mkdir dir="${build.home}/tests"/>
<mkdir dir="${test.results.dir}"/>
</target>
<target name="static" depends="prepare"
description="Copy static files to build directory">
<tstamp/>
</target>
<target name="compile" depends="static"
description="Compile shareable components">
<javac srcdir="${source.home}"
destdir="${build.home}/classes"
source="${compile.source}"
target="${compile.target}"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="compile.classpath"/>
</javac>
<copy todir="${build.home}/classes" filtering="on">
<fileset dir="${source.home}"
excludes="**/*.java"/>
</copy>
<copy todir="${build.home}/classes">
<fileset dir="${resources.home}" includes="**/*.dtd,**/*.xml"/>
</copy>
</target>
<target name="clean"
description="Clean build and distribution directories">
<delete dir="${build.home}"/>
<delete dir="${dist.home}"/>
<delete dir="${release.home}"/>
</target>
<target name="all" depends="clean,compile"
description="Clean and compile all components"/>
<target name="javadoc.init"
description="Initializes Javadoc directories">
<mkdir dir="${dist.home}"/>
<mkdir dir="${dist.home}/docs"/>
<mkdir dir="${dist.home}/docs/apidocs"/>
</target>
<target name="javadoc" depends="compile"
description="Create component Javadoc documentation">
<!--javadoc sourcepath="${source.home}"
destdir="${dist.home}/docs/apidocs"
packagenames="org.apache.commons.*"
author="true"
private="true"
version="true"
doctitle="&lt;h1&gt;${component.title} (Version ${component.version})&lt;/h1&gt;"
windowtitle="${component.title} (Version ${component.version})"
bottom="Copyright (c) 2001-2004 Apache Software Foundation"
classpathref="compile.classpath" / -->
</target>
<target name="change-log" >
<cvschangelog destfile="changelog.xml" start="${cvs.start}" />
<style in="changelog.xml" out="changelog.html" style="${ant.home}/etc/changelog.xsl">
<param name="title" expression="Validator ChangeLog"/>
<param name="module" expression="commons"/>
<param name="cvsweb" expression="http://cvs.apache.org/viewcvs/"/>
</style>
</target>
<target name="dist" depends="compile,javadoc"
description="Create binary distribution">
<mkdir dir="${dist.home}"/>
<copy file="LICENSE.txt"
todir="${dist.home}"/>
<copy file="NOTICE.txt"
todir="${dist.home}"/>
<copy file="RELEASE-NOTES.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"/>
<manifest file="${build.home}/MANIFEST.MF">
<attribute name="Specification-Title" value="${component.title}"/>
<attribute name="Specification-Version" value="${component.version}"/>
<attribute name="Specification-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Title" value="${component.title}"/>
<attribute name="Implementation-Version" value="${component.version}"/>
<attribute name="Implementation-Vendor" value="Apache Software Foundation"/>
<attribute name="Implementation-Vendor-Id" value="org.apache"/>
<attribute name="X-Compile-Source-JDK" value="${compile.source}"/>
<attribute name="X-Compile-Target-JDK" value="${compile.target}"/>
</manifest>
<jar jarfile="${dist.home}/commons-${component.name}-${component.version}.jar"
basedir="${build.home}/classes"
manifest="${build.home}/MANIFEST.MF"/>
</target>
<!-- ========== Unit Test Targets ========================================= -->
<target name="compile.tests" depends="compile"
description="Compile unit test cases">
<javac srcdir="${test.home}/java"
destdir="${build.home}/tests"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="test.classpath"/>
</javac>
<copy todir="${build.home}/tests" filtering="on">
<fileset dir="${test.home}/resources"/>
</copy>
</target>
<target name="test" depends="compile.tests,test.main,test.checkdigit,test.routines"
description="Run all unit test cases">
</target>
<target name="test.main" depends="compile.tests"
description="Run main unit test cases">
<echo message="Running main tests ..."/>
<junit fork="yes" forkmode="once" printsummary="yes"
haltonfailure="${test.failonerror}"
failureproperty="main.test.failed" showoutput="true">
<classpath refid="test.classpath"/>
<formatter type="plain"/>
<batchtest todir="${test.results.dir}">
<fileset dir="${test.home}/java">
<include name="org/apache/commons/validator/*Test.java" />
<exclude name="**/Abstract*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="test.checkdigit" depends="compile.tests"
description="Run checkdigit unit test cases">
<echo message="Running checkdigit tests ..."/>
<junit fork="yes" forkmode="once" printsummary="yes"
haltonfailure="${test.failonerror}"
failureproperty="main.test.failed" showoutput="true">
<classpath refid="test.classpath"/>
<formatter type="plain"/>
<batchtest todir="${test.results.dir}">
<fileset dir="${test.home}/java">
<include name="org/apache/commons/validator/routines/checkdigit/*Test.java" />
<exclude name="**/Abstract*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="test.routines" depends="compile.tests"
description="Run routines unit test cases">
<echo message="Running routines tests ..."/>
<junit fork="yes" forkmode="once" printsummary="yes"
haltonfailure="${test.failonerror}"
failureproperty="main.test.failed" showoutput="true">
<classpath refid="test.classpath"/>
<formatter type="plain"/>
<batchtest todir="${test.results.dir}">
<fileset dir="${test.home}/java">
<include name="org/apache/commons/validator/routines/*Test.java" />
<exclude name="**/Abstract*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<!-- ========== Example Targets =========================================== -->
<target name="prepare.example" depends="compile"
description="Prepare example directory">
<mkdir dir="${build.home}/example"/>
</target>
<target name="compile.example" depends="prepare.example"
description="Compile example application">
<javac srcdir="${example.home}"
destdir="${build.home}/example"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
<classpath refid="example.classpath"/>
</javac>
<copy todir="${build.home}/example" filtering="on">
<fileset dir="${example.home}" excludes="**/*.java"/>
</copy>
</target>
<target name="example" depends="compile.example,compile.tests"
description="Run example application">
<java fork="yes"
classname="org.apache.commons.validator.example.ValidateExample"
taskname="main" failonerror="true">
<classpath refid="example.classpath" />
</java>
</target>
<!-- ========== Release Targets =========================================== -->
<target name="release" depends="clean,dist"
description="Construct release distribution">
<mkdir dir="${stage.bin.dir}/${upload.file.base}"/>
<mkdir dir="${stage.src.dir}/${upload.file.base}-src"/>
<copy todir="${stage.bin.dir}/${upload.file.base}">
<fileset dir="${dist.home}"/>
</copy>
<copy todir="${stage.src.dir}/${upload.file.base}-src">
<fileset dir=".">
<exclude name="build.properties"/>
<exclude name="${build.home}/**"/>
<exclude name="${dist.home}/**"/>
<exclude name="${build.home}/**"/>
</fileset>
</copy>
<mkdir dir="${upload.dir}"/>
<zip zipfile="${upload.dir}/${upload.file.base}.zip"
basedir="${stage.bin.dir}"/>
<zip zipfile="${upload.dir}/${upload.file.base}-src.zip"
basedir="${stage.src.dir}"/>
<tar tarfile="${upload.dir}/${upload.file.base}.tar"
basedir="${stage.bin.dir}"
longfile="gnu"/>
<tar tarfile="${upload.dir}/${upload.file.base}-src.tar"
basedir="${stage.src.dir}"
longfile="gnu"/>
<gzip src="${upload.dir}/${upload.file.base}.tar"
zipfile="${upload.dir}/${upload.file.base}.tar.gz"/>
<gzip src="${upload.dir}/${upload.file.base}-src.tar"
zipfile="${upload.dir}/${upload.file.base}-src.tar.gz"/>
</target>
<!-- ========== Download Dependencies =========================================== -->
<target name="download-dependencies"
depends="check-availability" unless="skip.download">
<echo message="doing download-dependencies..." />
<antcall target="download-beanutils" />
<antcall target="download-digester" />
<antcall target="download-logging" />
<antcall target="download-collections" />
<antcall target="download-junit" />
</target>
<target name="check-availability">
<echo message="doing check-availability..." />
<available file="${commons-beanutils.jar}" property="beanutils.found"/>
<available file="${commons-digester.jar}" property="digester.found"/>
<available file="${commons-logging.jar}" property="logging.found"/>
<available file="${commons-collections.jar}" property="collections.found"/>
<available file="${junit.jar}" property="junit.found"/>
</target>
<target name="download-beanutils" unless="beanutils.found">
<echo message="Downloading beanutils..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/commons-beanutils.jar"
usetimestamp="true" ignoreerrors="true"
src="http://repo.maven.apache.org/maven2/commons-beanutils/commons-beanutils/1.9.2/commons-beanutils-1.9.2.jar"/>
</target>
<target name="download-digester" unless="digester.found">
<echo message="Downloading digester..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/commons-digester.jar"
usetimestamp="true" ignoreerrors="true"
src="http://repo.maven.apache.org/maven2/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar"/>
</target>
<target name="download-logging" unless="logging.found">
<echo message="Downloading logging..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/commons-logging.jar"
usetimestamp="true" ignoreerrors="true"
src="http://repo.maven.apache.org/maven2/commons-logging/commons-logging/1.2/commons-logging-1.2.jar"/>
</target>
<target name="download-collections" unless="collections.found">
<echo message="Downloading collections..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/commons-collections.jar"
usetimestamp="true" ignoreerrors="true"
src="http://repo.maven.apache.org/maven2/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar"/>
</target>
<target name="download-junit" unless="junit.found">
<echo message="Downloading junit..."/>
<mkdir dir="${download.lib.dir}" />
<get dest="${download.lib.dir}/junit.jar"
usetimestamp="true" ignoreerrors="true"
src="http://repo.maven.apache.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar"/>
</target>
</project>