forked from jasta/five-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
211 lines (182 loc) · 6.91 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<project name="five-server" default="dist" basedir=".">
<description>
Server component for the Five media system.
</description>
<!-- set global properties for this build -->
<property name="src" location="src/main/java"/>
<property name="src.tests" location="src/test/java"/>
<property name="res" location="src/main/resources" />
<property name="etc" location="etc"/>
<property name="build" location="build" />
<property name="build.classes" location="${build}/classes"/>
<property name="build.tests" location="${build}/test-classes" />
<property name="dist" location="dist"/>
<property name="gen" location="gen"/>
<property name="gen.src" location="${gen}/src/java"/>
<property name="gen.res" location="${gen}/resources"/>
<property name="libs" location="libs"/>
<property name="data" location="data"/>
<property name="reports.tests" location="test-reports" />
<property name="protoc" value="protoc"/>
<path id="compile.classpath">
<fileset dir="${libs}">
<include name="*.jar" />
</fileset>
<!-- For compilation, we can use any of the swt flavours
we want. So, let's pick the least popular one to prove
that point ;) -->
<pathelement location="${libs}/swt-3.5.1/win32-win32-x86/swt.jar" />
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.classes}"/>
<mkdir dir="${build.tests}"/>
<mkdir dir="${gen.src}"/>
<mkdir dir="${gen.res}"/>
</target>
<target name="testinit">
<mkdir dir="${reports.tests}" />
</target>
<target name="build-props" depends="init">
<mkdir dir="${gen.res}/org/devtcg/five" />
<echo file="${gen.res}/org/devtcg/five/version.prop" append="false">${DSTAMP}</echo>
</target>
<target name="-checkprotoc">
<uptodate property="protoc.notRequired">
<srcfiles dir="${data}" includes="**/*.proto" />
<mapper type="glob" from="*.proto" to="${gen.src}/*.java" />
</uptodate>
</target>
<target name="protoc" unless="protoc.notRequired" depends="-checkprotoc, init">
<echo>Compiling protobufs into Java classes...</echo>
<apply executable="${protoc}" failonerror="true">
<arg value="--java_out=${gen.src}" />
<arg value="-I${data}" />
<fileset dir="${data}">
<include name="**/*.proto" />
</fileset>
</apply>
</target>
<target name="compile" depends="init, build-props, protoc" description="compile the source">
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}:${gen.src}" destdir="${build.classes}"
debug="true" debuglevel="lines,vars,source">
<classpath refid="compile.classpath" />
</javac>
</target>
<target name="compile.tests" depends="compile" description="compile unit tests">
<javac srcdir="${src.tests}" destdir="${build.tests}"
debug="true" debuglevel="lines,vars,source">
<classpath>
<path refid="compile.classpath" />
<pathelement location="${build.classes}" />
</classpath>
</javac>
</target>
<target name="test" depends="testinit, compile.tests" description="run all unit tests">
<junit printsummary="yes" fork="yes" haltonfailure="no">
<formatter type="plain" />
<classpath>
<path refid="compile.classpath" />
<pathelement location="${build.classes}" />
<pathelement location="${build.tests}" />
</classpath>
<batchtest todir="${reports.tests}">
<fileset dir="${src.tests}">
<include name="**/*Test*.java" />
<exclude name="**/AllTests.java" />
</fileset>
</batchtest>
</junit>
</target>
<!-- Determine the default target platform. Not used if dist-* is invoked
directly from the command-line. -->
<target name="guess-target">
<condition property="target.win32">
<os family="windows" />
</condition>
<condition property="target.macosx">
<and>
<os family="mac" />
<os family="unix" />
</and>
</condition>
<condition property="target.linux">
<os family="unix" name="Linux" />
</condition>
<fail message="Unknown platform, the dist target is not currently supported here. Please consider sending patches!">
<condition>
<not>
<or>
<isset property="target.win32" />
<isset property="target.macosx" />
<isset property="target.linux" />
</or>
</not>
</condition>
</fail>
</target>
<!-- Meta target to figure out which actual platform distribution to
make. -->
<target name="dist" depends="-maybe-dist-win32,-maybe-dist-macosx,-maybe-dist-linux" description="generate the distribution for the current platform" />
<target name="-maybe-dist-win32" depends="guess-target" if="target.win32">
<antcall target="dist-win32" />
</target>
<target name="-maybe-dist-macosx" depends="guess-target" if="target.macosx">
<antcall target="dist-macosx" />
</target>
<target name="-maybe-dist-linux" depends="guess-target" if="target.linux">
<antcall target="dist-linux" />
</target>
<target name="-dist" depends="dist-clean, compile">
<!-- Create the distribution directories -->
<mkdir dir="${dist}/main" />
<mkdir dir="${dist}/libs" />
<copy todir="${dist}/libs" flatten="true">
<fileset dir="${libs}">
<include name="*.jar" />
</fileset>
</copy>
<jar jarfile="${dist}/main/five-server.jar">
<fileset dir="${build.classes}" />
<fileset dir="${res}" />
<fileset dir="${gen.res}" />
<manifest>
<attribute name="Main-Class" value="org.devtcg.five.Main" />
<attribute name="Built-Date" value="${TODAY}" />
<attribute name="Built-By" value="${user.name}" />
</manifest>
</jar>
</target>
<target name="dist-linux" depends="-dist" description="generate the distribution for Linux (x86, x86_64)">
<copy tofile="${dist}/libs/x86/swt.jar" file="${libs}/swt-3.5.1/gtk-linux-x86/swt.jar" />
<copy tofile="${dist}/libs/x86_64/swt.jar" file="${libs}/swt-3.5.1/gtk-linux-x86_64/swt.jar" />
<exec executable="cp" failonerror="true">
<arg value="${etc}/five-server.sh" />
<arg value="${dist}/five-server" />
</exec>
</target>
<target name="dist-win32" depends="-dist" description="generate the distribution for Windows (x86)">
<copy tofile="${dist}/libs/x86/swt.jar" file="${libs}/swt-3.5.1/win32-win32-x86/swt.jar" />
</target>
<target name="dist-macosx" depends="-dist" description="generate the distribution for Mac OS X (x86, ppc, x86_64)">
<copy tofile="${dist}/libs/x86/swt.jar" file="${libs}/swt-3.5.1/cocoa-macosx/swt.jar" />
<copy tofile="${dist}/libs/ppc/swt.jar" file="${libs}/swt-3.5.1/cocoa-macosx/swt.jar" />
<copy tofile="${dist}/libs/x86_64/swt.jar" file="${libs}/swt-3.5.1/cocoa-macosx-x86_64/swt.jar" />
<exec executable="cp" failonerror="true">
<arg value="${etc}/five-server.sh" />
<arg value="${dist}/five-server" />
</exec>
</target>
<target name="dist-clean">
<delete dir="${dist}"/>
</target>
<target name="clean" depends="dist-clean" description="clean up" >
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="${gen}" />
<delete dir="${reports.tests}" />
</target>
</project>