-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.xml
446 lines (416 loc) · 16.2 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
<?xml version="1.0" encoding="utf-8"?>
<project name="Sonar" default="build" basedir=".">
<property name="product.version" value="1.0.0-dev" />
<property name="product.name" value="Sonar" />
<!-- Configure path to GWT SDK -->
<property name="gwt.sdk" location="../gwt-2.0.0" />
<property name="junit.jar"
location="lib/build/junit-4.8.1.jar" />
<property name="scalatest.jar"
location="lib/build/scalatest-1.0.jar" />
<property name="dbunit.jar"
location="lib/build/dbunit-2.4.7.jar" />
<property name="emma.jar"
location="lib/build/emma-2.0.5312-patched.jar" />
<property name="centrality.class.path"
location="war/WEB-INF/classes/edu/kit/ipd/sonar/server/centralities" />
<property name="server.class.path"
location="war/WEB-INF/classes/edu/kit/ipd/sonar/server/" />
<property name="centrality.deploy.path"
location="war/WEB-INF/lib/" />
<property name="centrality.jar"
location="${centrality.deploy.path}/edu.kit.ipd.sonar.server.centralities-${product.version}.jar" />
<property name="centrality.api.jar"
location="sonar.centralities.api-${product.version}.jar" />
<!-- Hibernate and Dependencies -->
<property name="scala.home" location="/usr/local/scala/" />
<property name="scala-compiler.jar" location="/usr/local/scala/lib/scala-compiler.jar" />
<property name="scala-library.jar" location="/usr/local/scala/lib/scala-library.jar" />
<path id="scala.classpath">
<pathelement location="${scala-compiler.jar}"/>
<pathelement location="${scala-library.jar}"/>
</path>
<path id="emma.lib">
<pathelement location="lib/build/emma-2.0.5312-patched.jar" />
<pathelement location="lib/build/emma_ant.jar" />
</path>
<taskdef resource="scala/tools/ant/antlib.xml"
classpathref="scala.classpath" />
<taskdef resource="checkstyletask.properties"
classpath="lib/build/checkstyle-all-5.0.jar" />
<taskdef resource="emma_ant.properties"
classpathref="emma.lib" />
<path id="project.hibernate.libs">
<fileset dir="lib/">
<include name="*.jar" />
<exclude name="build/" />
</fileset>
</path>
<path id="project.class.path">
<pathelement location="war/WEB-INF/classes" />
<pathelement location="${gwt.sdk}/gwt-user.jar" />
<fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
<fileset dir="war/WEB-INF/lib" includes="**/*.jar" />
</path>
<path id="project.class.path.junit">
<pathelement location="test" />
<pathelement location="src" />
<path refid="project.class.path" />
<path refid="scala.classpath" />
<pathelement location="${junit.jar}" />
<pathelement location="${scalatest.jar}" />
<path refid="emma.lib" />
</path>
<target name="checkstyle" description="Check for JCC-Violations">
<checkstyle config="checkstyle.xml" failOnViolation="true"
classpathref="project.class.path" maxErrors="0"
maxWarnings="0">
<fileset dir="src" includes="**/*.java" />
<property key="checkstyle.basedir" value="src" />
<property key="checkstyle.cachefile"
value=".checkstyle.cache" />
<property key="checkstyle.tabwidth" value="4" />
</checkstyle>
</target>
<target name="libs" description="Copy libs to WEB-INF/lib">
<mkdir dir="war/WEB-INF/lib" />
<copy todir="war/WEB-INF/lib" flatten="true">
<path refid="project.hibernate.libs" />
</copy>
<!-- Add any additional server libs that need to be copied -->
</target>
<target name="fsc" depends="libs"
description="Compile java source">
<mkdir dir="war/WEB-INF/classes" />
<fsc srcdir="src" includes="**" encoding="utf-8"
destdir="war/WEB-INF/classes" deprecation="on" >
<classpath refid="scala.classpath" />
<classpath refid="project.class.path" />
</fsc>
<copy todir="war/WEB-INF/classes">
<fileset dir="src">
<exclude name="**/*.java" />
<exclude name="**/*.scala"/>
</fileset>
</copy>
</target>
<target name="compile" depends="libs"
description="Compile java source">
<mkdir dir="war/WEB-INF/classes" />
<scalac srcdir="src" includes="**" encoding="utf-8"
destdir="war/WEB-INF/classes" deprecation="on" target="jvm-1.5">
<classpath refid="scala.classpath" />
<classpath refid="project.class.path" />
</scalac>
<javac srcdir="src" includes="**" encoding="utf-8"
destdir="war/WEB-INF/classes" source="1.5" target="1.5"
nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath refid="scala.classpath" />
<classpath refid="project.class.path" />
</javac>
<copy todir="war/WEB-INF/classes">
<fileset dir="src">
<exclude name="**/*.java" />
<exclude name="**/*.scala"/>
</fileset>
</copy>
</target>
<target name="gwtc" depends="centralities"
description="GWT compile to JavaScript">
<java failonerror="true" fork="true"
classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="src" />
<path refid="project.class.path" />
</classpath>
<!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
<jvmarg value="-Xmx256M" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg value="edu.kit.ipd.sonar.Sonar" />
</java>
</target>
<target name="centralities" depends="compile"
description="Build bundled centralities">
<scalac srcdir="centralities" includes="**" encoding="utf-8"
deprecation="on">
<classpath refid="scala.classpath" />
<classpath refid="project.class.path" />
</scalac>
<javac srcdir="centralities" includes="**" encoding="utf-8"
source="1.5" target="1.5"
nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath refid="scala.classpath" />
<classpath refid="project.class.path" />
</javac>
<mkdir dir="${centrality.deploy.path}" />
<jar destfile="${centrality.jar}" basedir="centralities/"
includes="**/*.class">
<manifest>
<!-- Who is building this jar? -->
<attribute name="Built-By" value="Sonar Team" />
<!-- Information about the program itself -->
<attribute name="Implementation-Vendor"
value="Sonar Team." />
<attribute name="Implementation-Version"
value="${product.version}" />
<attribute name="Implementation-Title"
value="Sonar Default Centrality Plugins" />
</manifest>
</jar>
</target>
<target name="centrality-api.jar" depends="compile"
description="Build Centrality API jar">
<jar destfile="${centrality.api.jar}">
<fileset dir="war/WEB-INF/classes">
<include name="**/Annotable.class" />
<include name="**/AnnotableListener.class" />
<include name="**/Edge.class" />
<include name="**/Graph.class" />
<include name="**/InvalidCentralityException.class" />
<include name="**/Node.class" />
<include name="**/NodeDoesNotExistException.class" />
<include name="**/TimeBoundary.class" />
<include name="**/centralities/Centrality$*.class" />
<include name="**/centralities/Centrality.class" />
<include name="**/centralities/CentralityImpl.class" />
</fileset>
</jar>
</target>
<target name="devmode" depends="centralities"
description="Run development mode">
<emma enabled="${emma.enabled}">
<instr instrpath="war/WEB-INF/classes"
mode="overwrite"
metadatafile="reports/metadata.emma" merge="true" />
</emma>
<java failonerror="true" fork="true"
classname="com.google.gwt.dev.DevMode">
<classpath>
<pathelement location="src" />
<path refid="project.class.path" />
<path refid="emma.lib" />
</classpath>
<jvmarg value="-Xmx256M" />
<jvmarg value="-Demma.coverage.out.file=reports/coverage.emma" />
<jvmarg value="-Demma.coverage.out.merge=true" />
<arg value="-startupUrl" />
<arg value="Sonar.html" />
<!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
<arg value="edu.kit.ipd.sonar.Sonar" />
</java>
<emma enabled="${emma.enabled}">
<report sourcepath="src">
<fileset dir="reports">
<include name="*.emma" />
</fileset>
<txt outfile="reports/coverage.txt" />
<html outfile="reports/coverage.html" />
</report>
</emma>
</target>
<target name="compile.tests" depends="centralities"
description="Compiles test code">
<scalac srcdir="test" includes="**" encoding="utf-8"
deprecation="on">
<classpath location="test" />
<classpath location="${junit.jar}" />
<classpath location="${scalatest.jar}" />
<classpath location="${dbunit.jar}" />
<classpath location="${centrality.jar}" />
<classpath refid="project.class.path" />
<classpath refid="scala.classpath" />
</scalac>
<javac srcdir="test" includes="**" encoding="utf-8"
source="1.5" target="1.5"
nowarn="true" debug="true" debuglevel="lines,vars,source">
<classpath location="test" />
<classpath location="${junit.jar}" />
<classpath location="${scalatest.jar}" />
<classpath location="${dbunit.jar}" />
<classpath location="${centrality.jar}" />
<classpath refid="project.class.path" />
<classpath refid="scala.classpath" />
</javac>
</target>
<target name="test.frontend" depends="compile.tests"
description="Run development mode tests">
<emma enabled="${emma.enabled}">
<instr instrpath="war/WEB-INF/classes"
mode="overwrite"
metadatafile="reports/metadata.emma" merge="true" />
</emma>
<mkdir dir="reports/htmlunit.frontend" />
<junit fork="yes" printsummary="yes" haltonfailure="no">
<jvmarg value="-Demma.coverage.out.file=reports/coverage.emma" />
<jvmarg value="-Demma.coverage.out.merge=true" />
<jvmarg line="-Xmx256m" />
<sysproperty key="gwt.args" value="-logLevel WARN" />
<sysproperty key="java.awt.headless" value="true" />
<classpath>
<path refid="project.class.path.junit" />
</classpath>
<batchtest todir="reports/htmlunit.frontend">
<fileset dir="test">
<include name="**/client/**/*Test.java" />
<!--TODO: When testing, the classes from the server package that
are used on the client should be added here. -->
</fileset>
</batchtest>
<formatter type="plain" />
</junit>
<emma enabled="${emma.enabled}">
<report sourcepath="src">
<fileset dir="reports">
<include name="*.emma" />
</fileset>
<txt outfile="reports/coverage.txt" />
<html outfile="reports/coverage.html" />
</report>
</emma>
</target>
<target name="test.prod" depends="compile.tests"
description="Run production mode tests">
<mkdir dir="reports/htmlunit.prod" />
<junit fork="yes" printsummary="yes" haltonfailure="no">
<jvmarg value="-Demma.coverage.out.file=reports/coverage.emma" />
<jvmarg value="-Demma.coverage.out.merge=true" />
<jvmarg line="-Xmx256m" />
<sysproperty key="gwt.args"
value="-prod -logLevel WARN -out www-test" />
<sysproperty key="java.awt.headless" value="true" />
<classpath>
<pathelement location="src" />
<pathelement location="test" />
<pathelement location="${junit.jar}" />
<path refid="project.class.path" />
</classpath>
<batchtest todir="reports/htmlunit.prod">
<fileset dir="test">
<include name="*/server/**/*Test.java" />
</fileset>
</batchtest>
<formatter type="plain" />
</junit>
<emma enabled="${emma.enabled}">
<report sourcepath="src">
<fileset dir="reports">
<include name="*.emma" />
</fileset>
<txt outfile="reports/coverage.txt" />
<html outfile="reports/coverage.html" />
</report>
</emma>
</target>
<target name="test.backend" depends="compile.tests"
description="Run backend tests">
<emma enabled="${emma.enabled}">
<instr instrpath="war/WEB-INF/classes"
mode="overwrite"
metadatafile="reports/metadata.emma" merge="true" />
</emma>
<mkdir dir="reports/htmlunit.backend" />
<junit fork="yes" printsummary="yes" haltonfailure="no">
<sysproperty key="gwt.args" value="-logLevel WARN" />
<sysproperty key="java.awt.headless" value="true" />
<jvmarg line="-Xmx256m" />
<jvmarg value="-Demma.coverage.out.file=reports/coverage.emma" />
<jvmarg value="-Demma.coverage.out.merge=true" />
<classpath>
<path refid="project.class.path.junit" />
</classpath>
<batchtest todir="reports/htmlunit.backend">
<fileset dir="test">
<include name="**/server/**/*Test.class" />
</fileset>
</batchtest>
<formatter type="plain" />
</junit>
<emma enabled="${emma.enabled}">
<report sourcepath="src">
<fileset dir="reports">
<include name="*.emma" />
</fileset>
<txt outfile="reports/coverage.txt" />
<html outfile="reports/coverage.html" />
</report>
</emma>
</target>
<target name="test"
description="Run development and production mode tests">
<antcall target="test.frontend" />
<antcall target="test.backend" />
<antcall target="test.prod" />
</target>
<target name="hosted" depends="devmode"
description="Run development mode (NOTE: the 'hosted' target is deprecated)" />
<target name="build" depends="gwtc,centralities"
description="Build this project" />
<target name="war" depends="build"
description="Create a war file">
<zip destfile="${product.name}-${product.version}.war"
basedir="war" />
</target>
<target name="javadoc" depends="compile">
<javadoc sourcepath="src/" destdir="doc/" access="package"
classpathref="project.class.path" use="true" author="true" />
</target>
<target name="scaladoc" depends="compile">
<scaladoc srcdir="src/" destdir="scaladoc/"
classpathref="project.class.path"
deprecation="yes" unchecked="yes"
doctitle="${product.name}-${product.version}">
<include name="**/*.scala" />
<include name="**/*.java" />
</scaladoc>
</target>
<target name="clean" description="Cleans this project">
<!-- gwtc/jcc output -->
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="war/Sonar" failonerror="false" />
<delete dir="war/WEB-INF/lib" failonerror="false" />
<delete file="${centrality.jar}" failonerror="false" />
<delete file="${centrality.api.jar}" failonerror="false" />
<!-- Checkstyle output -->
<delete file=".checkstyle.cache" failonerror="false" />
<!-- ant javadoc output -->
<delete dir="doc" failonerror="false" />
<!-- Test output -->
<delete>
<fileset dir="centralities">
<include name="**/*.class" />
</fileset>
<fileset dir="test">
<include name="**/*.class" />
<exclude name="**/plugins/*.class" />
</fileset>
</delete>
<delete dir="reports" failonerror="false" />
<delete dir=".gwt-tmp" failonerror="false" />
<delete dir="tomcat" failonerror="false" />
<delete dir="www-test" failonerror="false" />
</target>
<target name="emma"
description="Run an ant target with accumulative Emma reporting enabled">
<property name="emma.enabled" value="true" />
<!-- EMMA instr class output directory: -->
</target>
<target name="emma-clean"
description="Run an ant target with Emma enabled,using a clean emma-env">
<delete dir="war/WEB-INF/classes" failonerror="false" />
<delete dir="reports" failonerror="false" />
<property name="emma.enabled" value="true" />
<!-- EMMA instr class output directory: -->
</target>
<target name="emma-report"
description="writes the emma cache to the coverage reports">
<emma enabled="true">
<report sourcepath="src">
<fileset dir="reports">
<include name="*.emma" />
</fileset>
<txt outfile="reports/coverage.txt" />
<html outfile="reports/coverage.html" />
</report>
</emma>
</target>
</project>