1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project basedir="." default="all" name="i2p_router"> |
---|
3 | <target name="all" depends="clean, build" /> |
---|
4 | <target name="build" depends="builddep, jar" /> |
---|
5 | <target name="builddep"> |
---|
6 | <!-- run from top level build.xml to get dependencies built --> |
---|
7 | </target> |
---|
8 | <condition property="depend.available"> |
---|
9 | <typefound name="depend" /> |
---|
10 | </condition> |
---|
11 | <target name="depend" if="depend.available"> |
---|
12 | <depend |
---|
13 | cache="../../build" |
---|
14 | srcdir="./src" |
---|
15 | destdir="./build/obj" > |
---|
16 | <!-- Depend on classes instead of jars where available --> |
---|
17 | <classpath> |
---|
18 | <pathelement location="../../core/java/build/obj" /> |
---|
19 | <pathelement location="../../core/java/build/gnu-getopt.jar" /> |
---|
20 | <pathelement location="../../core/java/build/httpclient.jar" /> |
---|
21 | <pathelement location="../../core/java/build/httpcore.jar" /> |
---|
22 | </classpath> |
---|
23 | </depend> |
---|
24 | </target> |
---|
25 | <target name="dependVersion"> |
---|
26 | <!-- Force the dependency on the RouterVersion as depend doesn't recognize constant changes --> |
---|
27 | <dependset> |
---|
28 | <srcfilelist dir="." files="build/obj/net/i2p/router/RouterVersion.class" /> |
---|
29 | <targetfilelist dir="." files="build/obj/net/i2p/router/Router.class" /> |
---|
30 | <targetfilelist dir="." files="build/obj/net/i2p/router/StatisticsManager.class" /> |
---|
31 | </dependset> |
---|
32 | </target> |
---|
33 | |
---|
34 | <!-- only used if not set by a higher build.xml --> |
---|
35 | <property name="javac.compilerargs" value="" /> |
---|
36 | <property name="javac.version" value="1.7" /> |
---|
37 | |
---|
38 | <target name="compile" depends="depend, dependVersion"> |
---|
39 | <mkdir dir="./build" /> |
---|
40 | <mkdir dir="./build/obj" /> |
---|
41 | <javac srcdir="./src" debug="true" source="${javac.version}" target="${javac.version}" deprecation="on" |
---|
42 | debuglevel="lines,vars,source" |
---|
43 | includeAntRuntime="false" |
---|
44 | destdir="./build/obj" classpath="../../core/java/build/obj:../../core/java/build/i2p.jar:../../core/java/build/gnu-getopt.jar:../../core/java/build/httpclient.jar:../../core/java/build/httpcore.jar" > |
---|
45 | <compilerarg line="${javac.compilerargs}" /> |
---|
46 | </javac> |
---|
47 | </target> |
---|
48 | |
---|
49 | <target name="listChangedFiles" if="mtn.available" > |
---|
50 | <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
51 | <arg value="list" /> |
---|
52 | <arg value="changed" /> |
---|
53 | <arg value="." /> |
---|
54 | </exec> |
---|
55 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
56 | <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
57 | <arg value="-s" /> |
---|
58 | <arg value="[:space:]" /> |
---|
59 | <arg value="," /> |
---|
60 | </exec> |
---|
61 | </target> |
---|
62 | |
---|
63 | <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" > |
---|
64 | <!-- set if unset --> |
---|
65 | <property name="workspace.changes.tr" value="" /> |
---|
66 | <jar destfile="./build/router.jar" basedir="./build/obj" includes="**/*.class" > |
---|
67 | <manifest> |
---|
68 | <!-- so people with very old wrapper.config files will still work with Jetty 6 --> |
---|
69 | <attribute name="Class-Path" value="i2p.jar jetty-i2p.jar jetty-java5-threadpool.jar jetty-rewrite-handler.jar jetty-sslengine.jar jetty-start.jar jetty-util.jar" /> |
---|
70 | <attribute name="Specification-Title" value="I2P Router" /> |
---|
71 | <attribute name="Specification-Version" value="${release.number}" /> |
---|
72 | <attribute name="Specification-Vendor" value="The I2P Project https://geti2p.net/" /> |
---|
73 | <attribute name="Implementation-Title" value="I2P Java Router" /> |
---|
74 | <attribute name="Implementation-Version" value="${full.version}" /> |
---|
75 | <attribute name="Implementation-Vendor" value="The I2P Project https://geti2p.net/" /> |
---|
76 | <attribute name="Built-By" value="${build.built-by}" /> |
---|
77 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
78 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
79 | <attribute name="Main-Class" value="net.i2p.router.CommandLine" /> |
---|
80 | <attribute name="Workspace-Changes" value="${workspace.changes.tr}" /> |
---|
81 | </manifest> |
---|
82 | </jar> |
---|
83 | </target> |
---|
84 | |
---|
85 | <target name="jarUpToDate"> |
---|
86 | <uptodate property="jar.uptodate" targetfile="build/router.jar" > |
---|
87 | <srcfiles dir= "." includes="build/obj/**/*.class" /> |
---|
88 | </uptodate> |
---|
89 | </target> |
---|
90 | |
---|
91 | <target name="javadoc"> |
---|
92 | <mkdir dir="./build" /> |
---|
93 | <mkdir dir="./build/javadoc" /> |
---|
94 | <javadoc |
---|
95 | sourcepath="./src:./test/junit:../../core/java/src:../../core/java/test/junit" destdir="./build/javadoc" |
---|
96 | packagenames="*" |
---|
97 | use="true" |
---|
98 | splitindex="true" |
---|
99 | windowtitle="I2P Router" /> |
---|
100 | </target> |
---|
101 | |
---|
102 | <!-- for Maven Central --> |
---|
103 | <target name="javadocJar" depends="javadoc"> |
---|
104 | <jar jarfile="./build/router-${release.number}-javadoc.jar"> |
---|
105 | <fileset dir="./build/javadoc" /> |
---|
106 | </jar> |
---|
107 | </target> |
---|
108 | <target name="sourcesJar"> |
---|
109 | <jar jarfile="./build/router-${release.number}-sources.jar"> |
---|
110 | <fileset dir="./src" /> |
---|
111 | </jar> |
---|
112 | </target> |
---|
113 | |
---|
114 | <!-- scala paths --> |
---|
115 | <target name="scala.init"> |
---|
116 | <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" /> |
---|
117 | <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" /> |
---|
118 | <taskdef resource="scala/tools/ant/antlib.xml"> |
---|
119 | <classpath> |
---|
120 | <pathelement location="${scalatest.libs}/scala-compiler.jar" /> |
---|
121 | <pathelement location="${scala-library.jar}" /> |
---|
122 | </classpath> |
---|
123 | </taskdef> |
---|
124 | </target> |
---|
125 | |
---|
126 | <!-- unit tests --> |
---|
127 | <target name="builddepscalatest"> |
---|
128 | <ant dir="../../core/java/" target="jar" /> |
---|
129 | <ant dir="../../core/java/" target="jarScalaTest" /> |
---|
130 | </target> |
---|
131 | <target name="builddeptest"> |
---|
132 | <ant dir="../../core/java/" target="jarTest" /> |
---|
133 | </target> |
---|
134 | <target name="scalatest.compileTest" depends="builddepscalatest, compile, scala.init"> |
---|
135 | <mkdir dir="./build" /> |
---|
136 | <mkdir dir="./build/obj_scala" /> |
---|
137 | <scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" > |
---|
138 | <classpath> |
---|
139 | <pathelement location="${javac.classpath}" /> |
---|
140 | <pathelement location="${scala-library.jar}" /> |
---|
141 | <pathelement location="${scalatest.jar}" /> |
---|
142 | <pathelement location="../../core/java/build/i2pscalatest.jar" /> |
---|
143 | <pathelement location="./build/obj" /> |
---|
144 | </classpath> |
---|
145 | </scalac> |
---|
146 | </target> |
---|
147 | |
---|
148 | <target name="junit.compileTest" depends="builddeptest, compile"> |
---|
149 | <mkdir dir="./build" /> |
---|
150 | <mkdir dir="./build/obj" /> |
---|
151 | <!-- set hamcrest and junit homes to the old default unless overridden elsewhere --> |
---|
152 | <property name="hamcrest.home" value="${ant.home}/lib/" /> |
---|
153 | <property name="junit.home" value="${ant.home}/lib/" /> |
---|
154 | <javac srcdir="./test/junit" debug="true" source="${javac.version}" target="${javac.version}" deprecation="on" |
---|
155 | debuglevel="lines,vars,source" |
---|
156 | includeAntRuntime="true" |
---|
157 | destdir="./build/obj"> |
---|
158 | <classpath> |
---|
159 | <pathelement location="${hamcrest.home}/hamcrest-core.jar" /> |
---|
160 | <pathelement location="${hamcrest.home}/hamcrest-library.jar" /> |
---|
161 | <pathelement location="${hamcrest.home}/hamcrest-integration.jar" /> |
---|
162 | <pathelement location="${hamcrest.home}/hamcrest-all.jar" /> |
---|
163 | <pathelement location="${junit.home}/junit4.jar" /> |
---|
164 | <pathelement location="../../core/java/build/i2ptest.jar" /> |
---|
165 | </classpath> |
---|
166 | <compilerarg line="${javac.compilerargs}" /> |
---|
167 | </javac> |
---|
168 | </target> |
---|
169 | <!-- jars with tests --> |
---|
170 | <target name="jarScalaTest" depends="scalatest.compileTest"> |
---|
171 | <mkdir dir="./build/obj_scala_jar" /> |
---|
172 | <copy todir="./build/obj_scala_jar"> |
---|
173 | <fileset dir="./build/"> |
---|
174 | <include name="obj/**/*.class"/> |
---|
175 | </fileset> |
---|
176 | <mapper type="glob" from="obj/*" to="*" /> |
---|
177 | </copy> |
---|
178 | <copy todir="./build/obj_scala_jar"> |
---|
179 | <fileset dir="./build/"> |
---|
180 | <include name="obj_scala/**/*.class"/> |
---|
181 | </fileset> |
---|
182 | <mapper type="glob" from="obj_scala/*" to="*" /> |
---|
183 | </copy> |
---|
184 | <jar destfile="./build/routerscalatest.jar" basedir="./build/obj_scala_jar" includes="**/*.class" /> |
---|
185 | </target> |
---|
186 | <target name="jarTest" depends="junit.compileTest"> |
---|
187 | <jar destfile="./build/routertest.jar" basedir="./build/obj" includes="**/*.class" /> |
---|
188 | </target> |
---|
189 | <!-- preparation of code coverage tool of choice --> |
---|
190 | <target name="prepareClover" depends="compile" if="with.clover"> |
---|
191 | <taskdef resource="clovertasks"/> |
---|
192 | <mkdir dir="../../reports/router/clover" /> |
---|
193 | <clover-setup initString="../../reports/router/clover/coverage.db"/> |
---|
194 | </target> |
---|
195 | <target name="prepareCobertura" depends="compile" if="with.cobertura"> |
---|
196 | <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" /> |
---|
197 | <mkdir dir="./build/obj_cobertura" /> |
---|
198 | <delete file="./cobertura.ser" /> |
---|
199 | <cobertura-instrument todir="./build/obj_cobertura"> |
---|
200 | <fileset dir="./build/obj"> |
---|
201 | <include name="**/*.class"/> |
---|
202 | <!-- exclude Test classes --> |
---|
203 | <exclude name="**/*Test.class" /> |
---|
204 | <!-- exclude anything not in net.i2p.* --> |
---|
205 | <exclude name="org/cybergarage/**/*.class" /> |
---|
206 | <exclude name="org/freenetproject/**/*.class" /> |
---|
207 | <exclude name="org/xlattice/**/*.class" /> |
---|
208 | </fileset> |
---|
209 | </cobertura-instrument> |
---|
210 | </target> |
---|
211 | <target name="prepareTest" depends="prepareClover, prepareCobertura" /> |
---|
212 | <!-- end preparation of code coverage tool --> |
---|
213 | <target name="scalatest.test" depends="clean, scalatest.compileTest, prepareTest"> |
---|
214 | <mkdir dir="../../reports/router/scalatest/" /> |
---|
215 | <delete> |
---|
216 | <fileset dir="../../reports/router/scalatest"> |
---|
217 | <include name="TEST-*.xml"/> |
---|
218 | </fileset> |
---|
219 | </delete> |
---|
220 | <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask"> |
---|
221 | <classpath> |
---|
222 | <pathelement location="${scala-library.jar}" /> |
---|
223 | <pathelement location="${scalatest.jar}" /> |
---|
224 | <pathelement location="./build/obj_cobertura" /> |
---|
225 | <pathelement location="./build/obj" /> |
---|
226 | <pathelement location="../../core/java/build/i2p.jar" /> |
---|
227 | <pathelement location="../../build/jbigi.jar" /> |
---|
228 | <pathelement location="${with.clover}" /> |
---|
229 | <pathelement location="${with.cobertura}" /> |
---|
230 | </classpath> |
---|
231 | </taskdef> |
---|
232 | <scalatest runpath="./build/obj_scala" fork="yes" maxmemory="384M"> |
---|
233 | <tagsToExclude> |
---|
234 | SlowTests |
---|
235 | </tagsToExclude> |
---|
236 | <reporter type="stdout" /> |
---|
237 | <reporter type="junitxml" directory="../../reports/router/scalatest/" /> |
---|
238 | </scalatest> |
---|
239 | <!-- set if unset --> |
---|
240 | <property name="host.fakename" value="i2ptester" /> |
---|
241 | <!-- replace hostname that junit inserts into reports with fake one --> |
---|
242 | <replaceregexp byline="true" |
---|
243 | match="(hostname=)"[^"]+"" |
---|
244 | replace="\1"${host.fakename}""> |
---|
245 | <fileset dir="../../reports/router/scalatest/" /> |
---|
246 | </replaceregexp> |
---|
247 | </target> |
---|
248 | <target name="junit.test" depends="clean, junit.compileTest, prepareTest"> |
---|
249 | <mkdir dir="../../reports/router/junit/" /> |
---|
250 | <delete> |
---|
251 | <fileset dir="../../reports/router/junit"> |
---|
252 | <include name="TEST-*.xml"/> |
---|
253 | </fileset> |
---|
254 | </delete> |
---|
255 | <junit printsummary="withOutAndErr" fork="yes" showoutput="yes" > |
---|
256 | <sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" /> |
---|
257 | <classpath> |
---|
258 | <pathelement path="${javac.classpath}" /> |
---|
259 | <pathelement location="${hamcrest.home}/hamcrest-core.jar" /> |
---|
260 | <pathelement location="${hamcrest.home}/hamcrest-library.jar" /> |
---|
261 | <pathelement location="${hamcrest.home}/hamcrest-integration.jar" /> |
---|
262 | <pathelement location="${hamcrest.home}/hamcrest-all.jar" /> |
---|
263 | <pathelement location="${junit.home}/junit4.jar" /> |
---|
264 | <pathelement location="./build/obj_cobertura" /> |
---|
265 | <pathelement location="./build/obj" /> |
---|
266 | <pathelement location="../../core/java/build/i2ptest.jar" /> |
---|
267 | <pathelement location="../../build/jbigi.jar" /> |
---|
268 | <pathelement location="${with.clover}" /> |
---|
269 | <pathelement location="${with.cobertura}" /> |
---|
270 | </classpath> |
---|
271 | <batchtest todir="../../reports/router/junit/"> |
---|
272 | <fileset dir="./test/junit"> |
---|
273 | <include name="**/*Test.java" /> |
---|
274 | </fileset> |
---|
275 | </batchtest> |
---|
276 | <formatter type="xml"/> |
---|
277 | </junit> |
---|
278 | <!-- set if unset --> |
---|
279 | <property name="host.fakename" value="i2ptester" /> |
---|
280 | <!-- replace hostname that junit inserts into reports with fake one --> |
---|
281 | <replaceregexp byline="true" |
---|
282 | match="(hostname=)"[^"]+"" |
---|
283 | replace="\1"${host.fakename}""> |
---|
284 | <fileset dir="../../reports/router/junit/" /> |
---|
285 | </replaceregexp> |
---|
286 | </target> |
---|
287 | |
---|
288 | <!-- both junit and scala, but we have no scala tests yet --> |
---|
289 | <target name="test" depends="junit.test"/> |
---|
290 | |
---|
291 | <!-- test reports --> |
---|
292 | <target name="scalatest.report"> |
---|
293 | <junitreport todir="../../reports/router/scalatest"> |
---|
294 | <fileset dir="../../reports/router/scalatest"> |
---|
295 | <include name="TEST-*.xml"/> |
---|
296 | </fileset> |
---|
297 | <report format="frames" todir="../../reports/router/html/scalatest"/> |
---|
298 | </junitreport> |
---|
299 | </target> |
---|
300 | <target name="junit.report"> |
---|
301 | <junitreport todir="../../reports/router/junit"> |
---|
302 | <fileset dir="../../reports/router/junit"> |
---|
303 | <include name="TEST-*.xml"/> |
---|
304 | </fileset> |
---|
305 | <report format="frames" todir="../../reports/router/html/junit"/> |
---|
306 | </junitreport> |
---|
307 | </target> |
---|
308 | <target name="clover.report" depends="test" if="with.clover"> |
---|
309 | <clover-report> |
---|
310 | <current outfile="../../reports/router/html/clover"> |
---|
311 | <format type="html"/> |
---|
312 | </current> |
---|
313 | </clover-report> |
---|
314 | </target> |
---|
315 | <target name="cobertura.report" depends="test" if="with.cobertura"> |
---|
316 | <mkdir dir="../../reports/router/cobertura" /> |
---|
317 | <cobertura-report format="xml" srcdir="./src" destdir="../../reports/router/cobertura" /> |
---|
318 | <mkdir dir="../../reports/router/html/cobertura" /> |
---|
319 | <cobertura-report format="html" srcdir="./src" destdir="../../reports/router/html/cobertura" /> |
---|
320 | <delete file="./cobertura.ser" /> |
---|
321 | </target> |
---|
322 | <target name="test.report" depends="junit.report, clover.report, cobertura.report"/> |
---|
323 | <!-- end test reports --> |
---|
324 | <target name="fulltest" depends="cleandep, test, test.report" /> |
---|
325 | <!-- end unit tests --> |
---|
326 | |
---|
327 | <target name="clean"> |
---|
328 | <delete dir="./build" /> |
---|
329 | </target> |
---|
330 | <target name="cleandep" depends="clean"> |
---|
331 | </target> |
---|
332 | <target name="distclean" depends="clean"> |
---|
333 | </target> |
---|
334 | </project> |
---|