-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
145 lines (125 loc) · 5.44 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?xml version="1.0" encoding="UTF-8"?>
<project name="Twitchess" default="cob-rep" basedir=".">
<description>play chess via twitter</description>
<property file="build.properties" />
<path id="junit.classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<target name="init" depends="clean">
<mkdir dir="${classes.dir}" />
<mkdir dir="${reports.xml.dir}" />
<mkdir dir="${reports.html.dir}" />
<mkdir dir="${inst.dir}" />
<mkdir dir="${cob.rep.html}" />
<mkdir dir="${cob.rep.xml}" />
</target>
<target name="clean" description="Remove all files created by the build/test process.">
<delete dir="${classes.dir}" />
<delete dir="${reports.xml.dir}" />
<delete dir="${reports.html.dir}" />
<delete file="${cobdata}" />
<delete dir="${inst.dir}" />
<delete dir="${cob.rep}" />
</target>
<target name="compile" depends="init">
<javac srcdir="${src.dir}" destdir="${classes.dir}" debug="yes" includeantruntime="false">
<classpath refid="junit.classpath" />
</javac>
<javac srcdir="${test.dir}" destdir="${classes.dir}" debug="yes" includeantruntime="false">
<classpath refid="junit.classpath" />
</javac>
<javac srcdir="${integrationtest.dir}" destdir="${classes.dir}" debug="yes" includeantruntime="false">
<classpath refid="junit.classpath" />
</javac>
</target>
<target name="test" depends="compile">
<junit errorProperty="test.failed" failureProperty="test.failed" fork="yes">
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobdata}" />
<classpath location="${inst.dir}" />
<classpath location="${classes.dir}" />
<classpath refid="junit.classpath" />
<formatter type="brief" usefile="false" />
<formatter type="xml" />
<test name="${testcase}" todir="${reports.xml.dir}" if="testcase" />
<!-- ant test -Dtestcase=<fully qualified classname> -->
<!--
<sysproperty key="docs.dir" value="${test.dir}/org"/>
Manche Tests benötigen System Properties, diese können im Test umdefiniert werden.
-->
<batchtest todir="${reports.xml.dir}" unless="testcase">
<fileset dir="${test.dir}">
<include name="**/*Test.java" />
</fileset>
<fileset dir="${integrationtest.dir}">
<include name="**/*Test.java" />
</fileset>
</batchtest>
</junit>
<junitreport todir="${reports.xml.dir}">
<fileset dir="${reports.xml.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${reports.html.dir}" />
</junitreport>
<fail message="Tests failed. Check log and/or reports." if="test.failed" />
</target>
<!-- =================================
target: Cobertura
================================= -->
<taskdef classpathref="junit.classpath" resource="tasks.properties" />
<target name="cob-instr" depends="compile">
<cobertura-instrument todir="${inst.dir}" datafile="${cobdata}">
<fileset dir="${classes.dir}">
<include name="**/*.class" />
<exclude name="**/*Test.class" />
<exclude name="**/*Suite.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="cob-rep" depends="cob-instr, test, checkstyle" description="erzeugt Cobertura Reports">
<cobertura-report format="html" datafile="${cobdata}" destdir="${cob.rep.html}" srcdir="${src.dir}" />
<cobertura-report format="xml" datafile="${cobdata}" destdir="${cob.rep.xml}" srcdir="${src.dir}" />
</target>
<!-- =================================
target: Checkstyle
================================= -->
<taskdef resource="checkstyletask.properties" classpath="${lib.dir}/checkstyle-5.5-all.jar" />
<target name="checkstyle" depends="init" description="Generates a report of code convention violations.">
<checkstyle config="${csconfig}" failureProperty="checkstyle.failure" failOnViolation="false">
<formatter type="xml" tofile="reports/checkstyle.xml" />
<fileset dir="src" includes="**/*.java" />
</checkstyle>
<xslt in="reports/checkstyle.xml" out="${cs.rep.html}/csreport.html" style="config/checkstyle/xls/checkstyle-author.xsl" />
</target>
<!-- =================================
target: FindBugs
================================= -->
<target name="findbugs" depends="compile" description="erzeugt FindBugs Report">
<property name="findbugs.home" value="${lib.dir}/findbugs" />
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.home}/findbugs-ant.jar"/>
<findbugs home="${findbugs.home}" output="html"
outputFile="reports/findbugs-ant-results.html" >
<class location="${classes.dir}" />
<sourcePath path="${src.dir}" />
<auxClasspath path="${lib.dir}/junit-4.10.jar" />
</findbugs>
</target>
<!-- =================================
target: Jar
================================= -->
<target name="jar" depends="compile" description="erzeugt ausfuehrbare Jar-Datei">
<jar destfile="twitchess.jar" filesetmanifest="skip">
<fileset dir="${classes.dir}" excludes="**/*Test.class"/>
<zipgroupfileset dir="${lib.dir}" includes="${jar.lib.includes}" excludes=""/>
<fileset dir=".">
<!-- <include name="${img.dir}/**"/> -->
<include name="twitter4j.properties"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
</target>
</project>