1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
2 | <project basedir="." default="all" name="i2ptunnel"> |
---|
3 | <target name="all" depends="clean, build" /> |
---|
4 | <target name="build" depends="builddep, jar, war" /> |
---|
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="../../ministreaming/java/build/obj" /> |
---|
20 | </classpath> |
---|
21 | </depend> |
---|
22 | </target> |
---|
23 | <property name="javac.compilerargs" value="" /> |
---|
24 | <target name="compile" depends="depend"> |
---|
25 | <mkdir dir="./build" /> |
---|
26 | <mkdir dir="./build/obj" /> |
---|
27 | <javac |
---|
28 | srcdir="./src" |
---|
29 | debug="true" deprecation="on" source="1.5" target="1.5" |
---|
30 | destdir="./build/obj" |
---|
31 | includeAntRuntime="false" |
---|
32 | classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" > |
---|
33 | <compilerarg line="${javac.compilerargs}" /> |
---|
34 | </javac> |
---|
35 | </target> |
---|
36 | |
---|
37 | <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" > |
---|
38 | <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
39 | <arg value="list" /> |
---|
40 | <arg value="changed" /> |
---|
41 | <arg value="." /> |
---|
42 | </exec> |
---|
43 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
44 | <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
45 | <arg value="-s" /> |
---|
46 | <arg value="[:space:]" /> |
---|
47 | <arg value="," /> |
---|
48 | </exec> |
---|
49 | </target> |
---|
50 | |
---|
51 | |
---|
52 | <!-- TODO: Move the web classes from the jar to the war - they are not part of the API |
---|
53 | - This will require sponge to rewrite some seedless stuff that uses it. |
---|
54 | --> |
---|
55 | <target name="jar" depends="builddep, compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" > |
---|
56 | <!-- set if unset --> |
---|
57 | <property name="workspace.changes.j.tr" value="" /> |
---|
58 | <jar destfile="./build/i2ptunnel.jar" basedir="./build/obj" includes="**/*.class"> |
---|
59 | <manifest> |
---|
60 | <attribute name="Main-Class" value="net.i2p.i2ptunnel.I2PTunnel" /> |
---|
61 | <attribute name="Class-Path" value="i2p.jar mstreaming.jar" /> |
---|
62 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
63 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
64 | <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" /> |
---|
65 | </manifest> |
---|
66 | </jar> |
---|
67 | </target> |
---|
68 | |
---|
69 | <target name="jarUpToDate"> |
---|
70 | <uptodate property="jar.uptodate" targetfile="build/i2ptunnel.jar" > |
---|
71 | <srcfiles dir= "build/obj" includes="**/*.class" /> |
---|
72 | </uptodate> |
---|
73 | <condition property="shouldListChanges" > |
---|
74 | <and> |
---|
75 | <not> |
---|
76 | <isset property="jar.uptodate" /> |
---|
77 | </not> |
---|
78 | <isset property="mtn.available" /> |
---|
79 | </and> |
---|
80 | </condition> |
---|
81 | </target> |
---|
82 | |
---|
83 | <target name="bundle" depends="compile, precompilejsp"> |
---|
84 | <!-- Update the messages_*.po files. |
---|
85 | We need to supply the bat file for windows, and then change the fail property to true --> |
---|
86 | <exec executable="sh" osfamily="unix" failifexecutionfails="true" > |
---|
87 | <arg value="./bundle-messages.sh" /> |
---|
88 | </exec> |
---|
89 | <exec executable="sh" osfamily="mac" failifexecutionfails="true" > |
---|
90 | <arg value="./bundle-messages.sh" /> |
---|
91 | </exec> |
---|
92 | <!-- multi-lang is optional --> |
---|
93 | <exec executable="sh" osfamily="windows" failifexecutionfails="false" > |
---|
94 | <arg value="./bundle-messages.sh" /> |
---|
95 | </exec> |
---|
96 | </target> |
---|
97 | |
---|
98 | <target name="poupdate" depends="compile, precompilejsp"> |
---|
99 | <!-- Update the messages_*.po files. --> |
---|
100 | <exec executable="sh" osfamily="unix" failifexecutionfails="true" > |
---|
101 | <arg value="./bundle-messages.sh" /> |
---|
102 | <arg value="-p" /> |
---|
103 | </exec> |
---|
104 | <exec executable="sh" osfamily="mac" failifexecutionfails="true" > |
---|
105 | <arg value="./bundle-messages.sh" /> |
---|
106 | <arg value="-p" /> |
---|
107 | </exec> |
---|
108 | <exec executable="sh" osfamily="windows" failifexecutionfails="true" > |
---|
109 | <arg value="./bundle-messages.sh" /> |
---|
110 | <arg value="-p" /> |
---|
111 | </exec> |
---|
112 | </target> |
---|
113 | |
---|
114 | <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" > |
---|
115 | <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
116 | <arg value="list" /> |
---|
117 | <arg value="changed" /> |
---|
118 | <arg value="../jsp" /> |
---|
119 | </exec> |
---|
120 | <!-- \n in an attribute value generates an invalid manifest --> |
---|
121 | <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" > |
---|
122 | <arg value="-s" /> |
---|
123 | <arg value="[:space:]" /> |
---|
124 | <arg value="," /> |
---|
125 | </exec> |
---|
126 | </target> |
---|
127 | |
---|
128 | <target name="war" depends="precompilejsp, bundle, warUpToDate, listChangedFiles2" unless="war.uptodate" > |
---|
129 | <!-- set if unset --> |
---|
130 | <property name="workspace.changes.w.tr" value="" /> |
---|
131 | <war destfile="build/i2ptunnel.war" webxml="../jsp/web-out.xml" |
---|
132 | basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp"> |
---|
133 | <manifest> |
---|
134 | <attribute name="Build-Date" value="${build.timestamp}" /> |
---|
135 | <attribute name="Base-Revision" value="${workspace.version}" /> |
---|
136 | <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" /> |
---|
137 | </manifest> |
---|
138 | </war> |
---|
139 | </target> |
---|
140 | |
---|
141 | <target name="warUpToDate"> |
---|
142 | <uptodate property="war.uptodate" targetfile="build/i2ptunnel.war" > |
---|
143 | <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp" /> |
---|
144 | </uptodate> |
---|
145 | <condition property="shouldListChanges2" > |
---|
146 | <and> |
---|
147 | <not> |
---|
148 | <isset property="war.uptodate" /> |
---|
149 | </not> |
---|
150 | <isset property="mtn.available" /> |
---|
151 | </and> |
---|
152 | </condition> |
---|
153 | </target> |
---|
154 | |
---|
155 | <target name="precompilejsp" depends="jar" unless="precompilejsp.uptodate"> |
---|
156 | <delete dir="../jsp/WEB-INF/" /> |
---|
157 | <delete file="../jsp/web-fragment.xml" /> |
---|
158 | <delete file="../jsp/web-out.xml" /> |
---|
159 | <mkdir dir="../jsp/WEB-INF/" /> |
---|
160 | <mkdir dir="../jsp/WEB-INF/classes" /> |
---|
161 | <!-- there are various jspc ant tasks, but they all seem a bit flakey --> |
---|
162 | <java classname="org.apache.jasper.JspC" fork="true" failonerror="true"> |
---|
163 | <classpath> |
---|
164 | <pathelement location="../../jetty/jettylib/jasper-compiler.jar" /> |
---|
165 | <pathelement location="../../jetty/jettylib/jasper-runtime.jar" /> |
---|
166 | <pathelement location="../../jetty/jettylib/javax.servlet.jar" /> |
---|
167 | <pathelement location="../../jetty/jettylib/commons-logging.jar" /> |
---|
168 | <pathelement location="../../jetty/jettylib/commons-el.jar" /> |
---|
169 | <pathelement location="../../jetty/jettylib/ant.jar" /> |
---|
170 | <pathelement location="build/i2ptunnel.jar" /> |
---|
171 | </classpath> |
---|
172 | <arg value="-d" /> |
---|
173 | <arg value="../jsp/WEB-INF/classes" /> |
---|
174 | <arg value="-p" /> |
---|
175 | <arg value="net.i2p.i2ptunnel.jsp" /> |
---|
176 | <arg value="-webinc" /> |
---|
177 | <arg value="../jsp/web-fragment.xml" /> |
---|
178 | <arg value="-webapp" /> |
---|
179 | <arg value="../jsp/" /> |
---|
180 | </java> |
---|
181 | <javac debug="true" deprecation="on" source="1.5" target="1.5" |
---|
182 | includeAntRuntime="false" |
---|
183 | destdir="../jsp/WEB-INF/classes/" srcdir="../jsp/WEB-INF/classes" includes="**/*.java"> |
---|
184 | <compilerarg line="${javac.compilerargs}" /> |
---|
185 | <classpath> |
---|
186 | <pathelement location="../../jetty/jettylib/jasper-runtime.jar" /> |
---|
187 | <pathelement location="../../jetty/jettylib/javax.servlet.jar" /> |
---|
188 | <pathelement location="../../jetty/jettylib/commons-logging.jar" /> |
---|
189 | <pathelement location="../../jetty/jettylib/commons-el.jar" /> |
---|
190 | <pathelement location="build/i2ptunnel.jar" /> |
---|
191 | </classpath> |
---|
192 | </javac> |
---|
193 | <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" /> |
---|
194 | <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" /> |
---|
195 | <replace file="../jsp/web-out.xml"> |
---|
196 | <replacefilter token="<!-- precompiled servlets -->" value="${jspc.web.fragment}" /> |
---|
197 | </replace> |
---|
198 | </target> |
---|
199 | |
---|
200 | <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml"> |
---|
201 | <srcfiles dir= "../jsp" includes="*.jsp, *.html, web.xml"/> |
---|
202 | </uptodate> |
---|
203 | |
---|
204 | <target name="javadoc"> |
---|
205 | <mkdir dir="./build" /> |
---|
206 | <mkdir dir="./build/javadoc" /> |
---|
207 | <javadoc |
---|
208 | sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc" |
---|
209 | packagenames="*" |
---|
210 | use="true" |
---|
211 | splitindex="true" |
---|
212 | windowtitle="I2PTunnel" /> |
---|
213 | </target> |
---|
214 | |
---|
215 | <target name="compileTest"> |
---|
216 | <mkdir dir="./build" /> |
---|
217 | <mkdir dir="./build/obj" /> |
---|
218 | <!-- We need the ant runtime, as it includes junit --> |
---|
219 | <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5" |
---|
220 | includeAntRuntime="true" |
---|
221 | deprecation="on" destdir="./build/obj" > |
---|
222 | <compilerarg line="${javac.compilerargs}" /> |
---|
223 | <classpath> |
---|
224 | <pathelement location="../../../core/java/build/i2p.jar" /> |
---|
225 | <pathelement location="../../ministreaming/java/build/mstreaming.jar" /> |
---|
226 | </classpath> |
---|
227 | </javac> |
---|
228 | </target> |
---|
229 | <target name="test" depends="clean, compileTest"> |
---|
230 | <junit printsummary="on" fork="yes"> |
---|
231 | <classpath> |
---|
232 | <pathelement path="${classpath}" /> |
---|
233 | <pathelement location="./build/obj" /> |
---|
234 | <pathelement location="../../../core/java/build/i2p.jar" /> |
---|
235 | </classpath> |
---|
236 | <batchtest> |
---|
237 | <fileset dir="./test/"> |
---|
238 | <include name="**/*Test.java" /> |
---|
239 | </fileset> |
---|
240 | </batchtest> |
---|
241 | <formatter type="xml"/> |
---|
242 | </junit> |
---|
243 | <mkdir dir="../../../reports/" /> |
---|
244 | <mkdir dir="../../../reports/i2ptunnel/" /> |
---|
245 | <mkdir dir="../../../reports/i2ptunnel/junit/" /> |
---|
246 | <delete> |
---|
247 | <fileset dir="../../../reports/i2ptunnel/junit"> |
---|
248 | <include name="TEST-*.xml"/> |
---|
249 | </fileset> |
---|
250 | </delete> |
---|
251 | <copy todir="../../../reports/i2ptunnel/junit"> |
---|
252 | <fileset dir="."> |
---|
253 | <include name="TEST-*.xml"/> |
---|
254 | </fileset> |
---|
255 | </copy> |
---|
256 | <delete> |
---|
257 | <fileset dir="."> |
---|
258 | <include name="TEST-*.xml"/> |
---|
259 | </fileset> |
---|
260 | </delete> |
---|
261 | </target> |
---|
262 | |
---|
263 | <target name="clean"> |
---|
264 | <delete dir="./build" /> |
---|
265 | <delete dir="../jsp/WEB-INF/" /> |
---|
266 | <delete file="../jsp/web-fragment.xml" /> |
---|
267 | <delete file="../jsp/web-out.xml" /> |
---|
268 | </target> |
---|
269 | <target name="cleandep" depends="clean"> |
---|
270 | </target> |
---|
271 | <target name="distclean" depends="clean"> |
---|
272 | </target> |
---|
273 | </project> |
---|