1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project basedir="." default="all" name="streaming"> |
---|
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:./test/junit" |
---|
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="../../ministreaming/java/build/obj" /> |
---|
20 | </classpath> |
---|
21 | </depend> |
---|
22 | </target> |
---|
23 | |
---|
24 | <!-- only used if not set by a higher build.xml --> |
---|
25 | <property name="javac.compilerargs" value="" /> |
---|
26 | <property name="javac.version" value="1.7" /> |
---|
27 | |
---|
28 | <target name="compile" depends="depend"> |
---|
29 | <mkdir dir="./build" /> |
---|
30 | <mkdir dir="./build/obj" /> |
---|
31 | <javac |
---|
32 | srcdir="./src" |
---|
33 | debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" |
---|
34 | includeAntRuntime="false" |
---|
35 | destdir="./build/obj" |
---|
36 | classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" > |
---|
37 | <compilerarg line="${javac.compilerargs}" /> |
---|
38 | </javac> |
---|
39 | </target> |
---|
40 | <target name="builddeptest"> |
---|
41 | <ant dir="../../../core/java" target="jar" /> |
---|
42 | <ant dir="../../../apps/ministreaming/java/" target="jar" /> |
---|
43 | </target> |
---|
44 | <target name="junit.compileTest" depends="builddeptest, compile"> |
---|
45 | |
---|
46 | <echo message="[DEBUG] ant home is ${ant.home}" /> |
---|
47 | <echo message="[DEBUG] junit home before override is ${junit.home}" /> |
---|
48 | <echo message="[DEBUG] hamcrest home before override is ${hamcrest.home}" /> |
---|
49 | <echo message="[DEBUG] mockito home before override is ${mockito.home}" /> |
---|
50 | |
---|
51 | <property name="junit.home" value="${ant.home}/lib" /> |
---|
52 | <property name="hamcrest.home" value="${ant.home}/lib" /> |
---|
53 | <property name="mockito.home" value="${ant.home}/lib" /> |
---|
54 | |
---|
55 | <echo message="[DEBUG] junit home after override is ${junit.home}" /> |
---|
56 | <echo message="[DEBUG] hamcrest home after override is ${hamcrest.home}" /> |
---|
57 | <echo message="[DEBUG] mockito home after override is ${mockito.home}" /> |
---|
58 | |
---|
59 | <javac |
---|
60 | srcdir="./test/junit" |
---|
61 | debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" |
---|
62 | includeAntRuntime="false" |
---|
63 | destdir="./build/obj" > |
---|
64 | <classpath> |
---|
65 | <pathelement path="${javac.classpath}" /> |
---|
66 | <pathelement location="../../../core/java/build/i2p.jar" /> |
---|
67 | <pathelement location="../../ministreaming/java/build/mstreaming.jar" /> |
---|
68 | <pathelement location="${junit.home}/junit4.jar" /> |
---|
69 | <pathelement location="${hamcrest.home}/hamcrest.jar" /> |
---|
70 | <pathelement location="${hamcrest.home}/hamcrest-all.jar" /> |
---|
71 | <pathelement location="${mockito.home}/byte-buddy.jar" /> |
---|
72 | <pathelement location="${mockito.home}/objenesis.jar" /> |
---|
73 | <pathelement location="${mockito.home}/mockito-core.jar" /> |
---|
74 | </classpath> |
---|
75 | <compilerarg line="${javac.compilerargs}" /> |
---|
76 | </javac> |
---|
77 | </target> |
---|
78 | |
---|
79 | <!-- preparation of code coverage tool of choice --> |
---|
80 | <target name="prepareClover" depends="compile" if="with.clover"> |
---|
81 | <taskdef resource="clovertasks"/> |
---|
82 | <mkdir dir="../../../reports/streaming/clover" /> |
---|
83 | <clover-setup initString="../../../reports/streaming/clover/coverage.db"/> |
---|
84 | </target> |
---|
85 | <target name="prepareCobertura" depends="compile" if="with.cobertura"> |
---|
86 | <taskdef classpath="${with.cobertura}" resource="tasks.properties" onerror="report" /> |
---|
87 | <mkdir dir="./build/obj_cobertura" /> |
---|
88 | <delete file="./cobertura.ser" /> |
---|
89 | <cobertura-instrument todir="./build/obj_cobertura"> |
---|
90 | <fileset dir="./build/obj"> |
---|
91 | <include name="**/*.class"/> |
---|
92 | <!-- exclude Test classes --> |
---|
93 | <exclude name="**/*Test.class" /> |
---|
94 | <exclude name="**/*TestBase.class" /> |
---|
95 | <exclude name="**/*IT.class" /> |
---|
96 | <exclude name="**/*IT$*.class" /> |
---|
97 | <exclude name="**/StreamingITBase.class" /> |
---|
98 | <exclude name="**/StreamingITBase$*.class" /> |
---|
99 | <!-- exclude anything not in net.i2p.* --> |
---|
100 | <exclude name="org/cybergarage/**/*.class" /> |
---|
101 | <exclude name="org/freenetproject/**/*.class" /> |
---|
102 | <exclude name="org/xlattice/**/*.class" /> |
---|
103 | </fileset> |
---|
104 | </cobertura-instrument> |
---|
105 | </target> |
---|
106 | |
---|
107 | <target name="prepareTest" depends="prepareClover, prepareCobertura" /> |
---|
108 | |
---|
109 | <target name="junit.test" depends="clean, junit.compileTest, prepareTest"> |
---|
110 | <mkdir dir="../../../reports/streaming/junit/" /> |
---|
111 | <delete> |
---|
112 | <fileset dir="../../../reports/streaming/junit"> |
---|
113 | <include name="TEST-*.xml"/> |
---|
114 | </fileset> |
---|
115 | </delete> |
---|
116 | |
---|
117 | <property name="junit.home" value="${ant.home}/lib" /> |
---|
118 | <property name="hamcrest.home" value="${ant.home}/lib" /> |
---|
119 | <property name="mockito.home" value="${ant.home}/lib" /> |
---|
120 | |
---|
121 | <junit printsummary="withOutAndErr" fork="yes" showoutput="yes" > |
---|
122 | <sysproperty key="net.sourceforge.cobertura.datafile" file="./cobertura.ser" /> |
---|
123 | <classpath> |
---|
124 | <pathelement path="${javac.classpath}" /> |
---|
125 | <pathelement location="${hamcrest.home}/hamcrest-core.jar" /> |
---|
126 | <pathelement location="${hamcrest.home}/hamcrest-library.jar" /> |
---|
127 | <pathelement location="${hamcrest.home}/hamcrest-integration.jar" /> |
---|
128 | <pathelement location="${hamcrest.home}/hamcrest-all.jar" /> |
---|
129 | <pathelement location="${mockito.home}/byte-buddy.jar" /> |
---|
130 | <pathelement location="${mockito.home}/objenesis.jar" /> |
---|
131 | <pathelement location="${mockito.home}/mockito-core.jar" /> |
---|
132 | <pathelement location="${junit.home}/junit4.jar" /> |
---|
133 | <pathelement location="./build/obj_cobertura" /> |
---|
134 | <pathelement location="./build/obj" /> |
---|
135 | <pathelement location="../../../core/java/build/i2ptest.jar" /> |
---|
136 | <pathelement location="../../../core/java/build/i2p.jar" /> |
---|
137 | <pathelement location="../../ministreaming/java/build/mstreaming.jar" /> |
---|
138 | <pathelement location="../../build/jbigi.jar" /> |
---|
139 | <pathelement location="${with.clover}" /> |
---|
140 | <pathelement location="${with.cobertura}" /> |
---|
141 | </classpath> |
---|
142 | <batchtest todir="../../../reports/streaming/junit/"> |
---|
143 | <fileset dir="./test/junit"> |
---|
144 | <include name="**/*Test.java" /> |
---|
145 | <include name="**/*IT.java" if="runIntegrationTests" /> |
---|
146 | </fileset> |
---|
147 | </batchtest> |
---|
148 | <formatter type="xml"/> |
---|
149 | </junit> |
---|
150 | <!-- set if unset --> |
---|
151 | <property name="host.fakename" value="i2ptester" /> |
---|
152 | <!-- replace hostname that junit inserts into reports with fake one --> |
---|
153 | <replaceregexp byline="true" |
---|
154 | match="(hostname=)"[^"]+"" |
---|
155 | replace="\1"${host.fakename}""> |
---|
156 | <fileset dir="../../../reports/streaming/junit/" /> |
---|
157 | </replaceregexp> |
---|
158 | </target> |
---|
159 | <target name="test" depends="junit.test"/> |
---|
160 | <!-- test reports --> |
---|
161 | <target name="junit.report"> |
---|
162 | <junitreport todir="../../../reports/streaming/junit"> |
---|
163 | <fileset dir="../../../reports/streaming/junit"> |
---|
164 | <include name="TEST-*.xml"/> |
---|
165 | </fileset> |
---|
166 | <report format="frames" todir="../../../reports/streaming/html/junit"/> |
---|
167 | </junitreport> |
---|
168 | </target> |
---|
169 | <target name="clover.report" depends="test" if="with.clover"> |
---|
170 | <clover-report> |
---|
171 | <current outfile="../../../reports/streaming/html/clover"> |
---|
172 | <format type="html"/> |
---|
173 | </current> |
---|
174 | </clover-report> |
---|
175 | </target> |
---|
176 | <target name="cobertura.report" depends="test" if="with.cobertura"> |
---|
177 | <mkdir dir="../../../reports/streaming/cobertura" /> |
---|
178 | <cobertura-report format="xml" srcdir="./src" destdir="../../../reports/streaming/cobertura" /> |
---|
179 | <mkdir dir="../../../reports/streaming/html/cobertura" /> |
---|
180 | <cobertura-report format="html" srcdir="./src" destdir="../../../reports/streaming/html/cobertura" /> |
---|
181 | <delete file="./cobertura.ser" /> |
---|
182 | </target> |
---|
183 | <target name="test.report" depends="junit.report, clover.report, cobertura.report"/> |
---|
184 | <!-- end test reports --> |
---|
185 | <target name="fulltest" depends="cleandep, test, test.report" /> |
---|
186 | <!-- end unit tests --> |
---|
187 | |
---|
188 | <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" > |
---|
189 | <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
190 | <arg value="list" /> |
---|
191 | <arg value="changed" /> |
---|
192 | <arg value="." /> |
---|
193 | </exec> |
---|
194 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
195 | <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
196 | <arg value="-s" /> |
---|
197 | <arg value="[:space:]" /> |
---|
198 | <arg value="," /> |
---|
199 | </exec> |
---|
200 | </target> |
---|
201 | |
---|
202 | <target name="jar" depends="builddep, compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" > |
---|
203 | <!-- set if unset --> |
---|
204 | <property name="workspace.changes.tr" value="" /> |
---|
205 | <jar destfile="./build/streaming.jar" basedir="./build/obj" includes="**/*.class" > |
---|
206 | <manifest> |
---|
207 | <attribute name="Specification-Title" value="I2P Streaming API" /> |
---|
208 | <attribute name="Specification-Version" value="${release.number}" /> |
---|
209 | <attribute name="Specification-Vendor" value="The I2P Project https://geti2p.net/" /> |
---|
210 | <attribute name="Implementation-Title" value="I2P Java Streaming API" /> |
---|
211 | <attribute name="Implementation-Version" value="${full.version}" /> |
---|
212 | <attribute name="Implementation-Vendor" value="The I2P Project https://geti2p.net/" /> |
---|
213 | <attribute name="Built-By" value="${build.built-by}" /> |
---|
214 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
215 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
216 | <attribute name="Workspace-Changes" value="${workspace.changes.tr}" /> |
---|
217 | <attribute name="X-Compile-Source-JDK" value="${javac.version}" /> |
---|
218 | <attribute name="X-Compile-Target-JDK" value="${javac.version}" /> |
---|
219 | </manifest> |
---|
220 | </jar> |
---|
221 | </target> |
---|
222 | |
---|
223 | <target name="jarUpToDate"> |
---|
224 | <uptodate property="jar.uptodate" targetfile="build/streaming.jar" > |
---|
225 | <srcfiles dir= "." includes="build/obj/**/*.class" /> |
---|
226 | </uptodate> |
---|
227 | <condition property="shouldListChanges" > |
---|
228 | <and> |
---|
229 | <not> |
---|
230 | <isset property="jar.uptodate" /> |
---|
231 | </not> |
---|
232 | <isset property="mtn.available" /> |
---|
233 | </and> |
---|
234 | </condition> |
---|
235 | </target> |
---|
236 | |
---|
237 | <target name="jarTest" depends="jar, junit.compileTest"> |
---|
238 | <jar destfile="./build/streaming.jar" basedir="./build/obj" includes="**/*Test*.class" update="true" /> |
---|
239 | </target> |
---|
240 | <target name="javadoc"> |
---|
241 | <mkdir dir="./build" /> |
---|
242 | <mkdir dir="./build/javadoc" /> |
---|
243 | <javadoc |
---|
244 | sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc" |
---|
245 | packagenames="*" |
---|
246 | use="true" |
---|
247 | splitindex="true" |
---|
248 | windowtitle="Streaming" /> |
---|
249 | </target> |
---|
250 | |
---|
251 | <!-- for Maven Central --> |
---|
252 | <target name="javadocJar" depends="javadoc"> |
---|
253 | <jar jarfile="./build/streaming-${release.number}-javadoc.jar"> |
---|
254 | <fileset dir="./build/javadoc" /> |
---|
255 | </jar> |
---|
256 | </target> |
---|
257 | <target name="sourcesJar"> |
---|
258 | <jar jarfile="./build/streaming-${release.number}-sources.jar"> |
---|
259 | <fileset dir="./src" /> |
---|
260 | </jar> |
---|
261 | </target> |
---|
262 | |
---|
263 | <target name="clean"> |
---|
264 | <delete dir="./build" /> |
---|
265 | </target> |
---|
266 | <target name="cleandep" depends="clean"> |
---|
267 | </target> |
---|
268 | <target name="distclean" depends="clean"> |
---|
269 | </target> |
---|
270 | </project> |
---|