1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project basedir="." default="all" name="i2p_sdk"> |
---|
3 | <target name="all" depends="clean, build" /> |
---|
4 | <target name="build" depends="builddep, jar" /> |
---|
5 | <target name="builddep"> |
---|
6 | <!-- noop, since the core doesnt depend on anything --> |
---|
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> |
---|
17 | </target> |
---|
18 | |
---|
19 | <!-- only used if not set by a higher build.xml --> |
---|
20 | <property name="javac.compilerargs" value="" /> |
---|
21 | <property name="javac.classpath" value="" /> |
---|
22 | <property name="javac.version" value="1.6" /> |
---|
23 | |
---|
24 | <!-- fixups if we're using libintl.jar for GettextResource.java --> |
---|
25 | <condition property="source.exclude1" value="gnu/gettext/GettextResource.java" else="NOTHING" > |
---|
26 | <istrue value="${with-gettext-base}" /> |
---|
27 | </condition> |
---|
28 | <condition property="javac.classpath.mod1" value="build/libintl.jar:" else="" > |
---|
29 | <istrue value="${with-gettext-base}" /> |
---|
30 | </condition> |
---|
31 | <!-- fixups if we're using gnu-getopt.jar for gnu/getopt/* --> |
---|
32 | <condition property="source.exclude2" value="gnu/getopt/**" else="NOTHING" > |
---|
33 | <istrue value="${with-libgetopt-java}" /> |
---|
34 | </condition> |
---|
35 | <condition property="javac.classpath.mod2" value="build/gnu-getopt.jar:" else="" > |
---|
36 | <istrue value="${with-libgetopt-java}" /> |
---|
37 | </condition> |
---|
38 | <condition property="translation.includes" value="NOTHING" else="gnu/getopt/*.properties" > |
---|
39 | <istrue value="${with-libgetopt-java}" /> |
---|
40 | </condition> |
---|
41 | <property name="javac.classpath.mod" value="${javac.classpath.mod1}${javac.classpath.mod2}${javac.classpath}" /> |
---|
42 | |
---|
43 | <target name="compile" depends="depend"> |
---|
44 | <mkdir dir="./build" /> |
---|
45 | <mkdir dir="./build/obj" /> |
---|
46 | <!-- sourcepath="" necessary for excludes to work, see ant manual for javac --> |
---|
47 | <javac sourcepath="" srcdir="./src" debug="true" source="${javac.version}" target="${javac.version}" deprecation="on" |
---|
48 | debuglevel="lines,vars,source" |
---|
49 | includeAntRuntime="false" |
---|
50 | destdir="./build/obj" classpath="${javac.classpath.mod}" > |
---|
51 | <compilerarg line="${javac.compilerargs}" /> |
---|
52 | <include name="**/*.java" /> |
---|
53 | <exclude name="${source.exclude1}" /> |
---|
54 | <exclude name="${source.exclude2}" /> |
---|
55 | </javac> |
---|
56 | </target> |
---|
57 | |
---|
58 | <target name="listChangedFiles" if="mtn.available" > |
---|
59 | <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
60 | <arg value="list" /> |
---|
61 | <arg value="changed" /> |
---|
62 | <arg value="." /> |
---|
63 | </exec> |
---|
64 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
65 | <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
66 | <arg value="-s" /> |
---|
67 | <arg value="[:space:]" /> |
---|
68 | <arg value="," /> |
---|
69 | </exec> |
---|
70 | </target> |
---|
71 | |
---|
72 | <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" > |
---|
73 | <!-- set if unset --> |
---|
74 | <property name="workspace.changes.tr" value="" /> |
---|
75 | <jar destfile="./build/i2p.jar" > |
---|
76 | <fileset dir="./build/obj" includes="**/*.class" /> |
---|
77 | <!-- the getopt translation files --> |
---|
78 | <fileset dir="src" includes="${translation.includes}" /> |
---|
79 | <manifest> |
---|
80 | <attribute name="Implementation-Version" value="${full.version}" /> |
---|
81 | <attribute name="Built-By" value="${build.built-by}" /> |
---|
82 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
83 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
84 | <attribute name="Main-Class" value="net.i2p.util.CommandLine" /> |
---|
85 | <attribute name="Workspace-Changes" value="${workspace.changes.tr}" /> |
---|
86 | </manifest> |
---|
87 | </jar> |
---|
88 | </target> |
---|
89 | |
---|
90 | <target name="jarUpToDate" > |
---|
91 | <uptodate property="jar.uptodate" targetfile="build/i2p.jar" > |
---|
92 | <srcfiles dir= "build/obj" includes="**/*.class" /> |
---|
93 | </uptodate> |
---|
94 | </target> |
---|
95 | |
---|
96 | <target name="javadoc"> |
---|
97 | <mkdir dir="./build" /> |
---|
98 | <mkdir dir="./build/javadoc" /> |
---|
99 | <javadoc sourcepath="./src:./test/junit" destdir="./build/javadoc" packagenames="*" use="true" splitindex="true" windowtitle="I2P SDK" /> |
---|
100 | </target> |
---|
101 | |
---|
102 | <!-- scala paths --> |
---|
103 | <target name="scala.init"> |
---|
104 | <property name="scala-library.jar" value="${scalatest.libs}/scala-library.jar" /> |
---|
105 | <property name="scalatest.jar" value="${scalatest.libs}/scalatest.jar" /> |
---|
106 | <taskdef resource="scala/tools/ant/antlib.xml"> |
---|
107 | <classpath> |
---|
108 | <pathelement location="${scalatest.libs}/scala-compiler.jar" /> |
---|
109 | <pathelement location="${scala-library.jar}" /> |
---|
110 | </classpath> |
---|
111 | </taskdef> |
---|
112 | </target> |
---|
113 | |
---|
114 | <!-- unit tests --> |
---|
115 | <target name="scalatest.compileTest" depends="compile, scala.init"> |
---|
116 | <mkdir dir="./build" /> |
---|
117 | <mkdir dir="./build/obj_scala" /> |
---|
118 | <scalac srcdir="./test/scalatest" destdir="./build/obj_scala" deprecation="on" > |
---|
119 | <classpath> |
---|
120 | <pathelement location="${javac.classpath.mod}" /> |
---|
121 | <pathelement location="${scala-library.jar}" /> |
---|
122 | <pathelement location="${scalatest.jar}" /> |
---|
123 | <pathelement location="./build/obj" /> |
---|
124 | </classpath> |
---|
125 | </scalac> |
---|
126 | </target> |
---|
127 | <target name="junit.compileTest" depends="compile"> |
---|
128 | <mkdir dir="./build" /> |
---|
129 | <mkdir dir="./build/obj" /> |
---|
130 | <!-- set hamcrest and junit homes to the old default unless overridden elsewhere --> |
---|
131 | <echo message="[DEBUG] ant home is ${ant.home}" /> |
---|
132 | <echo message="[DEBUG] junit home before override is ${junit.home}" /> |
---|
133 | <echo message="[DEBUG] hamcrest home before override is ${hamcrest.home}" /> |
---|
134 | <property name="hamcrest.home" value="${ant.home}/lib/" /> |
---|
135 | <property name="junit.home" value="${ant.home}/lib/" /> |
---|
136 | <echo message="[DEBUG] junit home after override is ${junit.home}" /> |
---|
137 | <echo message="[DEBUG] hamcrest home after override is ${hamcrest.home}" /> |
---|
138 | <javac srcdir="./test/junit" debug="true" source="${javac.version}" target="${javac.version}" deprecation="on" |
---|
139 | debuglevel="lines,vars,source" |
---|
140 | includeAntRuntime="true" |
---|
141 | excludes="${source.exclude}" |
---|
142 | destdir="./build/obj" > |
---|
143 | <classpath> |
---|
144 | <pathelement path="${javac.classpath.mod}" /> |
---|
145 | <pathelement location="${hamcrest.home}/hamcrest-core.jar" /> |
---|
146 | <pathelement location="${hamcrest.home}/hamcrest-library.jar" /> |
---|
147 | <pathelement location="${hamcrest.home}/hamcrest-integration.jar" /> |
---|
148 | <pathelement location="${hamcrest.home}/hamcrest-all.jar" /> |
---|
149 | <pathelement location="${junit.home}/junit4.jar" /> |
---|
150 | </classpath> |
---|
151 | <compilerarg line="${javac.compilerargs}" /> |
---|
152 | </javac> |
---|
153 | <!-- EdDSA test vectors --> |
---|
154 | <copy todir="./build/obj"> |
---|
155 | <fileset dir="./test/junit/"> |
---|
156 | <include name="net/i2p/crypto/eddsa/test.data"/> |
---|
157 | <include name="net/i2p/crypto/eddsa/math/baseDblPrecmp"/> |
---|
158 | <include name="net/i2p/crypto/eddsa/math/basePrecmp"/> |
---|
159 | </fileset> |
---|
160 | </copy> |
---|
161 | </target> |
---|
162 | <!-- jars with tests --> |
---|
163 | <target name="jarScalaTest" depends="scalatest.compileTest"> |
---|
164 | <mkdir dir="./build/obj_scala_jar" /> |
---|
165 | <copy todir="./build/obj_scala_jar"> |
---|
166 | <fileset dir="./build/"> |
---|
167 | <include name="obj/**/*.class"/> |
---|
168 | </fileset> |
---|
169 | <mapper type="glob" from="obj/*" to="*" /> |
---|
170 | </copy> |
---|
171 | <copy todir="./build/obj_scala_jar"> |
---|
172 | <fileset dir="./build/"> |
---|
173 | <include name="obj_scala/**/*.class"/> |
---|
174 | </fileset> |
---|
175 | <mapper type="glob" from="obj_scala/*" to="*" /> |
---|
176 | </copy> |
---|
177 | <jar destfile="./build/i2pscalatest.jar" basedir="./build/obj_scala_jar" includes="**/*.class" /> |
---|
178 | </target> |
---|
179 | <target name="jarTest" depends="junit.compileTest"> |
---|
180 | <!-- warning - The junit.test target below doesn't actually include i2ptest.jar in the classpath, |
---|
181 | only the build/obj directory. |
---|
182 | --> |
---|
183 | <jar destfile="./build/i2ptest.jar" basedir="./build/obj" includes="**/*.class **/test.data **/baseDblPrecmp **/basePrecmp" /> |
---|
184 | </target> |
---|
185 | <!-- preparation of code coverage tool of choice --> |
---|
186 | <target name="prepareClover" depends="compile" if="with.clover"> |
---|
187 | <taskdef resource="clovertasks"/> |
---|
188 | <mkdir dir="../../reports/core/clover" /> |
---|
189 | <clover-setup initString="../../reports/core/clover/coverage.db"/> |
---|
190 | </target> |
---|
191 | <target name="prepareCobertura" depends="compile" if="with.cobertura"> |
---|
192 | <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" /> |
---|
193 | <mkdir dir="./build/obj_cobertura" /> |
---|
194 | <delete file="./cobertura.ser" /> |
---|
195 | <cobertura-instrument todir="./build/obj_cobertura"> |
---|
196 | <fileset dir="./build/obj"> |
---|
197 | <include name="**/*.class"/> |
---|
198 | <!-- exclude Test classes --> |
---|
199 | <exclude name="**/*Test.class" /> |
---|
200 | <exclude name="**/*TestSuite.class" /> |
---|
201 | <!-- specific excludes --> |
---|
202 | <exclude name="**/AllCoreTests.class" /> |
---|
203 | <exclude name="**/stat/SimpleStatDumper.class" /> |
---|
204 | <exclude name="**/stat/SizeMeasure.class" /> |
---|
205 | <exclude name="**/stat/StatLogSplitter.class" /> |
---|
206 | <!-- exclude anything not in net.i2p.* --> |
---|
207 | <exclude name="com/nettgryppa/**/*.class" /> |
---|
208 | <exclude name="freenet/**/*.class" /> |
---|
209 | <exclude name="gnu/**/*.class" /> |
---|
210 | <exclude name="net/metanotion/**/*.class" /> |
---|
211 | <exclude name="org/bouncycastle/**/*.class" /> |
---|
212 | <exclude name="org/xlattice/**/*.class" /> |
---|
213 | </fileset> |
---|
214 | </cobertura-instrument> |
---|
215 | </target> |
---|
216 | <target name="prepareTest" depends="prepareClover, prepareCobertura" /> |
---|
217 | <!-- end preparation of code coverage tool --> |
---|
218 | <target name="scalatest.test" depends="clean, scalatest.compileTest, prepareTest"> |
---|
219 | <mkdir dir="../../reports/core/scalatest/" /> |
---|
220 | <delete> |
---|
221 | <fileset dir="../../reports/core/scalatest"> |
---|
222 | <include name="TEST-*.xml"/> |
---|
223 | </fileset> |
---|
224 | </delete> |
---|
225 | <taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestAntTask"> |
---|
226 | <classpath> |
---|
227 | <pathelement location="${scala-library.jar}" /> |
---|
228 | <pathelement location="${scalatest.jar}" /> |
---|
229 | <pathelement location="./build/obj_cobertura" /> |
---|
230 | <pathelement location="./build/obj" /> |
---|
231 | <pathelement location="../../build/jbigi.jar" /> |
---|
232 | <pathelement location="${with.clover}" /> |
---|
233 | <pathelement location="${with.cobertura}" /> |
---|
234 | </classpath> |
---|
235 | </taskdef> |
---|
236 | <scalatest runpath="./build/obj_scala" fork="yes" maxmemory="384M"> |
---|
237 | <tagsToExclude> |
---|
238 | SlowTests |
---|
239 | </tagsToExclude> |
---|
240 | <reporter type="stdout" /> |
---|
241 | <reporter type="junitxml" directory="../../reports/core/scalatest/" /> |
---|
242 | </scalatest> |
---|
243 | <!-- set if unset --> |
---|
244 | <property name="host.fakename" value="i2ptester" /> |
---|
245 | <!-- replace hostname that junit inserts into reports with fake one --> |
---|
246 | <replaceregexp byline="true" |
---|
247 | match="(hostname=)"[^"]+"" |
---|
248 | replace="\1"${host.fakename}""> |
---|
249 | <fileset dir="../../reports/core/scalatest/" /> |
---|
250 | </replaceregexp> |
---|
251 | </target> |
---|
252 | <target name="junit.test" depends="clean, junit.compileTest, prepareTest"> |
---|
253 | <property name="hamcrest.home" value="${ant.home}/lib/" /> |
---|
254 | <property name="junit.home" value="${ant.home}/lib/" /> |
---|
255 | <mkdir dir="../../reports/core/junit/" /> |
---|
256 | <delete> |
---|
257 | <fileset dir="../../reports/core/junit"> |
---|
258 | <include name="TEST-*.xml"/> |
---|
259 | </fileset> |
---|
260 | </delete> |
---|
261 | <junit printsummary="withOutAndErr" fork="yes" maxmemory="384m" showoutput="yes" > |
---|
262 | <sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" /> |
---|
263 | <classpath> |
---|
264 | <pathelement location="../../installer/resources/" /> |
---|
265 | <pathelement path="${javac.classpath.mod}" /> |
---|
266 | <pathelement location="${hamcrest.home}/hamcrest-core.jar" /> |
---|
267 | <pathelement location="${hamcrest.home}/hamcrest-library.jar" /> |
---|
268 | <pathelement location="${hamcrest.home}/hamcrest-integration.jar" /> |
---|
269 | <pathelement location="${hamcrest.home}/hamcrest-all.jar" /> |
---|
270 | <pathelement location="${junit.home}/junit4.jar" /> |
---|
271 | <pathelement location="./build/obj_cobertura" /> |
---|
272 | <pathelement location="./build/obj" /> |
---|
273 | <pathelement location="../../build/jbigi.jar" /> |
---|
274 | <pathelement location="${with.clover}" /> |
---|
275 | <pathelement location="${with.cobertura}" /> |
---|
276 | </classpath> |
---|
277 | <batchtest todir="../../reports/core/junit/"> |
---|
278 | <fileset dir="./test/junit/"> |
---|
279 | <include name="**/*Test.java" /> |
---|
280 | <exclude name="**/ElGamalAESEngineTest.java" /> |
---|
281 | <exclude name="**/StructureTest.java" /> |
---|
282 | <!-- DataHelperTest is *very* slow with cobertura --> |
---|
283 | <!-- |
---|
284 | <exclude name="**/DataHelperTest.java" /> |
---|
285 | --> |
---|
286 | </fileset> |
---|
287 | </batchtest> |
---|
288 | <formatter type="xml"/> |
---|
289 | </junit> |
---|
290 | <!-- set if unset --> |
---|
291 | <property name="host.fakename" value="i2ptester" /> |
---|
292 | <!-- replace hostname that junit inserts into reports with fake one --> |
---|
293 | <replaceregexp byline="true" |
---|
294 | match="(hostname=)"[^"]+"" |
---|
295 | replace="\1"${host.fakename}""> |
---|
296 | <fileset dir="../../reports/core/junit/" /> |
---|
297 | </replaceregexp> |
---|
298 | </target> |
---|
299 | <target name="test" depends="junit.test, scalatest.test"/> |
---|
300 | <!-- test reports --> |
---|
301 | <target name="scalatest.report"> |
---|
302 | <junitreport todir="../../reports/core/scalatest"> |
---|
303 | <fileset dir="../../reports/core/scalatest"> |
---|
304 | <include name="TEST-*.xml"/> |
---|
305 | </fileset> |
---|
306 | <report format="frames" todir="../../reports/core/html/scalatest"/> |
---|
307 | </junitreport> |
---|
308 | </target> |
---|
309 | <target name="junit.report"> |
---|
310 | <junitreport todir="../../reports/core/junit"> |
---|
311 | <fileset dir="../../reports/core/junit"> |
---|
312 | <include name="TEST-*.xml"/> |
---|
313 | </fileset> |
---|
314 | <report format="frames" todir="../../reports/core/html/junit"/> |
---|
315 | </junitreport> |
---|
316 | </target> |
---|
317 | <target name="clover.report" depends="test" if="with.clover"> |
---|
318 | <clover-report> |
---|
319 | <current outfile="../../reports/core/html/clover"> |
---|
320 | <format type="html"/> |
---|
321 | </current> |
---|
322 | </clover-report> |
---|
323 | </target> |
---|
324 | <target name="cobertura.report" depends="test" if="with.cobertura"> |
---|
325 | <mkdir dir="../../reports/core/cobertura" /> |
---|
326 | <cobertura-report format="xml" srcdir="./src" destdir="../../reports/core/cobertura" /> |
---|
327 | <mkdir dir="../../reports/core/html/cobertura" /> |
---|
328 | <cobertura-report format="html" srcdir="./src" destdir="../../reports/core/html/cobertura" /> |
---|
329 | <delete file="./cobertura.ser" /> |
---|
330 | </target> |
---|
331 | <target name="test.report" depends="junit.report, scalatest.report, clover.report, cobertura.report"/> |
---|
332 | <!-- end test reports --> |
---|
333 | <target name="fulltest" depends="test, test.report" /> |
---|
334 | <!-- end unit tests --> |
---|
335 | |
---|
336 | <target name="clean"> |
---|
337 | <delete dir="./build" /> |
---|
338 | </target> |
---|
339 | <target name="cleandep" depends="clean"> |
---|
340 | <!-- noop, since the core doesn't depend on anything --> |
---|
341 | </target> |
---|
342 | <target name="distclean" depends="clean"> |
---|
343 | <!-- noop, since the core doesn't depend on anything --> |
---|
344 | </target> |
---|
345 | </project> |
---|