source: apps/sam/java/build.xml @ 28ba788

Last change on this file since 28ba788 was cadedeb0, checked in by zzz <zzz@…>, 9 years ago
  • Build: Add built-by to jars; check for corrupt jars on debug page
  • Property mode set to 100644
File size: 5.8 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<project basedir="." default="all" name="sam">
3    <target name="all" depends="clean, build" />
4    <target name="build" depends="builddep, jar" />
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="../../streaming/java/build/obj" />
21            </classpath>
22        </depend>
23    </target>
24
25    <property name="javac.compilerargs" value="" />
26
27    <!-- compile everything including client classes -->
28    <target name="compile" depends="depend">
29        <mkdir dir="./build" />
30        <mkdir dir="./build/obj" />
31        <javac 
32            srcdir="./src" 
33            debug="true" deprecation="on" source="1.5" target="1.5" 
34            includeAntRuntime="false"
35            destdir="./build/obj" 
36            classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar:../../streaming/java/build/streaming.jar" >
37            <compilerarg line="${javac.compilerargs}" />
38        </javac>
39    </target>
40
41    <target name="compileTest" depends="compile">
42        <javac 
43            srcdir="./test" 
44            debug="true" deprecation="on" source="1.5" target="1.5" 
45            includeAntRuntime="false"
46            destdir="./build/obj" 
47            classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar:../../streaming/java/build/streaming.jar" >
48            <compilerarg line="${javac.compilerargs}" />
49        </javac>
50    </target>
51
52    <target name="listChangedFiles" depends="jarUpToDate" if="shouldListChanges" >
53        <exec executable="mtn" outputproperty="workspace.changes" errorproperty="mtn.error2" failifexecutionfails="false" >
54            <arg value="list" />
55            <arg value="changed" />
56            <arg value="." />
57        </exec>
58        <!-- \n in an attribute value generates an invalid manifest -->
59        <exec executable="tr" inputstring="${workspace.changes}" outputproperty="workspace.changes.tr" errorproperty="mtn.error2" failifexecutionfails="false" >
60            <arg value="-s" />
61            <arg value="[:space:]" />
62            <arg value="," />
63        </exec>
64    </target>
65
66    <!-- does not include client classes, moved to samclient.jar -->
67    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
68        <!-- set if unset -->
69        <property name="workspace.changes.tr" value="" />
70        <jar destfile="./build/sam.jar" basedir="./build/obj" includes="**/*.class" excludes="net/i2p/sam/client/*">
71            <manifest>
72                <attribute name="Main-Class" value="net.i2p.sam.SAMBridge" />
73                <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
74                <attribute name="Implementation-Version" value="${full.version}" />
75                <attribute name="Built-By" value="${build.built-by}" />
76                <attribute name="Build-Date" value="${build.timestamp}" />
77                <attribute name="Base-Revision" value="${workspace.version}" />
78                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
79            </manifest>
80        </jar>
81    </target>
82
83    <target name="clientjar" depends="compile, listChangedFiles" >
84        <!-- set if unset -->
85        <property name="workspace.changes.tr" value="" />
86        <jar destfile="./build/samclient.jar" basedir="./build/obj" includes="net/i2p/sam/client/*.class">
87            <manifest>
88                <attribute name="Main-Class" value="net.i2p.sam.SAMBridge" />
89                <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
90                <attribute name="Implementation-Version" value="${full.version}" />
91                <attribute name="Built-By" value="${build.built-by}" />
92                <attribute name="Build-Date" value="${build.timestamp}" />
93                <attribute name="Base-Revision" value="${workspace.version}" />
94                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
95            </manifest>
96        </jar>
97    </target>
98
99    <target name="jarUpToDate">
100        <uptodate property="jar.uptodate" targetfile="build/sam.jar" >
101            <srcfiles dir= "build/obj" includes="**/*.class" />
102        </uptodate>
103        <condition property="shouldListChanges" >
104            <and>
105                <not>
106                    <isset property="jar.uptodate" />
107                </not>
108                <isset property="mtn.available" />
109            </and>
110        </condition>
111    </target>
112
113    <target name="jarTest" depends="jar, compileTest">
114        <jar destfile="./build/sam.jar" basedir="./build/obj" includes="**/*Test*.class" update="true" />
115    </target>
116    <target name="javadoc">
117        <mkdir dir="./build" />
118        <mkdir dir="./build/javadoc" />
119        <javadoc 
120            sourcepath="./src:../../../core/java/src:../../ministreaming/java/src:../../streaming/java/src" destdir="./build/javadoc" 
121            packagenames="*" 
122            use="true" 
123            splitindex="true" 
124            windowtitle="SAMBridge" />
125    </target>
126    <target name="clean">
127        <delete dir="./build" />
128    </target>
129    <target name="cleandep" depends="clean">
130    </target>
131    <target name="distclean" depends="clean">
132    </target>
133</project>
Note: See TracBrowser for help on using the repository browser.