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

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