-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.xml
80 lines (70 loc) · 2.76 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?xml version="1.0" encoding="UTF-8"?>
<project name="Solution" default="run" basedir=".">
<description>Builds, tests, and runs the project Fibonacci.</description>
<property name="build" location="build" />
<property name="jar.build.dir" location="build/jar" />
<property name="main.build.dir" location="build/main" />
<property name="main.src.dir" location="src" />
<property name="test.build.dir" location="build/test" />
<property name="test.src.dir" value="test" />
<property name="main.class" value="com.solution.Solution" />
<path id="classpath.base" />
<path id="classpath.test">
<pathelement location="lib/junit-4.13.1.jar" />
<pathelement location="lib/hamcrest-core-1.3.jar" />
<pathelement location="${main.build.dir}" />
<path refid="classpath.base" />
</path>
<path id="classpath.test.build">
<path refid="classpath.test" />
<pathelement location="${test.build.dir}" />
</path>
<target name="compile" depends="clean">
<mkdir dir="${main.build.dir}" />
<javac srcdir="${main.src.dir}" destdir="${main.build.dir}" includeantruntime="false">
<classpath refid="classpath.base" />
</javac>
<echo message="compile done" />
</target>
<target name="compile-test" depends="compile">
<mkdir dir="${test.build.dir}" />
<javac srcdir="${test.src.dir}" destdir="${test.build.dir}" includeantruntime="false">
<classpath refid="classpath.test" />
</javac>
<echo message="compiled-test done" />
</target>
<target name="jar" depends="compile">
<tstamp />
<mkdir dir="${jar.build.dir}" />
<jar jarfile="${jar.build.dir}/solution-${DSTAMP}.jar" basedir="${main.build.dir}">
<manifest>
<attribute name="Main-Class" value="${main.class}" />
</manifest>
</jar>
</target>
<!-- Compile and Run -->
<!-- To run this: use "ant" (default) or "ant run" -->
<!-- Argument are passed into the mainclass -->
<target name="run" depends="jar">
<java fork="true" failonerror="yes" jar="${jar.build.dir}/solution-${DSTAMP}.jar">
<arg line="10" />
</java>
</target>
<!-- Compile and Test -->
<!-- To run this: use "ant test" -->
<target name="test" depends="compile-test">
<junit printsummary="on" haltonfailure="yes">
<classpath refid="classpath.test.build" />
<formatter type="brief" usefile="false" />
<batchtest>
<fileset dir="${test.src.dir}" includes="**/*Test*.java" />
</batchtest>
</junit>
</target>
<!-- Delete all class files -->
<!-- To run this: use "ant clean" -->
<target name="clean">
<delete dir="${build}" />
<echo message="clean done" />
</target>
</project>