source: apps/i2ptunnel/java/build.xml @ 41af00a

Last change on this file since 41af00a was 41af00a, checked in by kytv <kytv@…>, 8 years ago

don't run gettext if 'require.gettext' is set to false

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