source: apps/sam/java/build.xml @ 7ae1483

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

Fixes for building with libgetopt-java

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