source: apps/i2ptunnel/java/build.xml @ d4ea7dc

Last change on this file since d4ea7dc was 5d93ca1, checked in by zzz <zzz@…>, 4 years ago

Build: Add back the old, slow way to build bundles
for gettext < 0.19

  • Property mode set to 100644
File size: 18.7 KB
Line 
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="../../../core/java/build/gnu-getopt.jar" />
20                <pathelement location="../../ministreaming/java/build/obj" />
21            </classpath>
22        </depend>
23    </target>
24
25    <condition property="no.bundle">
26        <isfalse value="${require.gettext}" />
27    </condition>
28
29    <!-- only used if not set by a higher build.xml -->
30    <property name="javac.compilerargs" value="" />
31    <property name="javac.version" value="1.6" />
32    <property name="require.gettext" value="true" />
33
34    <target name="compile" depends="depend">
35        <mkdir dir="./build" />
36        <mkdir dir="./build/obj" />
37        <javac 
38            srcdir="./src" 
39            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
40            destdir="./build/obj" 
41            includeAntRuntime="false"
42            classpath="../../../core/java/build/i2p.jar:../../../core/java/build/gnu-getopt.jar:../../ministreaming/java/build/mstreaming.jar" >
43            <compilerarg line="${javac.compilerargs}" />
44        </javac>
45    </target>
46
47    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
48        <exec executable="mtn" outputproperty="workspace.changes.j" errorproperty="mtn.error2" failifexecutionfails="false" >
49            <arg value="list" />
50            <arg value="changed" />
51            <arg value="." />
52        </exec>
53        <!-- \n in an attribute value generates an invalid manifest -->
54        <exec executable="tr" inputstring="${workspace.changes.j}" outputproperty="workspace.changes.j.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
55            <arg value="-s" />
56            <arg value="[:space:]" />
57            <arg value="," />
58        </exec>
59    </target>
60
61
62    <!-- The web classes are now in the war not the jar - they are not part of the API -->
63    <target name="jar" depends="builddep, compile, bundle-proxy, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
64        <!-- set if unset -->
65        <property name="workspace.changes.j.tr" value="" />
66        <jar destfile="./build/i2ptunnel.jar" basedir="./build/obj" includes="**/*.class" excludes="**/ui/*.class **/EditBean.class **/IndexBean.class" >
67            <manifest>
68                <attribute name="Main-Class" value="net.i2p.i2ptunnel.I2PTunnel" />
69                <attribute name="Class-Path" value="i2p.jar mstreaming.jar" />
70                <attribute name="Implementation-Version" value="${full.version}" />
71                <attribute name="Built-By" value="${build.built-by}" />
72                <attribute name="Build-Date" value="${build.timestamp}" />
73                <attribute name="Base-Revision" value="${workspace.version}" />
74                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
75            </manifest>
76        </jar>
77        <jar destfile="./build/temp-beans.jar" basedir="./build/obj" includes="**/ui/*.class **/EditBean.class **/IndexBean.class" />
78    </target>
79
80    <target name="jarUpToDate">
81        <uptodate property="jar.uptodate" targetfile="build/i2ptunnel.jar" >
82            <srcfiles dir= "build/obj" includes="**/*.class" />
83        </uptodate>
84        <condition property="shouldListChanges" >
85            <and>
86                <not>
87                    <isset property="jar.uptodate" />
88                </not>
89                <isset property="mtn.available" />
90            </and>
91        </condition>
92    </target>
93
94    <!-- Separate jar for general UI classes -->
95    <target name="uiJar" depends="jar, uiJarUpToDate, listChangedFiles" unless="uiJar.uptodate" >
96        <!-- set if unset -->
97        <property name="workspace.changes.j.tr" value="" />
98        <jar destfile="./build/i2ptunnel-ui.jar" basedir="./build/obj" includes="**/ui/*.class" >
99            <manifest>
100                <attribute name="Class-Path" value="i2p.jar mstreaming.jar i2ptunnel.jar" />
101                <attribute name="Implementation-Version" value="${full.version}" />
102                <attribute name="Built-By" value="${build.built-by}" />
103                <attribute name="Build-Date" value="${build.timestamp}" />
104                <attribute name="Base-Revision" value="${workspace.version}" />
105                <attribute name="Workspace-Changes" value="${workspace.changes.j.tr}" />
106            </manifest>
107        </jar>
108    </target>
109
110    <target name="uiJarUpToDate">
111        <uptodate property="uiJar.uptodate" targetfile="build/i2ptunnel-ui.jar" >
112            <srcfiles dir= "build/obj" includes="**/ui/*.class" />
113        </uptodate>
114        <condition property="shouldListChanges" >
115            <and>
116                <not>
117                    <isset property="uiJar.uptodate" />
118                </not>
119                <isset property="mtn.available" />
120            </and>
121        </condition>
122    </target>
123
124    <!-- servlet translations go in the war, not the jar -->
125    <target name="bundle" depends="compile, precompilejsp" unless="no.bundle">
126        <mkdir dir="build/messages-src" />
127        <!-- Update the messages_*.po files.
128             We need to supply the bat file for windows, and then change the fail property to true -->
129        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
130            <env key="JAVA_HOME" value="${java.home}" />
131            <arg value="./bundle-messages.sh" />
132        </exec>
133        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
134            <arg value="./bundle-messages.sh" />
135        </exec>
136                <!-- multi-lang is optional -->
137        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
138            <arg value="./bundle-messages.sh" />
139        </exec>
140        <javac source="${javac.version}" target="${javac.version}" 
141               includeAntRuntime="false"
142               srcdir="build/messages-src" destdir="../jsp/WEB-INF/classes">
143            <compilerarg line="${javac.compilerargs}" />
144        </javac>
145    </target>
146
147    <target name="poupdate" depends="compile, precompilejsp">
148        <!-- Update the messages_*.po files. -->
149        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
150            <arg value="./bundle-messages.sh" />
151            <arg value="-p" />
152        </exec>
153        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
154            <arg value="./bundle-messages.sh" />
155            <arg value="-p" />
156        </exec>
157        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
158            <arg value="./bundle-messages.sh" />
159            <arg value="-p" />
160        </exec>
161    </target>
162
163    <!-- proxy error page translations go in the jar, not the war -->
164    <target name="bundle-proxy" unless="no.bundle">
165        <mkdir dir="build/messages-proxy-src" />
166        <!-- Update the messages_*.po files.
167             We need to supply the bat file for windows, and then change the fail property to true -->
168        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
169            <env key="JAVA_HOME" value="${java.home}" />
170            <arg value="./bundle-messages-proxy.sh" />
171        </exec>
172        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
173            <arg value="./bundle-messages-proxy.sh" />
174        </exec>
175                <!-- multi-lang is optional -->
176        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
177            <arg value="./bundle-messages-proxy.sh" />
178        </exec>
179        <javac source="${javac.version}" target="${javac.version}" 
180               includeAntRuntime="false"
181               srcdir="build/messages-proxy-src" destdir="build/obj">
182            <compilerarg line="${javac.compilerargs}" />
183        </javac>
184    </target>
185
186    <target name="extractProxyTags">
187        <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true">
188            <classpath>
189                <pathelement location="../../../build/i2p.jar" />
190            </classpath>
191            <arg value="tag" />
192            <arg value="../../../installer/resources/proxy/" />
193            <arg value="build/Proxy.java" />
194        </java>
195    </target>
196
197    <target name="poupdate-proxy" depends="extractProxyTags">
198        <!-- Update the messages_*.po files. -->
199        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
200            <arg value="./bundle-messages-proxy.sh" />
201            <arg value="-p" />
202        </exec>
203        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
204            <arg value="./bundle-messages-proxy.sh" />
205            <arg value="-p" />
206        </exec>
207        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
208            <arg value="./bundle-messages-proxy.sh" />
209            <arg value="-p" />
210        </exec>
211    </target>
212
213    <target name="listChangedFiles2" depends="warUpToDate" if="shouldListChanges2" >
214        <exec executable="mtn" outputproperty="workspace.changes.w" errorproperty="mtn.error2" failifexecutionfails="false" >
215            <arg value="list" />
216            <arg value="changed" />
217            <arg value="../jsp" />
218        </exec>
219        <!-- \n in an attribute value generates an invalid manifest -->
220        <exec executable="tr" inputstring="${workspace.changes.w}" outputproperty="workspace.changes.w.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
221            <arg value="-s" />
222            <arg value="[:space:]" />
223            <arg value="," />
224        </exec>
225    </target>
226
227    <!-- The web classes are now in the war not the jar - they are not part of the API -->
228    <target name="war" depends="precompilejsp, bundle, warUpToDate, listChangedFiles2" unless="war.uptodate" > 
229        <!-- set if unset -->
230        <property name="workspace.changes.w.tr" value="" />
231        <copy todir="../jsp/WEB-INF/classes/net/i2p/i2ptunnel/ui">
232                <fileset dir="build/obj/net/i2p/i2ptunnel/ui" />
233        </copy>
234        <copy file="build/obj/net/i2p/i2ptunnel/web/EditBean.class" todir="../jsp/WEB-INF/classes/net/i2p/i2ptunnel/web" />
235        <copy file="build/obj/net/i2p/i2ptunnel/web/IndexBean.class" todir="../jsp/WEB-INF/classes/net/i2p/i2ptunnel/web" />
236        <war destfile="build/i2ptunnel.war" webxml="../jsp/web-out.xml"
237             basedir="../jsp/" excludes="web.xml, web-fragment.xml, web-out.xml, **/*.java, *.jsp">
238            <manifest>
239                <attribute name="Implementation-Version" value="${full.version}" />
240                <attribute name="Built-By" value="${build.built-by}" />
241                <attribute name="Build-Date" value="${build.timestamp}" />
242                <attribute name="Base-Revision" value="${workspace.version}" />
243                <attribute name="Workspace-Changes" value="${workspace.changes.w.tr}" />
244            </manifest>
245        </war>
246    </target>
247
248    <target name="warUpToDate">
249        <uptodate property="war.uptodate" targetfile="build/i2ptunnel.war" >
250            <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp" />
251            <srcfiles dir= "build/obj" includes="**/ui/*.class **/web/*.class" />
252        </uptodate>
253        <condition property="shouldListChanges2" >
254            <and>
255                <not>
256                    <isset property="war.uptodate" />
257                </not>
258                <isset property="mtn.available" />
259            </and>
260        </condition>
261    </target>
262
263    <target name="precompilejsp" depends="jar" unless="precompilejsp.uptodate">
264        <delete dir="../jsp/WEB-INF/" />
265        <delete file="../jsp/web-fragment.xml" />
266        <delete file="../jsp/web-out.xml" />
267        <mkdir dir="../jsp/WEB-INF/" />
268        <mkdir dir="../jsp/WEB-INF/classes" />
269        <!-- there are various jspc ant tasks, but they all seem a bit flakey -->
270        <java classname="org.apache.jasper.JspC" fork="true" failonerror="true">
271            <classpath>
272                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
273                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
274                <!-- jsp-api.jar only present for debian builds -->
275                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
276                <!-- tomcat-api.jar only present for debian builds -->
277                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
278                <!-- jasper-el.jar only present for debian builds -->
279                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
280                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
281                <pathelement location="../../jetty/jettylib/commons-el.jar" />
282                <pathelement location="${ant.home}/lib/ant.jar" />
283                <pathelement location="build/i2ptunnel.jar" />
284                <pathelement location="build/temp-beans.jar" />
285                <pathelement location="../../../core/java/build/i2p.jar" />
286                <!-- required for multipart form handling in register.jsp -->
287                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
288            </classpath>
289            <arg value="-d" />
290            <arg value="../jsp/WEB-INF/classes" />
291            <arg value="-v" />
292            <arg value="-p" />
293            <arg value="net.i2p.i2ptunnel.jsp" />
294            <arg value="-webinc" />
295            <arg value="../jsp/web-fragment.xml" />
296            <arg value="-webapp" />
297            <arg value="../jsp/" />
298        </java>
299        <javac debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
300               includeAntRuntime="false"
301               destdir="../jsp/WEB-INF/classes/" srcdir="../jsp/WEB-INF/classes" includes="**/*.java">
302            <compilerarg line="${javac.compilerargs}" />
303            <classpath>
304                <pathelement location="../../jetty/jettylib/jasper-runtime.jar" />
305                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
306                <!-- jsp-api.jar only present for debian builds -->
307                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
308                <!-- tomcat-api.jar only present for debian builds -->
309                <pathelement location="../../jetty/jettylib/tomcat-api.jar" />
310                <!-- jasper-el.jar only present for debian builds -->
311                <pathelement location="../../jetty/jettylib/jasper-el.jar" />
312                <pathelement location="../../jetty/jettylib/commons-logging.jar" />
313                <pathelement location="../../jetty/jettylib/commons-el.jar" />
314                <pathelement location="build/i2ptunnel.jar" />
315                <pathelement location="build/temp-beans.jar" />
316                <pathelement location="../../../core/java/build/i2p.jar" />
317                <!-- required for multipart form handling in register.jsp -->
318                <pathelement location="../../jetty/jettylib/jetty-i2p.jar" />
319            </classpath>
320        </javac>
321        <copy file="../jsp/web.xml" tofile="../jsp/web-out.xml" />
322        <loadfile property="jspc.web.fragment" srcfile="../jsp/web-fragment.xml" />
323        <replace file="../jsp/web-out.xml">
324            <replacefilter token="&lt;!-- precompiled servlets --&gt;" value="${jspc.web.fragment}" />
325        </replace>
326    </target>
327
328    <uptodate property="precompilejsp.uptodate" targetfile="../jsp/web-out.xml">
329        <srcfiles dir= "../jsp" includes="*.jsp, *.html, web.xml"/>
330        <srcfiles dir= "src/net/i2p/i2ptunnel/web" includes="*.java"/>
331    </uptodate>
332
333    <target name="javadoc">
334        <mkdir dir="./build" />
335        <mkdir dir="./build/javadoc" />
336        <javadoc 
337            sourcepath="./src:../../../core/java/src:../../ministreaming/java/src" destdir="./build/javadoc" 
338            packagenames="*" 
339            use="true" 
340            splitindex="true" 
341            windowtitle="I2PTunnel" />
342    </target>
343
344    <target name="compileTest">
345        <mkdir dir="./build" />
346        <mkdir dir="./build/obj" />
347        <!-- We need the ant runtime, as it includes junit -->
348        <javac srcdir="./src:./test/junit" debug="true" source="${javac.version}" target="${javac.version}"
349               includeAntRuntime="true"
350               deprecation="on" destdir="./build/obj" >
351            <compilerarg line="${javac.compilerargs}" />
352            <classpath>
353                <pathelement location="../../../core/java/build/i2p.jar" />
354                <pathelement location="../../ministreaming/java/build/mstreaming.jar" />
355            </classpath>
356        </javac>
357    </target>
358    <target name="test" depends="clean, compileTest">
359        <junit printsummary="on" fork="yes">
360            <classpath>
361                <pathelement path="${classpath}" />
362                <pathelement location="./build/obj" />
363                <pathelement location="../../../core/java/build/i2p.jar" />
364            </classpath>
365            <batchtest>
366                <fileset dir="./test/junit/">
367                    <include name="**/*Test.java" />
368                </fileset>
369            </batchtest>
370            <formatter type="xml"/>
371        </junit>
372        <mkdir dir="../../../reports/" />
373        <mkdir dir="../../../reports/i2ptunnel/" />
374        <mkdir dir="../../../reports/i2ptunnel/junit/" />
375        <delete>
376            <fileset dir="../../../reports/i2ptunnel/junit">
377                <include name="TEST-*.xml"/>
378            </fileset>
379        </delete>
380        <copy todir="../../../reports/i2ptunnel/junit">
381            <fileset dir=".">
382                <include name="TEST-*.xml"/>
383            </fileset>
384        </copy>
385        <delete>
386            <fileset dir=".">
387                <include name="TEST-*.xml"/>
388            </fileset>
389        </delete>
390    </target>
391
392    <target name="clean">
393        <delete dir="./build" />
394        <delete dir="../jsp/WEB-INF/" />
395        <delete file="../jsp/web-fragment.xml" />
396        <delete file="../jsp/web-out.xml" />
397    </target>
398    <target name="cleandep" depends="clean">
399    </target>
400    <target name="distclean" depends="clean">
401    </target>
402</project>
Note: See TracBrowser for help on using the repository browser.