-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommon.xml
More file actions
314 lines (270 loc) · 13.1 KB
/
Copy pathcommon.xml
File metadata and controls
314 lines (270 loc) · 13.1 KB
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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<?xml version="1.0" encoding="UTF-8"?>
<project name="avatar-js-libs" basedir=".">
<target name="common-init">
<property file="${user.home}/.avatar-js.properties"/>
<property name="javac.debug" value="true"/>
<property name="javac.debuglevel" value="lines"/>
<property name="common.dir" location="${basedir}/.."/>
<property name="common.lib.dir" value="${common.dir}/lib"/>
<property name="common.dist.dir" value="${common.dir}/dist"/>
<property name="classes.dir" location="classes"/>
<property name="dist.dir" location="dist"/>
<property name="test.classes.dir" location="test-classes"/>
<property name="test.reports.dir" location="test-reports"/>
<property name="test.output.dir" location="test-output"/>
<condition property="isMacOSX">
<and>
<os family="unix"/>
<os family="mac"/>
</and>
</condition>
<condition property="isLinux">
<and>
<os family="unix"/>
<not>
<os family="mac"/>
</not>
</and>
</condition>
<condition property="isUnix">
<and>
<os family="unix"/>
<not>
<os family="windows"/>
</not>
</and>
</condition>
<condition property="isWindows">
<and>
<os family="windows"/>
<not>
<os family="unix"/>
</not>
</and>
</condition>
<!-- workaround for ant setting java.home to the jdk's jre -->
<condition property="is.jre">
<matches string="${java.home}" pattern="[/|\\]jre$"/>
</condition>
<condition property="jdk.home" value="${java.home}/..">
<isset property="is.jre"/>
</condition>
<condition property="jdk.home" value="${java.home}">
<not>
<isset property="is.jre"/>
</not>
</condition>
<condition property="isRelease">
<matches string="${build.type}" pattern="Release"/>
</condition>
<taskdef name="testng" classname="org.testng.TestNGAntTask">
<classpath location="${testng.jar}"/>
</taskdef>
<tstamp/>
</target>
<target name="init-linux" depends="init" if="isLinux">
<property name="product.lib" value="${dist.dir}/${product.name}.so"/>
</target>
<target name="init-macos" depends="init" if="isMacOSX">
<property name="product.lib" value="${dist.dir}/${product.name}.dylib"/>
</target>
<target name="init-windows" depends="init" if="isWindows">
<property name="product.lib" value="${dist.dir}/${product.name}.dll"/>
</target>
<target name="config-gyp">
<property name="gypi" value="config.gypi"/>
<echo file="${gypi}" append="false"># Do not edit. Generated by 'ant configure'. ${line.separator}</echo>
<echo file="${gypi}" append="true">{ 'variables': { ${line.separator}</echo>
<echo file="${gypi}" append="true"> 'JAVA_HOME%': '${jdk.home}', ${line.separator}</echo>
<echo file="${gypi}" append="true"> 'SOURCE_HOME%': '${source.home}', ${line.separator}</echo>
<echo file="${gypi}" append="true"> 'LIBUV_JAVA_HOME%': '${libuv.home}', ${line.separator}</echo>
<echo file="${gypi}" append="true"> 'HTTP_PARSER_JAVA_HOME%': '${http-parser.home}', ${line.separator}</echo>
<echo file="${gypi}" append="true"> 'AVATAR_JS_HOME%': '${avatar-js.home}', ${line.separator}</echo>
<echo file="${gypi}" append="true"> },${line.separator}</echo>
<echo file="${gypi}" append="true"> 'target_defaults': {'default_configuration': '${build.type}'}${line.separator}</echo>
<echo file="${gypi}" append="true">}${line.separator}</echo>
</target>
<macrodef name="gyp">
<attribute name="format"/>
<attribute name="library"/>
<attribute name="target"/>
<sequential>
<exec executable="python" dir="." failonerror="true">
<arg value="${source.home}/tools/gyp/gyp_main.py"/>
<arg value="--depth=."/>
<arg value="--format=@{format}"/>
<arg value="-Dtarget_arch=x64"/>
<arg value="-Dlibrary=@{library}"/>
<arg value="-Dtarget=@{target}"/>
<arg value="${product.name}.gyp"/>
</exec>
</sequential>
</macrodef>
<target name="configure" depends="init-linux, init-macos, init-windows, configure-unix, configure-mac, configure-windows">
<copy todir="${native.build.dir}">
<fileset dir="src/main/native" includes="**/*.cpp"/>
<fileset dir="src/main/native" includes="**/*.h"/>
</copy>
<uptodate property="product.lib.uptodate" targetfile="${product.lib}">
<srcfiles dir="${native.build.dir}" includes="**/*.h"/>
<srcfiles dir="${native.build.dir}" includes="**/*.cpp"/>
</uptodate>
</target>
<target name="compile" depends="init">
<mkdir dir="${classes.dir}"/>
<javac includeantruntime="false" debug="${javac.debug}" destdir="${classes.dir}" srcdir="${src.java.dir}">
<compilerarg value="-Xlint:all"/>
<compilerarg value="-deprecation"/>
<compilerarg value="-Werror"/>
<classpath refid="javac.classpath.id"/>
</javac>
</target>
<target name="make" depends="configure, compile, javah, make-linux, make-macos, make-windows"
description="runs make to build native sources">
<mkdir dir="${dist.dir}"/>
</target>
<target name="make-linux" if="isLinux" unless="product.lib.uptodate">
<exec executable="make" failonerror="true">
<arg value="builddir_name=out"/>
</exec>
</target>
<target name="make-macos" if="isMacOSX" unless="product.lib.uptodate">
<exec executable="make" failonerror="true"/>
</target>
<target name="make-windows" if="isWindows" unless="product.lib.uptodate">
<exec executable="msbuild" failonerror="true">
<arg value="${product.name}.sln"/>
<arg value="/p:outdir=out/${build.type}/"/>
<arg value="/p:Platform=x64"/>
<arg value="/p:Configuration=${build.type}"/>
</exec>
</target>
<target name="shlib-linux" depends="init" if="isLinux">
<fileset dir="${basedir}/out/${source.home}" id="libuv" includes="**/*.o" excludes="**/test/*" erroronmissingdir="false"/>
<pathconvert property="libuv.objs" refid="libuv" pathsep=" " />
<fileset dir="${libuv.home}/out/${build.type}" id="libuv-java" includes="**/*.o" excludes="**/test/*" erroronmissingdir="false"/>
<pathconvert property="libuv-java.objs" refid="libuv-java" pathsep=" "/>
<fileset dir="${http-parser.home}/out/${build.type}" id="http-parser-java" includes="**/*.o" erroronmissingdir="false"/>
<pathconvert property="http-parser-java.objs" refid="http-parser-java" pathsep=" " />
<fileset dir="${avatar-js.home}/out/${build.type}" id="avatar-js" includes="**/*.o" erroronmissingdir="false"/>
<pathconvert property="avatar-js.objs" refid="avatar-js" pathsep=" " />
<exec executable="gcc" dir="${dist.dir}" failonerror="true">
<arg value="-shared"/>
<arg value="-o"/>
<arg value="libavatar-js.so"/>
<arg line="${libuv.objs}"/>
<arg line="${libuv-java.objs}"/>
<arg line="${http-parser-java.objs}"/>
<arg line="${avatar-js.objs}"/>
<arg value="-lm"/>
<arg value="-ldl"/>
<arg value="-lrt"/>
<arg value="-pthread"/>
<arg value="-lstdc++"/>
</exec>
</target>
<target name="shlib-macos" depends="init" if="isMacOSX">
<fileset dir="${libuv.home}/out/${build.type}" id="libuv-java" includes="**/*.o" excludes="**/test/*" erroronmissingdir="false"/>
<pathconvert property="libuv-java.objs" refid="libuv-java" pathsep=" "/>
<fileset dir="${http-parser.home}/out/${build.type}" id="http-parser-java" includes="**/*.o" erroronmissingdir="false"/>
<pathconvert property="http-parser-java.objs" refid="http-parser-java" pathsep=" " />
<fileset dir="${avatar-js.home}/out/${build.type}" id="avatar-js" includes="**/*.o" erroronmissingdir="false"/>
<pathconvert property="avatar-js.objs" refid="avatar-js" pathsep=" " />
<exec executable="c++" dir="${dist.dir}" failonerror="true">
<arg value="-shared"/>
<arg value="-o"/>
<arg value="libavatar-js.dylib"/>
<arg line="${libuv-java.objs}"/>
<arg line="${http-parser-java.objs}"/>
<arg line="${avatar-js.objs}"/>
<arg value="-lm"/>
<arg value="-framework"/>
<arg value="Foundation"/>
<arg value="-framework"/>
<arg value="CoreServices"/>
<arg value="-framework"/>
<arg value="ApplicationServices"/>
</exec>
</target>
<target name="shlib-windows" depends="init" if="isWindows">
<fileset dir="${source.home}/deps/uv/${build.type}" id="libuv" includes="**/*.obj" excludes="**/test/*" erroronmissingdir="false"/>
<pathconvert property="libuv.objs" refid="libuv" pathsep=" " />
<fileset dir="${libuv.home}/out/${build.type}" id="libuv-java" includes="**/*.obj" erroronmissingdir="false"/>
<pathconvert property="libuv-java.objs" refid="libuv-java" pathsep=" " />
<fileset dir="${http-parser.home}/out/${build.type}" id="http-parser-java" includes="**/*.obj" erroronmissingdir="false"/>
<pathconvert property="http-parser-java.objs" refid="http-parser-java" pathsep=" " />
<fileset dir="${avatar-js.home}/out/${build.type}" id="avatar-js" includes="**/*.obj" erroronmissingdir="false"/>
<pathconvert property="avatar-js.objs" refid="avatar-js" pathsep=" " />
<condition property="release.arg1" value="/LTCG" else="">
<istrue value="${isRelease}"/>
</condition>
<condition property="release.arg2" value="msvcrt.lib" else="">
<istrue value="${isRelease}"/>
</condition>
<exec executable="link.exe" dir="${dist.dir}" failonerror="true">
<arg value="/NODEFAULTLIB:msvcrt"/>
<arg value="/OUT:avatar-js.dll"/>
<arg value="/DLL"/>
<arg value="${release.arg1}"/>
<arg value="${release.arg2}"/>
<arg value="advapi32.lib"/>
<arg value="iphlpapi.lib"/>
<arg value="psapi.lib"/>
<arg value="shell32.lib"/>
<arg value="ws2_32.lib"/>
<arg line="${libuv.objs}"/>
<arg line="${libuv-java.objs}"/>
<arg line="${http-parser-java.objs}"/>
<arg line="${avatar-js.objs}"/>
</exec>
</target>
<target name="clean" depends="init" description="clean output dirs">
<delete dir="out"/>
<delete dir="${classes.dir}"/>
<delete dir="${test.classes.dir}"/>
<delete dir="${test.reports.dir}"/>
<delete dir="${test.output.dir}"/>
<delete dir="${dist.dir}"/>
<delete dir="${build.type}"/>
<delete dir="Debug"/>
<delete dir="Default"/>
<delete dir="Release"/>
<delete dir="test/tmp"/>
<delete file="config.gypi"/>
<delete file="Makefile"/>
<delete file="${product.name}.Makefile"/>
<delete file="${product.name}.target.mk"/>
<delete file="${product.name}.sln"/>
<delete file="${product.name}.vcxproj"/>
<delete file="${product.name}.vcxproj.filters"/>
<delete file="gyp-mac-tool"/>
<delete>
<fileset dir="." includes="test*.txt"/>
<fileset dir="." includes="*.log"/>
</delete>
</target>
<target name="test" depends="compile-tests">
<testng outputdir="${test.reports.dir}" useDefaultListeners="true"
listener="org.testng.reporters.XMLReporter">
<classfileset dir="${test.classes.dir}" includes="**/*Test.class"/>
<classpath path="${classes.dir}"/>
<classpath path="${test.classes.dir}"/>
<classpath refid="javac.test.classpath.id"/>
<jvmarg value="-Xverify:all"/>
<jvmarg value="-Xcheck:jni"/>
<jvmarg value="-Xmx1g"/>
<sysproperty key="java.library.path" value="${dist.dir}"/>
</testng>
</target>
<target name="compile-tests" depends="jar">
<mkdir dir="${test.classes.dir}"/>
<javac includeantruntime="false" debug="true" destdir="${test.classes.dir}" srcdir="${test.java.dir}">
<classpath path="${classes.dir}"/>
<classpath path="${testng.jar}"/>
<classpath refid="javac.test.classpath.id"/>
</javac>
<copy todir="${test.classes.dir}" failonerror="false">
<fileset dir="${test.java.dir}/../js"/>
</copy>
</target>
</project>