source: apps/i2psnark/java/build.xml @ f35eaaf

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

i2psnark: Add CommandLine? to jar

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