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

Last change on this file since b406c6c was b406c6c, checked in by mathiasdm <mathiasdm@…>, 9 years ago

Fixed tests for i2ptunnel.

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