forked from floodlight/floodlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
396 lines (368 loc) · 15.4 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
Copyright 2011, Big Switch Networks, Inc.
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You 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.
-->
<!--
The build uses pregenerated Thrift code by default to reduce build
dependencies. To generate it locally run the gen-thrift target.
If you change the Thrift files be sure to also commit the updated
generated code.
-->
<project default="dist" name="floodlight">
<property name="target" location="target"/>
<property name="build" location="${target}/bin"/>
<property name="build-test" location="${target}/bin-test"/>
<property name="build-coverage" location="${target}/bin-coverage"/>
<property name="test-output" location="${target}/test"/>
<property name="coverage-output" location="${target}/coverage"/>
<property name="source" location="src/main/java"/>
<property name="resources" location="src/main/resources/"/>
<property name="test-resources" location="src/test/resources/"/>
<property name="source-test" location="src/test/java"/>
<property name="python-src" location="src/main/python"/>
<property name="docs" location="${target}/docs"/>
<property name="main-class" value="net.floodlightcontroller.core.Main"/>
<property name="floodlight-jar" location="${target}/floodlight.jar"/>
<property name="floodlight-test-jar" location="${target}/floodlight-test.jar"/>
<property name="thrift.dir" value="${basedir}/src/main/thrift"/>
<property name="thrift.out.dir" value="lib/gen-java"/>
<property name="ant.build.javac.source" value="1.8"/>
<property name="ant.build.javac.target" value="1.8"/>
<property name="findbugs.home" value="../build/findbugs-2.0.2"/>
<property name="findbugs.results" value="findbugs-results" />
<property name="lib" location="lib"/>
<patternset id="lib">
<include name="logback-classic-1.0.0.jar"/>
<include name="logback-core-1.0.0.jar"/>
<include name="jackson-core-2.4.4.jar"/>
<include name="jackson-annotations-2.4.4.jar"/>
<include name="jackson-databind-2.4.4.jar"/>
<include name="jackson-dataformat-smile-2.4.4.jar"/>
<include name="jackson-dataformat-xml-2.4.4.jar"/>
<include name="jackson-dataformat-yaml-2.4.4.jar"/>
<include name="jackson-dataformat-csv-2.4.4.jar"/>
<include name="jackson-dataformat-cbor-2.4.4.jar"/>
<include name="slf4j-api-1.6.4.jar"/>
<include name="org.restlet-2.3.2.jar"/>
<include name="org.restlet.ext.jackson-2.3.2.jar"/>
<include name="org.restlet.ext.simple-2.3.2.jar"/>
<include name="org.restlet.ext.slf4j-2.3.2.jar"/>
<include name="org.restlet.ext.jsslutils-2.3.2.jar"/>
<include name="org.simpleframework.jar"/>
<include name="org.jsslutils.jar"/>
<include name="netty-all-4.0.31.Final.jar"/>
<include name="args4j-2.0.16.jar"/>
<include name="concurrentlinkedhashmap-lru-1.2.jar"/>
<include name="jython-2.5.2.jar"/>
<include name="libthrift-0.9.0.jar"/>
<include name="guava-20.0.jar" />
<include name="findbugs-annotations-2.0.1.jar" />
<include name="findbugs-jsr305-2.0.1.jar" />
<include name="derby-10.9.1.0.jar"/>
<include name="openflowj-3.3.0-SNAPSHOT.jar"/>
<include name="openflowj-3.3.0-SNAPSHOT-javadoc.jar"/>
<include name="openflowj-3.3.0-SNAPSHOT-sources.jar"/>
<include name="hamcrest-core-1.3.jar"/>
<include name="hamcrest-integration-1.3.jar"/>
<include name="hamcrest-library-1.3.jar"/>
<include name="j3dutils.jar"/>
</patternset>
<path id="classpath">
<fileset dir="${lib}">
<patternset refid="lib"/>
</fileset>
</path>
<patternset id="lib-package">
<include name="jdeb-1.0.1.jar"/>
</patternset>
<path id="package-classpath">
<fileset dir="${lib}">
<patternset refid="lib-package"/>
</fileset>
</path>
<patternset id="lib-cobertura">
<include name="cobertura-1.9.4.1.jar"/>
<include name="asm-3.0.jar"/>
<include name="asm-tree-3.0.jar"/>
<include name="oro/jakarta-oro-2.0.8.jar"/>
<include name="log4j-1.2.9.jar"/>
</patternset>
<path id="classpath-cobertura">
<fileset dir="${lib}">
<patternset refid="lib-cobertura"/>
</fileset>
</path>
<patternset id="lib-test">
<include name="junit-4.12.jar"/>
<include name="easymock-3.4.jar"/>
<include name="objenesis-1.2.jar"/> <!-- required by easymock to mock classes -->
<include name="cglib-nodep-2.2.2.jar"/> <!-- required by easymock to mock classes -->
</patternset>
<path id="classpath-test">
<fileset dir="${lib}">
<patternset refid="lib-test"/>
<patternset refid="lib-cobertura"/>
<patternset refid="lib"/>
</fileset>
</path>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build-test}"/>
<mkdir dir="${target}/lib"/>
<mkdir dir="${thrift.out.dir}"/>
<mkdir dir="${test-output}"/>
</target>
<target name="compile" depends="init">
<javac includeAntRuntime="false"
classpathref="classpath"
debug="true"
srcdir="${source}:${thrift.out.dir}"
destdir="${build}">
</javac>
<copy todir="${build}">
<fileset dir="${resources}" />
</copy>
</target>
<target name="compile-tests" depends="compile-test"/>
<target name="compile-test" depends="compile">
<javac includeAntRuntime="false" debug="true"
srcdir="${source-test}"
classpath="${build}"
classpathref="classpath-test"
destdir="${build-test}"/>
</target>
<target name="gen-thrift" depends="init">
<echo message="Running thrift on '${thrift.dir}'"/>
<apply executable="./thrift/compiler/cpp/thrift">
<fileset dir="${thrift.dir}" casesensitive="yes">
<include name="**/*.thrift"/>
</fileset>
<arg value="--strict"/>
<arg value="-v"/>
<arg value="--gen"/>
<arg value="java"/>
<arg value="-o"/>
<arg value="${thrift.out.dir}/.."/>
</apply>
<echo message="Adding @SuppressWarning annotations"/>
<replaceregexp byline="true">
<regexp pattern="^public "/>
<substitution expression='@SuppressWarnings("all") public '/>
<fileset id="thrift.output.files" dir="${thrift.out.dir}/..">
<include name="**/*.java"/>
</fileset>
</replaceregexp>
</target>
<target name="clean">
<delete dir="${target}"/>
</target>
<target name="run" depends="dist">
<java fork="true" jar="${floodlight-jar}" classpathref="classpath">
<jvmarg value="-server"/>
<jvmarg value="-Xms1024M"/>
<jvmarg value="-Xmx1024M"/>
</java>
</target>
<target name="tests" depends="test"/>
<target name="test" depends="compile-test">
<junit fork="true" forkmode="once"
failureproperty="junit.failure"
printsummary="on">
<sysproperty key="net.sourceforge.cobertura.datafile"
file="${target}/cobertura.ser" />
<classpath>
<pathelement location="${build-coverage}"/>
<pathelement location="${build}"/>
<pathelement location="${resources}"/>
<pathelement location="${test-resources}"/>
<pathelement location="${build-test}"/>
<path refid="classpath-test"/>
</classpath>
<formatter type="brief" usefile="true" />
<batchtest todir="${test-output}">
<fileset dir="${source-test}">
<exclude name="**/storage/tests/StorageTest.java"/>
<include name="**/*Test*.java"/>
<exclude name="**/core/test/**"/>
<exclude name="**/core/module/**"/>
<exclude name="**/util/FutureTestUtils.java"/> <!-- No tests here. Used within others that have Futures -->
<exclude name="**/test/FloodlightTestCase.java"/> <!-- Base class for other tests. Can't run it individually. -->
<exclude name="**/core/internal/OFSwitchHandlerTestBase.java"/> <!-- Abstract class used by protocol version handshake handlers. -->
</fileset>
</batchtest>
</junit>
<fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
</target>
<taskdef classpathref="classpath-cobertura" resource="tasks.properties"/>
<target name="clean-instrument">
<delete file="${target}/cobertura.ser"/>
<delete dir="${build-coverage}"/>
</target>
<target name="instrument" depends="compile,compile-test,clean-instrument">
<cobertura-instrument datafile="${target}/cobertura.ser"
todir="${build-coverage}"
classpathref="classpath-cobertura">
<fileset dir="${build}">
<include name="**/*.class"/>
</fileset>
</cobertura-instrument>
</target>
<target name="coverage-report">
<cobertura-report format="html"
datafile="${target}/cobertura.ser"
destdir="${coverage-output}"
srcdir="${source}"/>
<cobertura-report format="xml"
datafile="${target}/cobertura.ser"
destdir="${coverage-output}"
srcdir="${source}"/>
</target>
<target name="coverage" depends="instrument,test,coverage-report"/>
<target name="dist" depends="compile,compile-test">
<xmlproperty file="pom.xml" prefix="pom"/>
<echo message="Setting Floodlight version: ${pom.project.version}"/>
<echo message="Setting Floodlight name: ${pom.project.name}"/>
<jar destfile="${floodlight-jar}" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Main-Class" value="${main-class}"/>
<attribute name="Class-Path" value="."/>
<attribute name="Implementation-Version" value="${pom.project.version}"/>
<attribute name="Implementation-Title" value="${pom.project.name}"/>
</manifest>
<fileset dir="${build}"/>
<fileset dir="${resources}"/>
<fileset dir="${python-src}">
<include name="**/*.py"/>
</fileset>
<zipgroupfileset dir="${lib}" excludes="META-INF/*.SF">
<patternset refid="lib"/>
</zipgroupfileset>
</jar>
<jar destfile="${floodlight-test-jar}" filesetmanifest="mergewithoutmain">
<manifest>
<attribute name="Class-Path" value="."/>
</manifest>
<fileset dir="${build-test}"/>
<fileset dir="${test-resources}"/>
<zipgroupfileset dir="${lib}">
<patternset refid="lib-test"/>
<patternset refid="lib-cobertura"/>
</zipgroupfileset>
</jar>
</target>
<target name="deb" depends="dist">
<taskdef name="deb"
classname="org.vafer.jdeb.ant.DebAntTask"
classpathref="package-classpath"/>
<copy todir="${target}/debian">
<fileset dir="debian"/>
<filterset begintoken="[[" endtoken="]]">
<filter token="version" value="1.9.0"/>
<filter token="name" value="${ant.project.name}"/>
</filterset>
</copy>
<deb destfile="${target}/floodlight-1.9.0.deb"
control="${target}/debian/control">
<data src="${floodlight-jar}" type="file">
<mapper type="perm" prefix="/usr/share/floodlight/java"/>
</data>
<tarfileset dir="debian/misc/bin" prefix="/usr/bin" filemode="755"/>
<data src="debian/misc/logrotate/floodlight" type="file">
<mapper type="perm" prefix="/etc/logrotate.d"/>
</data>
<data src="debian/misc/init/floodlight.conf" type="file">
<mapper type="perm" prefix="/etc/init"/>
</data>
<data src="debian/misc/logback.xml" type="file">
<mapper type="perm" prefix="/etc/floodlight"/>
</data>
<data src="debian/misc/rsyslog/10-floodlight.conf" type="file">
<mapper type="perm" prefix="/etc/rsyslog.d"/>
</data>
<data src="debian/misc/default/floodlight" type="file">
<mapper type="perm" prefix="/etc/default"/>
</data>
<data src="debian/misc/floodlight.properties" type="file">
<mapper type="perm" prefix="/etc/floodlight"/>
</data>
<tarfileset dir="src/main/resources/apps" prefix="/etc/floodlight/apps.d"/>
</deb>
</target>
<target name="package" depends="deb"/>
<target name="javadoc">
<javadoc access="protected"
author="true"
classpathref="classpath"
destdir="${docs}"
doctitle="Floodlight"
nodeprecated="false"
nodeprecatedlist="false"
noindex="false"
nonavbar="false"
notree="false"
source="1.8"
sourcepath="${source}"
splitindex="true"
use="true"
version="true"/>
</target>
<target name="eclipse" depends="init">
<pathconvert property="eclipse-lib">
<map from="${basedir}/" to=""/>
<fileset dir="${lib}">
<patternset refid="lib"/>
<patternset refid="lib-test"/>
</fileset>
</pathconvert>
<exec executable="${basedir}/setup-eclipse.sh">
<arg value="${main-class}"/>
<arg value="${eclipse-lib}"/>
</exec>
</target>
<target name="findbugs-xml" depends="init,compile">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.home}/lib/findbugs-ant.jar"/>
<mkdir dir="${findbugs.results}"/>
<findbugs
home="${findbugs.home}"
output="xml"
excludeFilter="${basedir}/findbugs-exclude.xml"
jvmargs="-Xmx1024m"
outputFile="${findbugs.results}/results.xml">
<sourcePath path="${source}" />
<sourcePath path="${thrift.out.dir}" />
<class location="${build}" />
<auxClasspath>
<path refid="classpath" />
</auxClasspath>
</findbugs>
</target>
<target name="findbugs" depends="init,compile">
<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.home}/lib/findbugs-ant.jar"/>
<mkdir dir="${findbugs.results}"/>
<findbugs
home="${findbugs.home}"
output="html"
excludeFilter="${basedir}/findbugs-exclude.xml"
jvmargs="-Xmx1024m"
outputFile="${findbugs.results}/results.html" >
<sourcePath path="${source}" />
<sourcePath path="${thrift.out.dir}" />
<class location="${build}" />
<auxClasspath>
<path refid="classpath" />
</auxClasspath>
</findbugs>
</target>
</project>