source: apps/i2psnark/java/build.xml @ 5d93ca1

Last change on this file since 5d93ca1 was 5d93ca1, checked in by zzz <zzz@…>, 4 years ago

Build: Add back the old, slow way to build bundles
for gettext < 0.19

  • Property mode set to 100644
File size: 10.2 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="i2psnark">
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="../../../core/java/build/gnu-getopt.jar" />
20                <pathelement location="../../ministreaming/java/build/obj" />
21                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
22                <!-- jsp-api.jar only present for debian builds -->
23                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
24            </classpath>
25        </depend>
26    </target>
27
28    <property name="javac.compilerargs" value="" />
29    <property name="javac.version" value="1.6" />
30    <property name="require.gettext" value="true" />
31
32    <condition property="no.bundle">
33        <isfalse value="${require.gettext}" />
34    </condition>
35
36    <target name="compile" depends="depend">
37        <mkdir dir="./build" />
38        <mkdir dir="./build/obj" />
39        <javac 
40            srcdir="./src" 
41            debug="true" deprecation="on" source="${javac.version}" target="${javac.version}" 
42            destdir="./build/obj" 
43            includeAntRuntime="false" >
44            <compilerarg line="${javac.compilerargs}" />
45            <classpath>
46                <pathelement location="../../../core/java/build/i2p.jar" />
47                <!-- gnu-getopt.jar only present for debian builds -->
48                <pathelement location="../../../core/java/build/gnu-getopt.jar" />
49                <pathelement location="../../ministreaming/java/build/mstreaming.jar" />
50                <pathelement location="../../jetty/jettylib/javax.servlet.jar" />
51                <!-- jsp-api.jar only present for debian builds -->
52                <pathelement location="../../jetty/jettylib/jsp-api.jar" />
53            </classpath>
54        </javac>
55    </target>
56
57    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
58        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
59            <arg value="list" />
60            <arg value="changed" />
61            <arg value=".." />
62        </exec>
63        <!-- \n in an attribute value generates an invalid manifest -->
64        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
65            <arg value="-s" />
66            <arg value="[:space:]" />
67            <arg value="," />
68        </exec>
69    </target>
70
71    <target name="jar" depends="builddep, compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
72        <!-- set if unset -->
73        <property name="workspace.changes.tr" value="" />
74        <jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/web/* **/messages_*.class">
75            <manifest>
76                <attribute name="Main-Class" value="org.klomp.snark.CommandLine" />
77                <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
78                <attribute name="Implementation-Version" value="${full.version}" />
79                <attribute name="Built-By" value="${build.built-by}" />
80                <attribute name="Build-Date" value="${build.timestamp}" />
81                <attribute name="Base-Revision" value="${workspace.version}" />
82                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
83            </manifest>
84        </jar>
85    </target>   
86   
87    <target name="jarUpToDate">
88        <uptodate property="jar.uptodate" targetfile="build/i2psnark.jar" >
89            <srcfiles dir= "build/obj" includes="**/*.class" excludes="**/web/* **/messages_*.class" />
90        </uptodate>
91        <condition property="shouldListChanges" >
92            <and>
93                <not>
94                    <isset property="jar.uptodate" />
95                </not>
96                <not>
97                    <isset property="war.uptodate" />
98                </not>
99                <isset property="mtn.available" />
100            </and>
101        </condition>
102    </target>   
103
104    <!-- Ideally we would include
105      -  only include the servlet, everything else is in the jar.
106      -  However, the wrapper.config classpath in existing installs
107      -  does not include i2psnark.jar.
108      -  So we must continue to duplicate everything in the war.
109          <classes dir="./build/obj" includes="**/I2PSnarkServlet*.class" />
110     -->
111    <target name="war" depends="jar, bundle, warUpToDate, listChangedFiles" unless="war.uptodate" > 
112        <!-- set if unset -->
113        <property name="workspace.changes.tr" value="" />
114        <copy todir="build/resources/.resources" >
115            <fileset dir="../resources/" />
116        </copy>
117        <!-- mime.properties must be in with the classes -->
118        <copy file="../mime.properties" todir="build/obj/org/klomp/snark/web" />
119        <war destfile="../i2psnark.war" webxml="../web.xml" >
120          <!-- include only the web stuff, as of 0.7.12 the router will add i2psnark.jar to the classpath for the war -->
121          <classes dir="./build/obj" includes="**/web/*" />
122            <fileset dir="build/resources/" />
123            <manifest>
124                <attribute name="Implementation-Version" value="${full.version}" />
125                <attribute name="Built-By" value="${build.built-by}" />
126                <attribute name="Build-Date" value="${build.timestamp}" />
127                <attribute name="Base-Revision" value="${workspace.version}" />
128                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
129            </manifest>
130        </war>
131    </target>
132   
133    <target name="warUpToDate">
134        <uptodate property="war.uptodate" targetfile="../i2psnark.war" >
135            <srcfiles dir= "." includes="build/obj/org/klomp/snark/web/*.class ../resources/**/* ../web.xml" />
136        </uptodate>
137    </target>
138   
139    <target name="bundle" depends="compile" unless="no.bundle">
140        <mkdir dir="build/messages-src" />
141        <!-- Update the messages_*.po files.
142             We need to supply the bat file for windows, and then change the fail property to true -->
143        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
144            <env key="JAVA_HOME" value="${java.home}" />
145            <arg value="./bundle-messages.sh" />
146        </exec>
147        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
148            <arg value="./bundle-messages.sh" />
149        </exec>
150                <!-- multi-lang is optional -->
151        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
152            <arg value="./bundle-messages.sh" />
153        </exec>
154        <javac source="${javac.version}" target="${javac.version}" 
155               includeAntRuntime="false"
156               srcdir="build/messages-src" destdir="build/obj">
157            <compilerarg line="${javac.compilerargs}" />
158        </javac>
159    </target>
160
161    <target name="poupdate" depends="builddep, compile">
162        <!-- Update the messages_*.po files.  -->
163        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
164            <arg value="./bundle-messages.sh" />
165            <arg value="-p" />
166        </exec>
167        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
168            <arg value="./bundle-messages.sh" />
169            <arg value="-p" />
170        </exec>
171        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
172            <arg value="./bundle-messages.sh" />
173            <arg value="-p" />
174        </exec>
175    </target>
176
177    <target name="standalone" depends="standalone_prep">
178        <zip destfile="i2psnark-standalone.zip">
179          <zipfileset dir="./dist/" prefix="i2psnark/" />
180        </zip>
181    </target>
182    <target name="standalone_prep" depends="war">
183        <delete dir="./dist" />
184        <mkdir dir="./dist" />
185        <copy file="../launch-i2psnark" todir="./dist/" />
186        <mkdir dir="./dist/webapps" />
187        <copy file="../i2psnark.war" tofile="./dist/webapps/i2psnark.war" />
188        <mkdir dir="./dist/lib" />
189        <copy file="./build/i2psnark.jar" tofile="./dist/lib/i2psnark.jar" />
190        <copy file="../../../core/java/build/i2p.jar" tofile="./dist/lib/i2p.jar" />
191        <copy file="../../jetty/jettylib/commons-el.jar" tofile="./dist/lib/commons-el.jar" />
192        <copy file="../../jetty/jettylib/commons-logging.jar" tofile="./dist/lib/commons-logging.jar" />
193        <copy file="../../jetty/jettylib/javax.servlet.jar" tofile="./dist/lib/javax.servlet.jar" />
194        <copy file="../../jetty/jettylib/org.mortbay.jetty.jar" tofile="./dist/lib/org.mortbay.jetty.jar" />
195        <copy file="../../jetty/jettylib/jasper-runtime.jar" tofile="./dist/lib/jasper-runtime.jar" />
196        <copy file="../../ministreaming/java/build/mstreaming.jar" tofile="./dist/lib/mstreaming.jar" />
197        <copy file="../../streaming/java/build/streaming.jar" tofile="./dist/lib/streaming.jar" />
198        <copy file="../jetty-i2psnark.xml" tofile="./dist/jetty-i2psnark.xml" />
199        <copy file="../readme-standalone.txt" tofile="./dist/readme.txt" />
200        <mkdir dir="./dist/logs" />
201
202        <zip destfile="i2psnark-standalone.zip">
203         <zipfileset dir="./dist/" prefix="i2psnark/" />
204        </zip>
205    </target>
206
207    <target name="clean">
208        <delete dir="./build" />
209        <delete file="../i2psnark.war" />
210        <delete file="./i2psnark-standalone.zip" />
211        <delete dir="./dist" />
212    </target>
213    <target name="cleandep" depends="clean">
214    </target>
215    <target name="distclean" depends="clean">
216    </target>
217</project>
Note: See TracBrowser for help on using the repository browser.