-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildEx1.xml
97 lines (86 loc) · 3.94 KB
/
buildEx1.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
94
95
96
97
<project default="all">
<!-- You can change properties according to your project layout.
However, this default is recommended and
makes your tutor's life a lot easier. -->
<property name="projectdir" value="./" />
<property name="libdir" value="${projectdir}/lib" />
<property name="Main-class" value="de.zabuza.lexisearch.examples.KeywordQueryExample" />
<property name="jar-name" value="KeywordQueryExample" />
<property name="src-dir" location="${projectdir}/src" />
<property name="test-dir" location="${projectdir}/test" />
<property name="bin-dir" location="${projectdir}/bin" />
<property name="dist-dir" location="${projectdir}" />
<property name="junit-jar" location="${libdir}/junit-4.9b2.jar" />
<property name="checkstyle-jar" location="${libdir}/checkstyle-7.2-all.jar" />
<property name="checkstyle-config" location="${libdir}/checkstyle_config.xml" />
<!-- If you use third party libraries, you'll have to modify the classpath. -->
<path id="classpath.base">
</path>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Ideally, you'll never have to touch anything below. -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<property file="build.properties"/>
<path id="classpath.test">
<pathelement location="${junit-jar}" />
<pathelement location="${bin-dir}" />
<path refid="classpath.base" />
</path>
<path id="classpath.run">
<pathelement location="${bin-dir}" />
<path refid="classpath.base" />
</path>
<target name="checkstyle">
<taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
classpath="${checkstyle-jar}"/>
<checkstyle config = "${checkstyle-config}"
failOnViolation="true" maxWarnings="0" maxErrors="0">
<fileset dir="${src-dir}" includes="**/*.java"/>
<fileset dir="${test-dir}" includes="**/*.java"/>
<formatter type="plain" usefile="false"/>
</checkstyle>
</target>
<target name="compile">
<mkdir dir="${bin-dir}" />
<javac srcdir="${src-dir}" destdir="${bin-dir}"
verbose="false" includeantruntime="false"
debug="on">
<classpath refid="classpath.test" />
</javac>
<javac srcdir="${test-dir}" destdir="${bin-dir}"
verbose="false" includeantruntime="false"
debug="on">
<classpath refid="classpath.test" />
</javac>
</target>
<!-- Please note: This is no ideal "jar" target since it does not exclude
test-classes. It could easily be done by splitting normal source
and test source folders or by using naming conventions and "exclude".
But we want to avoid any trouble for you that would be caused
by multiple source folders or if a non-test-class ends on "...Test" -->
<target name="jar" depends="compile">
<jar destfile="${dist-dir}/${jar-name}.jar" basedir="${bin-dir}">
<manifest>
<attribute name="Main-Class" value="${Main-class}" />
</manifest>
</jar>
</target>
<target name="clean">
<delete verbose="true" quiet="true">
<fileset dir="${bin-dir}" includes="**/*.class" />
<fileset dir="${dist-dir}" includes="${jar-name}.jar" />
</delete>
<delete dir="${bin-dir}" />
</target>
<target name="test" depends="compile">
<junit haltonfailure="yes" haltonerror="yes">
<classpath refid="classpath.test" />
<batchtest fork="yes">
<formatter type="plain" usefile="false"/>
<fileset dir="${test-dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
</target>
<target name="all" depends="test, checkstyle, jar" />
</project>