/
build.xml
93 lines (79 loc) · 3.79 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
81
82
83
84
85
86
87
88
89
90
91
92
93
<!--
Copyright 2015 Stuart Scott
Licensed 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="Match" basedir="." default="main">
<property name="source.directory" value="source"/>
<property name="source.tests.directory" value="tests/source/"/>
<property name="libraries.directory" value="${user.home}/match/libraries/"/>
<property name="out.directory" value="out/"/>
<property name="classes.directory" value="${out.directory}/java/classes/Match/"/>
<property name="classes.tests.directory" value="${out.directory}/java/classes/MatchTest/"/>
<property name="jar.directory" value="${out.directory}/java/jar"/>
<property name="main-class" value="match.Match"/>
<path id="classpath">
<fileset dir="${libraries.directory}" includes="Config-0.1.jar"/>
<fileset dir="${libraries.directory}" includes="junit-4.12.jar"/>
<fileset dir="${libraries.directory}" includes="hamcrest-core-1.3.jar"/>
<fileset dir="${libraries.directory}" includes="mockito-all-1.10.19.jar"/>
<pathelement location="${classes.directory}" />
<pathelement location="${classes.tests.directory}" />
</path>
<path id="application" location="${jar.directory}/${ant.project.name}.jar"/>
<target name="clean">
<delete dir="${out.directory}"/>
</target>
<target name="compile">
<mkdir dir="${classes.directory}"/>
<javac debug="true" debuglevel="lines,vars,source" includeantruntime="false" srcdir="${source.directory}" destdir="${classes.directory}" classpathref="classpath">
<compilerarg value="-Xlint"/>
</javac>
<mkdir dir="${classes.tests.directory}"/>
<javac debug="true" debuglevel="lines,vars,source" includeantruntime="false" srcdir="${source.tests.directory}" destdir="${classes.tests.directory}" classpathref="classpath">
<compilerarg value="-Xlint"/>
</javac>
</target>
<target name="jar" depends="compile">
<mkdir dir="${jar.directory}"/>
<jar destfile="${jar.directory}/${ant.project.name}.jar" basedir="${classes.directory}">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<attribute name="Class-path" value="${libraries.directory}Config.jar"/>
</manifest>
</jar>
<jar destfile="${jar.directory}/${ant.project.name}Test.jar" basedir="${classes.tests.directory}">
<manifest>
<attribute name="Class-path" value="${libraries.directory}Config.jar"/>
</manifest>
</jar>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<arg line="root=."/>
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
</java>
</target>
<target name="test" depends="jar">
<junit fork="yes" showoutput="true" >
<classpath>
<path refid="classpath"/>
<path refid="application"/>
</classpath>
<test name="match.AllTests"/>
<formatter type="brief" usefile="false"/>
</junit>
</target>
<target name="clean-build" depends="clean,jar"/>
<target name="main" depends="clean,run"/>
</project>