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

Last change on this file since 6198739 was 6198739, checked in by zzz <zzz@…>, 10 years ago

propagate from branch 'i2p.i2p' (head 899a1923586f3d7d622bd02e03c87717566617c4)

to branch 'i2p.i2p.zzz.jetty6' (head cb3e33be282b6002f6790609f4a3eef7f42069d3)

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