source: apps/sam/java/build.xml @ 868e5e9

Last change on this file since 868e5e9 was c7d68c2, checked in by zzz <zzz@…>, 5 years ago

Require Java 7 for SAM
separate option javac.compilerargs7 for Java 7

  • 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            </classpath>
21        </depend>
22    </target>
23
24    <!-- ignored for now, we require java 7 here -->
25    <property name="javac.compilerargs7" value="" />
26    <!-- ignored for now, we require java 7 here -->
27    <property name="javac.version" value="1.6" />
28
29    <!-- compile everything including client classes -->
30    <target name="compile" depends="depend">
31        <mkdir dir="./build" />
32        <mkdir dir="./build/obj" />
33        <javac 
34            srcdir="./src" 
35            debug="true" deprecation="on" source="1.7" target="1.7" 
36            includeAntRuntime="false"
37            destdir="./build/obj" 
38            classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
39            <compilerarg line="${javac.compilerargs7}" />
40        </javac>
41    </target>
42
43    <target name="compileTest" depends="compile">
44        <javac 
45            srcdir="./test" 
46            debug="true" deprecation="on" source="1.7" target="1.7" 
47            includeAntRuntime="false"
48            destdir="./build/obj" 
49            classpath="../../../core/java/build/i2p.jar:../../ministreaming/java/build/mstreaming.jar" >
50            <compilerarg line="${javac.compilerargs7}" />
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    <!-- does not include client classes, moved to samclient.jar -->
69    <target name="jar" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
70        <!-- set if unset -->
71        <property name="workspace.changes.tr" value="" />
72        <jar destfile="./build/sam.jar" basedir="./build/obj" includes="**/*.class" excludes="net/i2p/sam/client/*">
73            <manifest>
74                <attribute name="Main-Class" value="net.i2p.sam.SAMBridge" />
75                <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
76                <attribute name="Implementation-Version" value="${full.version}" />
77                <attribute name="Built-By" value="${build.built-by}" />
78                <attribute name="Build-Date" value="${build.timestamp}" />
79                <attribute name="Base-Revision" value="${workspace.version}" />
80                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
81            </manifest>
82        </jar>
83    </target>
84
85    <target name="clientjar" depends="compile, listChangedFiles" >
86        <!-- set if unset -->
87        <property name="workspace.changes.tr" value="" />
88        <jar destfile="./build/samclient.jar" basedir="./build/obj" includes="net/i2p/sam/client/*.class">
89            <manifest>
90                <attribute name="Main-Class" value="net.i2p.sam.SAMBridge" />
91                <attribute name="Class-Path" value="i2p.jar mstreaming.jar streaming.jar" />
92                <attribute name="Implementation-Version" value="${full.version}" />
93                <attribute name="Built-By" value="${build.built-by}" />
94                <attribute name="Build-Date" value="${build.timestamp}" />
95                <attribute name="Base-Revision" value="${workspace.version}" />
96                <attribute name="Workspace-Changes" value="${workspace.changes.tr}" />
97            </manifest>
98        </jar>
99    </target>
100
101    <target name="jarUpToDate">
102        <uptodate property="jar.uptodate" targetfile="build/sam.jar" >
103            <srcfiles dir= "build/obj" includes="**/*.class" />
104        </uptodate>
105        <condition property="shouldListChanges" >
106            <and>
107                <not>
108                    <isset property="jar.uptodate" />
109                </not>
110                <isset property="mtn.available" />
111            </and>
112        </condition>
113    </target>
114
115    <target name="jarTest" depends="jar, compileTest">
116        <jar destfile="./build/sam.jar" basedir="./build/obj" includes="**/*Test*.class" update="true" />
117    </target>
118    <target name="javadoc">
119        <mkdir dir="./build" />
120        <mkdir dir="./build/javadoc" />
121        <javadoc 
122            sourcepath="./src:../../../core/java/src:../../ministreaming/java/src:../../streaming/java/src" destdir="./build/javadoc" 
123            packagenames="*" 
124            use="true" 
125            splitindex="true" 
126            windowtitle="SAMBridge" />
127    </target>
128    <target name="clean">
129        <delete dir="./build" />
130    </target>
131    <target name="cleandep" depends="clean">
132    </target>
133    <target name="distclean" depends="clean">
134    </target>
135</project>
Note: See TracBrowser for help on using the repository browser.