blob: 22461dd128a4bdbe6cdbdc90a2c6b31800b88e3f [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
3 <!--
4 Copyright 2011, Big Switch Networks, Inc.
5
6 Licensed to the Apache Software Foundation (ASF) under one or more
7 contributor license agreements. See the NOTICE file distributed with
8 this work for additional information regarding copyright ownership.
9 The ASF licenses this file to You under the Apache License, Version 2.0
10 (the "License"); you may not use this file except in compliance with
11 the License. You may obtain a copy of the License at
12
13 http://www.apache.org/licenses/LICENSE-2.0
14
15 Unless required by applicable law or agreed to in writing, software
16 distributed under the License is distributed on an "AS IS" BASIS,
17 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 See the License for the specific language governing permissions and
19 limitations under the License.
20-->
21
22<!--
23 The build uses pregenerated Thrift code by default to reduce build
24 dependencies. To generate it locally run the gen-thrift target.
25 If you change the Thrift files be sure to also commit the updated
26 generated code.
27-->
28
Jonathan Harte4997b92013-03-22 09:57:41 -070029<project default="jar" name="Floodlight">
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080030 <property name="target" location="target"/>
31 <property name="build" location="${target}/bin"/>
32 <property name="build-test" location="${target}/bin-test"/>
33 <property name="build-coverage" location="${target}/bin-coverage"/>
34 <property name="test-output" location="${target}/test"/>
35 <property name="coverage-output" location="${target}/coverage"/>
36 <property name="source" location="src/main/java"/>
37 <property name="resources" location="src/main/resources/"/>
38 <property name="source-test" location="src/test/java"/>
39 <property name="python-src" location="src/main/python"/>
40 <property name="docs" location="${target}/docs"/>
HIGUCHI Yuta49cf4d22013-06-17 12:15:17 -070041 <property name="main-class" value="net.onrc.onos.ofcontroller.core.Main"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080042 <property name="floodlight-jar" location="${target}/floodlight.jar"/>
43 <property name="floodlight-test-jar" location="${target}/floodlight-test.jar"/>
Jonathan Hartef3badd2013-02-18 15:00:54 -080044 <property name="floodlight-only-jar" location="${target}/floodlight-only.jar"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080045 <property name="thrift.dir" value="${basedir}/src/main/thrift"/>
46 <property name="thrift.out.dir" value="lib/gen-java"/>
47 <property name="thrift.package" value="net/floodlightcontroller/packetstreamer/thrift"/>
48 <property name="ant.build.javac.source" value="1.6"/>
49 <property name="ant.build.javac.target" value="1.6"/>
50 <property name="lib" location="lib"/>
Pankaj Berde8557a462013-01-07 08:59:31 -080051 <property name="titanlib" location="lib/titan/"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080052
53 <patternset id="lib">
54 <include name="logback-classic-1.0.0.jar"/>
55 <include name="logback-core-1.0.0.jar"/>
Pankaj Berdeff421802013-01-29 20:28:52 -080056 <include name="jackson-core-asl-1.9.11.jar"/>
57 <include name="jackson-mapper-asl-1.9.11.jar"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080058 <include name="slf4j-api-1.6.4.jar"/>
59 <include name="org.restlet-2.1-RC1.jar"/>
60 <include name="org.restlet.ext.jackson-2.1-RC1.jar"/>
61 <include name="org.restlet.ext.simple-2.1-RC1.jar"/>
62 <include name="org.restlet.ext.slf4j-2.1-RC1.jar"/>
63 <include name="simple-4.1.21.jar"/>
64 <include name="netty-3.2.6.Final.jar"/>
65 <include name="args4j-2.0.16.jar"/>
Jonathan Harta47c3012013-02-01 11:28:17 -080066 <include name="concurrentlinkedhashmap-lru-1.3.jar"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080067 <include name="jython-2.5.2.jar"/>
68 <include name="libthrift-0.7.0.jar"/>
Jonathan Hart21763562013-03-22 14:42:52 -070069 <include name="curator-client-1.3.5-SNAPSHOT.jar"/>
70 <include name="curator-framework-1.3.5-SNAPSHOT.jar"/>
71 <include name="curator-recipes-1.3.5-SNAPSHOT.jar"/>
Jonathan Hartdfaf5f22013-03-24 16:34:26 -070072 <include name="curator-x-discovery-1.3.5-SNAPSHOT.jar"/>
Jonathan Hart1c451af2013-03-13 16:33:48 -070073 <include name="zookeeper-3.4.5.jar"/>
pingping-line2a09ca2013-03-23 09:33:58 +080074 <include name="ezmorph-1.0.6.jar"/>
75 <include name="json-lib-2.4-jdk15.jar"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080076 </patternset>
77
Pankaj Berde8557a462013-01-07 08:59:31 -080078 <patternset id="titanlib">
Pankaj Berde28cc61c2013-01-08 18:19:33 -080079 <include name="**/*.jar"/>
Pankaj Berde8557a462013-01-07 08:59:31 -080080 </patternset>
81
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080082 <path id="classpath">
83 <fileset dir="${lib}">
84 <patternset refid="lib"/>
85 </fileset>
Pankaj Berde8557a462013-01-07 08:59:31 -080086 <fileset dir="${titanlib}">
87 <patternset refid="titanlib"/>
88 </fileset>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -080089 </path>
90
91 <patternset id="lib-cobertura">
92 <include name="cobertura-1.9.4.1.jar"/>
93 <include name="asm-3.0.jar"/>
94 <include name="asm-tree-3.0.jar"/>
95 <include name="oro/jakarta-oro-2.0.8.jar"/>
96 <include name="log4j-1.2.9.jar"/>
97 </patternset>
98 <path id="classpath-cobertura">
99 <fileset dir="${lib}">
100 <patternset refid="lib-cobertura"/>
101 </fileset>
102 </path>
103
104 <patternset id="lib-test">
105 <include name="junit-4.8.2.jar"/>
106 <include name="org.easymock-3.1.jar"/>
107 <include name="objenesis-1.2.jar"/> <!-- required by easymock to mock classes -->
108 <include name="cglib-nodep-2.2.2.jar"/> <!-- required by easymock to mock classes -->
109 </patternset>
110 <path id="classpath-test">
111 <fileset dir="${lib}">
112 <patternset refid="lib-test"/>
113 <patternset refid="lib-cobertura"/>
114 <patternset refid="lib"/>
Pankaj Berde35ad3122013-01-16 15:38:10 -0800115 <patternset refid="titanlib"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800116 </fileset>
117 </path>
118
119 <target name="init">
120 <mkdir dir="${build}"/>
121 <mkdir dir="${build-test}"/>
122 <mkdir dir="${target}/lib"/>
123 <mkdir dir="${thrift.out.dir}"/>
124 <mkdir dir="${test-output}"/>
125 </target>
126
127 <target name="compile" depends="init">
128 <javac includeAntRuntime="false"
129 classpathref="classpath"
130 debug="true"
131 srcdir="${source}:${thrift.out.dir}"
132 destdir="${build}">
Pavlin Radoslavovab0b74c2013-03-14 17:18:14 -0700133 <compilerarg value="-Xlint:unchecked"/>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800134 </javac>
135 </target>
136
137 <target name="compile-tests" depends="compile-test"/>
138 <target name="compile-test" depends="compile">
139 <fileset dir="${resources}"/>
140 <javac includeAntRuntime="false" debug="true"
141 srcdir="${source-test}"
142 classpath="${build}"
143 classpathref="classpath-test"
144 destdir="${build-test}"/>
145 </target>
146
147 <!-- Thrift build based on http://www.flester.com/blog/2009/04/26/using-thrift-from-ant -->
148 <fileset id="thrift.files" dir="${thrift.dir}">
149 <include name="**/*.thrift"/>
150 </fileset>
151
152 <target name="gen-thrift" depends="init">
153 <pathconvert property="thrift.file.list" refid="thrift.files"
154 pathsep=" " dirsep="/">
155 </pathconvert>
156 <echo message="Running thrift generator on ${thrift.file.list}"/>
157 <exec executable="thrift" dir="${basedir}" failonerror="true">
158 <arg line="--strict -v --gen java -o ${thrift.out.dir}/.. ${thrift.file.list}"/>
159 </exec>
160 <!-- Get rid of annoying warnings in thrift java: at annotations -->
161 <echo message="Adding @SuppressWarning annotations"/>
162 <replaceregexp byline="true">
163 <regexp pattern="^public "/>
164 <substitution expression='@SuppressWarnings("all") public '/>
165 <fileset id="thrift.output.files" dir="${thrift.out.dir}/..">
166 <include name="**/*.java"/>
167 </fileset>
168 </replaceregexp>
169 </target>
170
171 <target name="clean">
172 <delete dir="${target}"/>
173 </target>
174
175 <target name="run" depends="dist">
176 <java fork="true" jar="${floodlight-jar}" classpathref="classpath">
177 <jvmarg value="-server"/>
178 <jvmarg value="-Xms1024M"/>
179 <jvmarg value="-Xmx1024M"/>
180 </java>
181 </target>
182
183 <target name="tests" depends="test"/>
184 <target name="test" depends="compile-test">
185 <junit fork="true" forkmode="once"
186 failureproperty="junit.failure"
187 printsummary="on">
188 <sysproperty key="net.sourceforge.cobertura.datafile"
189 file="${target}/cobertura.ser" />
190 <classpath>
191 <pathelement location="${build-coverage}"/>
192 <pathelement location="${build}"/>
193 <pathelement location="${build-test}"/>
194 <pathelement location="${floodlight-jar}"/>
195 <path refid="classpath-test"/>
196 </classpath>
197 <formatter type="brief" usefile="true" />
198 <batchtest todir="${test-output}">
199 <fileset dir="${source-test}">
200 <exclude name="**/storage/tests/StorageTest.java"/>
201 <include name="**/*Test*.java"/>
202 <exclude name="**/core/test/**"/>
203 <exclude name="**/core/module/**"/>
204 </fileset>
205 </batchtest>
206 </junit>
207 <fail if="junit.failure" message="Unit test(s) failed. See reports!"/>
208 </target>
209
210 <taskdef classpathref="classpath-cobertura" resource="tasks.properties"/>
211 <target name="clean-instrument">
212 <delete file="${target}/cobertura.ser"/>
213 <delete dir="${build-coverage}"/>
214 </target>
215 <target name="instrument" depends="compile,compile-test,clean-instrument">
216 <cobertura-instrument datafile="${target}/cobertura.ser"
217 todir="${build-coverage}"
218 classpathref="classpath-cobertura">
219 <fileset dir="${build}">
220 <include name="**/*.class"/>
221 </fileset>
222 </cobertura-instrument>
223 </target>
224 <target name="coverage-report">
225 <cobertura-report format="html"
226 datafile="${target}/cobertura.ser"
227 destdir="${coverage-output}"
228 srcdir="${source}"/>
229 <cobertura-report format="xml"
230 datafile="${target}/cobertura.ser"
231 destdir="${coverage-output}"
232 srcdir="${source}"/>
233 </target>
234 <target name="coverage" depends="instrument,test,coverage-report"/>
235
Jonathan Hartef3badd2013-02-18 15:00:54 -0800236 <target name="jar" depends="compile">
237 <jar destfile="${floodlight-only-jar}">
238 <fileset dir="${build}"/>
239 <fileset dir="${resources}"/>
240 <fileset dir="${python-src}">
241 <include name="**/*.py"/>
242 </fileset>
243 </jar>
244 </target>
245
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800246 <target name="dist" depends="compile,compile-test">
247 <jar destfile="${floodlight-jar}" filesetmanifest="mergewithoutmain">
248 <manifest>
249 <attribute name="Main-Class" value="${main-class}"/>
250 <attribute name="Class-Path" value="."/>
251 </manifest>
252 <fileset dir="${build}"/>
253 <fileset dir="${resources}"/>
254 <fileset dir="${python-src}">
255 <include name="**/*.py"/>
256 </fileset>
Pankaj Berdea7d39932013-01-09 18:05:57 -0800257 <zipgroupfileset dir="${titanlib}">
258 <patternset refid="titanlib"/>
259 </zipgroupfileset>
Pankaj Berde0fc4e432013-01-12 09:47:22 -0800260 <zipgroupfileset dir="${lib}">
261 <patternset refid="lib"/>
262 </zipgroupfileset>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800263 </jar>
264 <jar destfile="${floodlight-test-jar}" filesetmanifest="mergewithoutmain">
265 <manifest>
266 <attribute name="Class-Path" value="."/>
267 </manifest>
268 <fileset dir="${build-test}"/>
269 <fileset dir="${resources}"/>
270 <zipgroupfileset dir="${lib}">
271 <patternset refid="lib-test"/>
272 <patternset refid="lib-cobertura"/>
273 </zipgroupfileset>
Pankaj Berdea7d39932013-01-09 18:05:57 -0800274 <zipgroupfileset dir="${titanlib}">
275 <patternset refid="titanlib"/>
276 </zipgroupfileset>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800277 </jar>
278 </target>
279
280 <target name="javadoc">
281 <javadoc access="protected"
282 author="true"
283 classpathref="classpath"
284 destdir="${docs}"
285 doctitle="Floodlight"
286 nodeprecated="false"
287 nodeprecatedlist="false"
288 noindex="false"
289 nonavbar="false"
290 notree="false"
291 source="1.6"
292 sourcepath="${source}"
293 splitindex="true"
294 use="true"
295 version="true"/>
296 </target>
297
298 <target name="eclipse" depends="init">
299 <pathconvert property="eclipse-lib">
300 <map from="${basedir}/" to=""/>
301 <fileset dir="${lib}">
302 <patternset refid="lib"/>
303 <patternset refid="lib-test"/>
304 </fileset>
Pankaj Berde8557a462013-01-07 08:59:31 -0800305 <fileset dir="${titanlib}">
306 <patternset refid="titanlib"/>
307 </fileset>
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -0800308 </pathconvert>
309 <exec executable="${basedir}/setup-eclipse.sh">
310 <arg value="${main-class}"/>
311 <arg value="${eclipse-lib}"/>
312 </exec>
313 </target>
314
315</project>