source: apps/i2ptunnel/java/build.xml @ 0ac83bd

Last change on this file since 0ac83bd was 0ac83bd, checked in by zzz <zzz@…>, 4 years ago

i2ptunnel: Enhance registration authentication page

  • Enable form
  • Switch to multipart form for getting old private key file
  • Add advanced authentications

PrivateKeyFile?: Add InputStream? constructor for i2ptunnel

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