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

Last change on this file since fd91927c was fd91927c, checked in by zzz <zzz@…>, 10 years ago
  • Build:
    • Add includeAntRuntime=false to all javac targets
    • Add build date, mtn rev, and changed file list to all manifests
    • Add unless=uptodate to all jar and war targets (bob and dtg still todo)
  • Property mode set to 100644
File size: 10.6 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        <javac srcdir="./src:./test" debug="true" source="1.5" target="1.5"
191               includeAntRuntime="false"
192               deprecation="on" destdir="./build/obj" >
193            <compilerarg line="${javac.compilerargs}" />
194            <classpath>
195                <pathelement location="../../../core/java/build/i2p.jar" />
196                <pathelement location="../../ministreaming/java/build/mstreaming.jar" />
197            </classpath>
198        </javac>
199    </target>
200    <target name="test" depends="clean, compileTest">
201        <junit printsummary="on" fork="yes">
202            <classpath>
203                <pathelement path="${classpath}" />
204                <pathelement location="./build/obj" />
205                <pathelement location="../../../core/java/build/i2p.jar" />
206            </classpath>
207            <batchtest>
208                <fileset dir="./test/">
209                    <include name="**/*Test.java" />
210                </fileset>
211            </batchtest>
212            <formatter type="xml"/>
213        </junit>
214        <mkdir dir="../../../reports/" />
215        <mkdir dir="../../../reports/i2ptunnel/" />
216        <mkdir dir="../../../reports/i2ptunnel/junit/" />
217        <delete>
218            <fileset dir="../../../reports/i2ptunnel/junit">
219                <include name="TEST-*.xml"/>
220            </fileset>
221        </delete>
222        <copy todir="../../../reports/i2ptunnel/junit">
223            <fileset dir=".">
224                <include name="TEST-*.xml"/>
225            </fileset>
226        </copy>
227        <delete>
228            <fileset dir=".">
229                <include name="TEST-*.xml"/>
230            </fileset>
231        </delete>
232    </target>
233
234    <target name="clean">
235        <delete dir="./build" />
236        <delete dir="../jsp/WEB-INF/" />
237        <delete file="../jsp/web-fragment.xml" />
238        <delete file="../jsp/web-out.xml" />
239    </target>
240    <target name="cleandep" depends="clean">
241    </target>
242    <target name="distclean" depends="clean">
243    </target>
244</project>
Note: See TracBrowser for help on using the repository browser.