-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
254 lines (213 loc) · 8.08 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<?xml version="1.0"?>
<!-- build.xml PyStructure -->
<!-- Copyright (c) 2008 Reto Schüttel, Robin Stocker -->
<!-- Licensed as LGPL 2 (or above) -->
<project name="PyStructure" default="default">
<!-- Properties -->
<property file="build.properties.local"/>
<property file="build.properties"/>
<!-- classpaths -->
<path id="junit.classpath">
<pathelement location="${junit.dir}/junit.jar" />
</path>
<path id="cobertura.classpath">
<fileset dir="${cobertura.dir}">
<include name="cobertura.jar" />
<include name="lib/**/*.jar" />
</fileset>
</path>
<path id="instrumented.classpath">
<pathelement location="${cobertura-dir}" />
</path>
<!--- JDom. see also auxclasspath of the findbugs task (dont know how to include that one there ) -->
<path id="jdom.classpath">
<!-- I'm not that sure, but I think the ordering is important -->
<pathelement location="${jdom.dir}/xerces.jar" />
<pathelement location="${jdom.dir}/xalan.jar" />
<pathelement location="${jdom.dir}/xml-apis.jar" />
<pathelement location="${jdom.dir}/jdom.jar" />
</path>
<path id="project.classpath">
<pathelement location="${build.src}" />
<pathelement location="${build.paser.jar}" />
</path>
<path id="tests.classpath">
<pathelement location="${build.tests}" />
</path>
<!-- Entry targets -->
<!-- only builds the stuff necessary for the normal user -->
<target name="default" depends="init,build,jar"/>
<!-- builds everything -->
<target name="all" depends="init,build,documentation,checkstyle,run-tests,findbugs,publish-dist"/>
<!-- Targets -->
<target name="build" depends="build-parser,init">
<javac srcdir="${src-dir}" destdir="${build.src}" debug="true" deprecation="true">
<classpath refid="project.classpath" />
<classpath refid="jdom.classpath" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="build-parser" depends="init">
<javac srcdir="${parser-dir}" destdir="${build.parser}" nowarn="false"/>
<jar destfile="${build.paser.jar}" basedir="${build.parser}" />
</target>
<target name="build-test" depends="build">
<javac srcdir="${tests-dir}" destdir="${build.tests}">
<classpath refid="project.classpath" />
<classpath refid="jdom.classpath" />
<classpath refid="junit.classpath" />
<compilerarg value="-Xlint:unchecked" />
</javac>
</target>
<target name="jar" depends="init,build,build-parser">
<jar destfile="${build.jar}/pystructure.jar">
<fileset dir="${build.src}" />
<fileset dir="${build.parser}" />
<manifest>
<attribute name="Main-Class" value="ch.hsr.ifs.pystructure.CLI"/>
<attribute name="Class-Path" value="lib/jdom/jdom.jar"/>
</manifest>
</jar>
</target>
<target name="publish-dist" depends="init,dist,dist-src">
<copy todir="${output.release}/">
<fileset dir="${build.dist}/" includes="*.zip" />
</copy>
</target>
<target name="dist" depends="init,jar">
<zip destfile="${build.dist}/pystructure.zip">
<zipfileset dir="." prefix="pystructure">
<exclude name="tmp/**" />
<exclude name="build.properties.local" />
</zipfileset>
<zipfileset dir="${build.jar}" includes="pystructure.jar" fullpath="pystructure/pystructure.jar"/>
</zip>
</target>
<target name="dist-src" depends="init">
<zip destfile="${build.dist}/pystructure-src.zip">
<zipfileset dir="." prefix="pystructure">
<exclude name="tmp/**" />
<exclude name="build.properties.local" />
</zipfileset>
</zip>
</target>
<target name="documentation" depends="init">
<exec executable="build/build-documents.sh"
output="${output.doc-dir}/log.txt" />
<copy todir="${output.doc-dir}/">
<fileset dir="${doc-dir}" includes="**/**.pdf" />
</copy>
<copy todir="${output.img-dir}/">
<fileset dir="${doc-dir}/img/" includes="*" />
</copy>
</target>
<target name="clean">
<delete file="${build.jar}/pystructure.jar" failonerror="false"/>
<delete dir="${tmp-dir}" failonerror="false"/>
</target>
<target name="init" depends="clean">
<mkdir dir="${tmp-dir}" />
<mkdir dir="${output.base}" />
<mkdir dir="${output.logs-dir}" />
<mkdir dir="${output.base}" />
<mkdir dir="${output.junit-dir}" />
<mkdir dir="${output.cobertura-dir}" />
<mkdir dir="${output.doc-dir}" />
<mkdir dir="${output.findbugs-dir}" />
<mkdir dir="${output.checkstyle-dir}" />
<mkdir dir="${output.tests}" />
<mkdir dir="${output.release}" />
<mkdir dir="${build.base}" />
<mkdir dir="${build.src}" />
<mkdir dir="${build.parser}" />
<mkdir dir="${build.tests}" />
<mkdir dir="${build.dist}" />
</target>
<target name="init-tests">
<mkdir dir="${output.junit-dir}" />
<delete>
<fileset dir="${output.junit-dir}">
<include name="*.txt"/>
<include name="*.xml"/>
</fileset>
</delete>
</target>
<target name="cobertura-instrument" depends="build">
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<cobertura-instrument todir="${cobertura-dir}" datafile="${cobertura-ser}">
<includeClasses regex=".*" />
<excludeClasses regex="something" />
<instrumentationClasspath>
<fileset dir="${build.src}">
<include name="**/*.class" />
<exclude name="**/ClI.class" />
</fileset>
</instrumentationClasspath>
</cobertura-instrument>
</target>
<!-- You need cobertura to run the tests, we might change that in the future
ensure that cobertura.dir points to a directory containing the
Cobertura files. You can download cobertura from
http://cobertura.sourceforge.net/ -->
<target name="run-tests" depends="init-tests,build-test,cobertura-instrument">
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<junit fork="true" haltonfailure="true" printsummary="true">
<sysproperty key="output.typeannotator" value="${output.typeannotator}"/>
<classpath refid="junit.classpath" />
<classpath refid="cobertura.classpath" />
<classpath refid="instrumented.classpath" />
<classpath refid="jdom.classpath" />
<classpath refid="tests.classpath" />
<classpath refid="project.classpath" />
<sysproperty key="net.sourceforge.cobertura.datafile" file="${cobertura-ser}" />
<formatter type="xml" />
<formatter type="plain" usefile="true" />
<test name="ch.hsr.ifs.pystructure.tests.AllTests" todir="${output.junit-dir}" />
</junit>
<cobertura-report format="html" destdir="${output.cobertura-dir}" datafile="${cobertura-ser}">
<fileset dir="${src-dir}">
<include name="**/*.java" />
</fileset>
</cobertura-report>
</target>
<!-- Needs checkstyle installed in the directory specified by checkstyle.dir -->
<target name="checkstyle">
<taskdef resource="checkstyletask.properties"
classpath="${checkstyle.dir}/checkstyle-all-4.4.jar" />
<checkstyle config="${doc-dir}/sun_checks.xml"
failureProperty="checkstyle.failure"
failOnViolation="false">
<formatter type="xml" tofile="${output.checkstyle-dir}/checkstyle_report.xml"/>
<formatter type="plain" tofile="${output.doc-dir}/checkstyle_report.txt"/>
<fileset dir="src/" >
<include name="**/*.java" />
<exclude name="Exclude Stuff if you like" />
</fileset>
</checkstyle>
</target>
<!-- needs findbugs installed in the directory findbugs.dir -->
<target name="findbugs" depends="build">
<taskdef name="findbugs"
classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
classpath="${findbugs.dir}/lib/findbugs-ant.jar"/>
<findbugs
home="${findbugs.dir}"
output="html"
effort="max"
reportLevel="low"
failOnError="true"
jvmargs="-Xms256m -Xmx256m -XX:MaxPermSize=256m"
outputFile="${output.findbugs-dir}/findbugs-${label}.html" >
<auxClasspath>
<pathelement location="${build.paser.jar}" />
<!--- JDom. see also jdom classpath definition (dont know how to include that one here ) -->
<pathelement location="${jdom.dir}/xerces.jar" />
<pathelement location="${jdom.dir}/xalan.jar" />
<pathelement location="${jdom.dir}/xml-apis.jar" />
<pathelement location="${jdom.dir}/jdom.jar" />
</auxClasspath>
<sourcePath path="${src-dir}" />
<class location="${build.src}" />
</findbugs>
</target>
</project>