dlr 01/08/24 09:45:35
Modified: util build.xml
Log:
Moved properties into build.properties file, and added test case
compilation and execution.
Revision Changes Path
1.4 +61 -66 jakarta-commons-sandbox/util/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/util/build.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- build.xml 2001/08/08 16:09:31 1.3
+++ build.xml 2001/08/24 16:45:35 1.4
@@ -1,79 +1,29 @@
<project name="Jakarta Commons Utilities" default="jar" basedir=".">
<!--
- $Id: build.xml,v 1.3 2001/08/08 16:09:31 dlr Exp $
+ $Id: build.xml,v 1.4 2001/08/24 16:45:35 dlr Exp $
-->
<!-- ========== Initialize Properties =================================== -->
- <property file="build.properties"/> <!-- Component local -->
+ <property file="./build.properties"/> <!-- Component local -->
<property file="../build.properties"/> <!-- Commons local -->
<property file="${user.home}/build.properties"/> <!-- User local -->
-<!-- ========== Component Declarations ================================== -->
+<!-- ========== Classpaths ============================================== -->
-
- <!-- The name of this component -->
- <property name="component.name" value="commons-util"/>
-
- <!-- The title of this component -->
- <property name="component.title" value="Jakarta Commons Utilities"/>
-
- <!-- The current version number of this component -->
- <property name="component.version" value="0.1-dev"/>
-
- <!-- The JAR file for this component -->
- <property name="component.jar"
value="${component.name}-${component.version}.jar"/>
-
- <!-- The base directory for compilation targets -->
- <property name="build.home" value="target"/>
-
- <!-- The base directory for distribution targets -->
- <property name="dist.home" value="dist"/>
-
- <!-- The base directory for component sources -->
- <property name="source.home" value="src"/>
-
- <!-- The base directory for unit test sources -->
- <property name="test.home" value="src/test"/>
-
-
-<!-- ========== Compiler Defaults ======================================= -->
-
-
- <!-- Should Java compilations set the 'debug' compiler option? -->
- <property name="compile.debug" value="false"/>
-
- <!-- Should Java compilations set the 'deprecation' compiler option? -->
- <property name="compile.deprecation" value="true"/>
-
- <!-- 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="${build.home}/class"/>
</path>
-
-<!-- ========== Test Execution Defaults ================================= -->
-
-
- <!-- Construct unit test classpath -->
<path id="test.classpath">
- <pathelement location="${build.home}/classes"/>
- <pathelement location="${build.home}/tests"/>
+ <pathelement location="${build.home}/class"/>
+ <pathelement location="${build.home}/test"/>
<pathelement location="${junit.jar}"/>
</path>
- <!-- Should all tests fail if one does? -->
- <property name="test.failonerror" value="true"/>
-
- <!-- The test runner to execute -->
- <property name="test.runner" value="junit.textui.TestRunner"/>
-
<!-- ========== Executable Targets ====================================== -->
@@ -82,15 +32,20 @@
<echo message="-------- ${component.name} ${component.version} --------"/>
<filter token="name" value="${component.name}"/>
<filter token="version" value="${component.version}"/>
+
+ <available
+ classname="junit.framework.TestCase"
+ property="junit.present"
+ classpathref="test.classpath"/>
</target>
<target name="prepare" depends="init"
description="Prepare build directory">
<mkdir dir="${build.home}"/>
- <mkdir dir="${build.home}/classes"/>
+ <mkdir dir="${build.home}/class"/>
<mkdir dir="${build.home}/conf"/>
- <mkdir dir="${build.home}/tests"/>
+ <mkdir dir="${build.home}/test"/>
</target>
@@ -103,7 +58,7 @@
description="Compile shareable components">
<javac srcdir="${source.home}/java"
- destdir="${build.home}/classes"
+ destdir="${build.home}/class"
debug="${compile.debug}"
deprecation="${compile.deprecation}"
optimize="${compile.optimize}">
@@ -140,29 +95,28 @@
bottom="Copyright (c) 2001 - Apache Software Foundation"/>
</target>
+
<target name="jar" depends="compile" description="Build jar">
<jar jarfile="${component.jar}"
- basedir="${build.home}/classes"
+ basedir="${build.home}/class"
manifest="${source.home}/conf/MANIFEST.MF" />
</target>
+
<target name="dist" depends="compile,javadoc"
description="Create binary distribution">
<mkdir dir="${dist.home}"/>
<copy file="LICENSE" todir="${dist.home}"/>
<!-- make a complete jar w/ the MinML2 SAX stuff -->
- <unzip src="${minml2.jar}" dest="${build.home}/classes"/>
- <delete dir="${build.home}/classes/META-INF" quiet="true"/>
+ <unzip src="${minml2.jar}" dest="${build.home}/class"/>
+ <delete dir="${build.home}/class/META-INF" quiet="true"/>
<jar jarfile="${dist.home}/${component.jar}"
- basedir="${build.home}/classes"
+ basedir="${build.home}/class"
manifest="${source.home}/conf/MANIFEST.MF"/>
</target>
- <!-- ================================================================== -->
- <!-- I N S T A L L J A R -->
- <!-- ================================================================== -->
<target name="install-jar" depends="jar"
description="==> Installs .jar file in ${lib.repo}">
@@ -173,6 +127,47 @@
</copy>
</target>
+
+ <target name="compile-tests" depends="prepare,compile" if="junit.present"
+ description="==> compiles the test source code">
+ <mkdir dir="${build.home}/test"/>
+
+ <javac srcdir="${test.home}"
+ destdir="${build.home}/test"
+ excludes="**/package.html"
+ debug="${debug}"
+ deprecation="${deprecation}"
+ optimize="${optimize}">
+ <classpath refid="test.classpath"/>
+ <classpath>
+ <pathelement path="${build.dest}"/>
+ </classpath>
+ </javac>
+ </target>
+
+
<!-- ========== Unit Test Targets ======================================= -->
+
+ <target name="run-tests" depends="prepare,compile-tests" if="junit.present"
+ description="==> Runs the unit tests">
+
+ <taskdef name="junit"
+ classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
+ <classpath refid="test.classpath"/>
+ </taskdef>
+
+ <junit printsummary="no" haltonfailure="yes">
+ <classpath>
+ <path refid="test.classpath"/>
+ </classpath>
+ <formatter type="plain" usefile="false"/>
+
+ <batchtest>
+ <fileset dir="${test.home}">
+ <include name="**/*Test.java"/>
+ </fileset>
+ </batchtest>
+ </junit>
+ </target>
</project>