source: apps/i2psnark/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: 7.8 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            </classpath>
23        </depend>
24    </target>
25    <property name="javac.compilerargs" value="" />
26    <target name="compile" depends="depend">
27        <mkdir dir="./build" />
28        <mkdir dir="./build/obj" />
29        <javac 
30            srcdir="./src" 
31            debug="true" deprecation="on" source="1.5" target="1.5" 
32            destdir="./build/obj" 
33            includeAntRuntime="false"
34            classpath="../../../core/java/build/i2p.jar:../../jetty/jettylib/org.mortbay.jetty.jar:../../jetty/jettylib/javax.servlet.jar:../../ministreaming/java/build/mstreaming.jar" >
35            <compilerarg line="${javac.compilerargs}" />
36        </javac>
37    </target>
38
39    <target name="jar" depends="builddep, compile, jarUpToDate" unless="jar.uptodate" >
40        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
41            <arg value="list" />
42            <arg value="changed" />
43            <arg value=".." />
44        </exec>
45        <!-- \n in an attribute value generates an invalid manifest -->
46        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
47            <arg value="-s" />
48            <arg value="[:space:]" />
49            <arg value="," />
50        </exec>
51        <jar destfile="./build/i2psnark.jar" basedir="./build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class **/messages_*.class">
52            <manifest>
53                <attribute name="Main-Class" value="org.klomp.snark.Snark" />
54                <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
55                <attribute name="Build-Date" value="${build.timestamp}" />
56                <attribute name="Base-Revision" value="${workspace.version}" />
57                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
58            </manifest>
59        </jar>
60    </target>   
61   
62    <target name="jarUpToDate">
63        <uptodate property="jar.uptodate" targetfile="build/i2psnark.jar" >
64            <srcfiles dir= "build/obj" includes="**/*.class" excludes="**/I2PSnarkServlet*.class **/messages_*.class" />
65        </uptodate>
66    </target>   
67
68    <!-- Ideally we would include
69      -  only include the servlet, everything else is in the jar.
70      -  However, the wrapper.config classpath in existing installs
71      -  does not include i2psnark.jar.
72      -  So we must continue to duplicate everything in the war.
73          <classes dir="./build/obj" includes="**/I2PSnarkServlet*.class" />
74     -->
75    <target name="war" depends="jar, bundle, warUpToDate" unless="war.uptodate" > 
76        <war destfile="../i2psnark.war" webxml="../web.xml" basedir="../" includes="_icons/*" >
77          <!-- include only the web stuff, as of 0.7.12 the router will add i2psnark.jar to the classpath for the war -->
78          <classes dir="./build/obj" includes="**/web/*.class" />
79            <manifest>
80                <attribute name="Build-Date" value="${build.timestamp}" />
81                <attribute name="Base-Revision" value="${workspace.version}" />
82                <attribute name="Workspace-Changes" value="${workspace.changes}" />
83            </manifest>
84        </war>
85    </target>
86   
87    <target name="warUpToDate">
88        <uptodate property="war.uptodate" targetfile="../i2psnark.war" >
89            <srcfiles dir= "." includes="build/obj/org/klomp/snark/web/*.class ../_icons/* ../web.xml" />
90        </uptodate>
91    </target>
92   
93    <target name="bundle" depends="compile">
94        <!-- Update the messages_*.po files.
95             We need to supply the bat file for windows, and then change the fail property to true -->
96        <exec executable="sh" osfamily="unix" failifexecutionfails="true" >
97            <arg value="./bundle-messages.sh" />
98        </exec>
99        <exec executable="sh" osfamily="mac" failifexecutionfails="true" >
100            <arg value="./bundle-messages.sh" />
101        </exec>
102                <!-- multi-lang is optional -->
103        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
104            <arg value="./bundle-messages.sh" />
105        </exec>
106    </target>
107
108    <target name="poupdate" depends="builddep, compile">
109        <!-- Update the messages_*.po files.  -->
110        <exec executable="sh" osfamily="unix" failifexecutionfails="true" >
111            <arg value="./bundle-messages.sh" />
112            <arg value="-p" />
113        </exec>
114        <exec executable="sh" osfamily="mac" failifexecutionfails="true" >
115            <arg value="./bundle-messages.sh" />
116            <arg value="-p" />
117        </exec>
118        <exec executable="sh" osfamily="windows" failifexecutionfails="true" >
119            <arg value="./bundle-messages.sh" />
120            <arg value="-p" />
121        </exec>
122    </target>
123
124    <target name="standalone" depends="standalone_prep">
125        <zip destfile="i2psnark-standalone.zip">
126          <zipfileset dir="./dist/" prefix="i2psnark/" />
127        </zip>
128    </target>
129    <target name="standalone_prep" depends="war">
130        <delete dir="./dist" />
131        <mkdir dir="./dist" />
132        <copy file="../launch-i2psnark" todir="./dist/" />
133        <mkdir dir="./dist/webapps" />
134        <copy file="../i2psnark.war" tofile="./dist/webapps/i2psnark.war" />
135        <mkdir dir="./dist/lib" />
136        <copy file="./build/i2psnark.jar" tofile="./dist/lib/i2psnark.jar" />
137        <copy file="../../../core/java/build/i2p.jar" tofile="./dist/lib/i2p.jar" />
138        <copy file="../../jetty/jettylib/commons-el.jar" tofile="./dist/lib/commons-el.jar" />
139        <copy file="../../jetty/jettylib/commons-logging.jar" tofile="./dist/lib/commons-logging.jar" />
140        <copy file="../../jetty/jettylib/javax.servlet.jar" tofile="./dist/lib/javax.servlet.jar" />
141        <copy file="../../jetty/jettylib/org.mortbay.jetty.jar" tofile="./dist/lib/org.mortbay.jetty.jar" />
142        <copy file="../../jetty/jettylib/jasper-compiler.jar" tofile="./dist/lib/jasper-compiler.jar" />
143        <copy file="../../jetty/jettylib/jasper-runtime.jar" tofile="./dist/lib/jasper-runtime.jar" />
144        <copy file="../../ministreaming/java/build/mstreaming.jar" tofile="./dist/lib/mstreaming.jar" />
145        <copy file="../../streaming/java/build/streaming.jar" tofile="./dist/lib/streaming.jar" />
146        <copy file="../jetty-i2psnark.xml" tofile="./dist/jetty-i2psnark.xml" />
147        <copy file="../readme-standalone.txt" tofile="./dist/readme.txt" />
148        <mkdir dir="./dist/logs" />
149
150        <zip destfile="i2psnark-standalone.zip">
151         <zipfileset dir="./dist/" prefix="i2psnark/" />
152        </zip>
153    </target>
154
155    <target name="clean">
156        <delete dir="./build" />
157        <delete file="../i2psnark.war" />
158        <delete file="./i2psnark-standalone.zip" />
159        <delete dir="./dist" />
160    </target>
161    <target name="cleandep" depends="clean">
162    </target>
163    <target name="distclean" depends="clean">
164    </target>
165</project>
Note: See TracBrowser for help on using the repository browser.