|
1 |
| -<project name="java-algorithms-implementation" default="dist" basedir="."> |
| 1 | +<project name="java-algorithms-implementation" default="test" basedir="."> |
2 | 2 | <description>
|
3 | 3 | java-algorithms-implementation build file
|
4 | 4 | </description>
|
|
8 | 8 | <property name="build" location="build"/>
|
9 | 9 | <property name="dist" location="dist"/>
|
10 | 10 |
|
11 |
| - <target name="init"> |
12 |
| - <!-- Create the time stamp --> |
13 |
| - <tstamp/> |
14 |
| - <!-- Create the build directory structure used by compile --> |
15 |
| - <mkdir dir="${build}"/> |
16 |
| - <!-- Create the dist directory structure used by compile --> |
17 |
| - <mkdir dir="${dist}"/> |
18 |
| - </target> |
19 |
| - |
20 | 11 | <path id="class.path">
|
21 | 12 | <fileset dir="lib">
|
22 | 13 | <include name="**/*.jar" />
|
23 | 14 | </fileset>
|
24 | 15 | </path>
|
25 | 16 |
|
26 |
| - <target name="compile" depends="init" description="compile the source"> |
| 17 | + <path id="test.class.path"> |
| 18 | + <fileset dir="lib"> |
| 19 | + <include name="**/*.jar" /> |
| 20 | + </fileset> |
| 21 | + <fileset dir="dist"> |
| 22 | + <include name="**/*.jar" /> |
| 23 | + </fileset> |
| 24 | + </path> |
| 25 | + |
| 26 | + <target name="init" depends="clean"> |
| 27 | + <!-- Create the time stamp --> |
| 28 | + <tstamp/> |
| 29 | + <!-- Create the build directory structure used by build --> |
| 30 | + <mkdir dir="${build}"/> |
| 31 | + <!-- Create the dist directory structure used by build --> |
| 32 | + <mkdir dir="${dist}"/> |
| 33 | + </target> |
| 34 | + |
| 35 | + <target name="build" depends="init" description="build the source"> |
27 | 36 | <!-- Compile the java code from ${src} into ${build} -->
|
28 | 37 | <javac srcdir="${src}" destdir="${build}">
|
29 | 38 | <classpath refid="class.path" />
|
30 | 39 | </javac>
|
31 | 40 | </target>
|
32 | 41 |
|
33 |
| - <target name="dist" depends="compile" description="generate the distribution"> |
| 42 | + <target name="dist" depends="build" description="generate the distribution"> |
34 | 43 | <!-- Create the distribution directory -->
|
35 | 44 |
|
36 | 45 | <!-- Put everything in ${build} into the java-algorithms-implementation-${DSTAMP}.jar file -->
|
37 | 46 | <jar jarfile="${dist}/java-algorithms-implementation-${DSTAMP}.jar" basedir="${build}"/>
|
38 | 47 | </target>
|
39 | 48 |
|
| 49 | + <target name="run_tests" depends="dist"> |
| 50 | + <junit printsummary="on" haltonfailure="yes"> |
| 51 | + <classpath> |
| 52 | + <path refid="test.class.path" /> |
| 53 | + <!-- pathelement location="${build}"/ --> |
| 54 | + </classpath> |
| 55 | + <formatter type="brief" usefile="false" /> |
| 56 | + <batchtest> |
| 57 | + <fileset dir="${src}" includes="**/test/*.java" excludes="**/test/AllTests.java" /> |
| 58 | + </batchtest> |
| 59 | + </junit> |
| 60 | + </target> |
| 61 | + |
| 62 | + <target name="test" depends="run_tests" /> |
| 63 | + |
40 | 64 | <target name="clean" description="clean up">
|
41 | 65 | <!-- Delete the ${build} and ${dist} directory trees -->
|
42 | 66 | <delete dir="${build}"/>
|
43 | 67 | <delete dir="${dist}"/>
|
44 | 68 | </target>
|
| 69 | + |
45 | 70 | </project>
|
0 commit comments