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

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

multi-lang support for building is optional

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