-
Notifications
You must be signed in to change notification settings - Fork 8
/
build.xml
380 lines (346 loc) · 12.8 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
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<?xml version="1.0"?>
<project name="Sun Games Initiative Client Technologies" basedir="." default="all" xmlns:artifact="urn:maven-artifact-ant">
<echo message="${os.arch}"/>
<property name="api.version" value="2.0.6"/>
<property name="mvn.version" value="${api.version}-SNAPSHOT"/>
<property name="maven-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<property name="maven-repository-id" value="sonatype-nexus-staging" />
<target name="init">
<!-- If we are running in windows, set dx8 property to true -->
<condition property="windows" >
<os family="windows" />
</condition>
<!-- If we are running in linux, set linux property to true -->
<condition property="linux" >
<!--<os family="unix" />-->
<os name="linux" />
</condition>
<!-- If we are running in Mac OS X, set osx property to true -->
<condition property="osx" >
<and>
<os family="mac" />
<os family="unix" />
</and>
</condition>
</target>
<target name="runtest" depends="dist">
<java classname="${mainclass}"
fork="true" failonerror="true" dir=".">
<classpath>
<pathelement location="dist/jinput.jar"/>
<pathelement location="dist/jinput-test.jar"/>
</classpath>
<jvmarg value="-Djava.library.path=dist"/>
</java>
</target>
<target name="texttest">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.ControllerTextTest"/>
</antcall>
</target>
<target name="readtest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.ControllerReadTest"/>
</antcall>
</target>
<target name="eventtest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.ControllerEventTest"/>
</antcall>
</target>
<target name="rumbletest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.RumbleTest"/>
</antcall>
</target>
<target name="versiontest" depends="init,all" description="Try running it.">
<antcall target="runtest">
<param name="mainclass" value="net.java.games.input.test.VersionTest"/>
</antcall>
</target>
<macrodef name="iterate">
<attribute name="target"/>
<sequential>
<subant target="@{target}">
<property name="api.version" value="${api.version}"/>
<fileset file="coreAPI/build.xml"/>
<fileset file="plugins/linux/build.xml"/>
<fileset file="plugins/windows/build.xml"/>
<fileset file="plugins/wintab/build.xml"/>
<fileset file="plugins/OSX/build.xml"/>
<fileset file="plugins/awt/build.xml"/>
</subant>
</sequential>
</macrodef>
<target name="clean">
<iterate target="clean"/>
<delete dir="dist" failonerror="no"/>
</target>
<target name="all" depends="dist">
</target>
<target name="javadoc" depends="init">
<iterate target="javadoc"/>
</target>
<target name="pluginTest" depends="dist" description="Build plugin version">
<mkdir dir="dist"/>
<mkdir dir="dist/controller"/>
<copy todir="dist">
<fileset file="coreAPI/bin/jinput-core.jar"/>
<fileset file="coreAPI/bin/jinput-test.jar"/>
<fileset file="plugins/DX8/lib/jutils.jar"/>
</copy>
<copy todir="dist/controller">
<fileset dir="plugins/awt/bin"/>
<fileset dir="plugins/linux/bin"/>
<fileset dir="plugins/OSX/bin"/>
<fileset dir="plugins/windows/bin"/>
<fileset dir="plugins/wintab/bin"/>
</copy>
</target>
<target name="dist" depends="init" description="Build the distribution file for this system">
<iterate target="all"/>
<mkdir dir="dist"/>
<jar jarfile="dist/jinput.jar" compress="true" duplicate="preserve">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
<exclude name="**/test/*.class"/>
<exclude name="**/example/*.class"/>
</fileset>
<fileset dir="plugins/linux/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/OSX/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/awt/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/windows/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/wintab/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<copy todir="dist">
<fileset file="coreAPI/bin/jinput-test.jar"/>
<fileset dir="plugins/linux/bin" includes="*so"/>
<fileset dir="plugins/OSX/bin" includes="*jnilib"/>
<fileset dir="plugins/windows/bin" includes="*dll"/>
<fileset dir="plugins/wintab/bin" includes="*dll"/>
</copy>
</target>
<target name="simple_dist" depends="dist,simple_windows,simple_wintab,simple_linux,simple_osx" description="Build the simple jars for each platform"/>
<target name="simple_linux" depends="dist" description="Build the simple linux jar" if="linux">
<jar jarfile="dist/jinput-linux.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/linux/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<tar destfile="dist/jinput_linux.tgz" compression="gzip">
<tarfileset dir=".">
<include name="dist/jinput-linux.jar"/>
</tarfileset>
<tarfileset dir="plugins/linux/bin">
<include name="*.so"/>
</tarfileset>
</tar>
</target>
<target name="simple_windows" depends="dist" description="Build the simple windows jar" if="windows">
<jar jarfile="dist/jinput-windows.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/windows/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<zip destfile="dist/jinput_windows.zip">
<zipfileset dir=".">
<include name="dist/jinput-windows.jar"/>
</zipfileset>
<zipfileset dir="plugins/windows/bin">
<include name="*.dll"/>
</zipfileset>
</zip>
</target>
<target name="simple_wintab" depends="dist" description="Build the simple windows jar" if="windows">
<jar jarfile="dist/jinput-wintab.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/wintab/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<zip destfile="dist/jinput_wintab.zip">
<zipfileset dir=".">
<include name="dist/jinput-wintab.jar"/>
</zipfileset>
<zipfileset dir="plugins/wintab/bin">
<include name="*.dll"/>
</zipfileset>
</zip>
</target>
<target name="simple_osx" depends="dist" description="Build the simple osx jar" if="osx">
<jar jarfile="dist/jinput-osx.jar" compress="true">
<fileset dir="coreAPI/classes">
<include name="**/*.class"/>
</fileset>
<fileset dir="plugins/OSX/classes">
<include name="**/*.class"/>
</fileset>
<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<tar destfile="dist/jinput_osx.tgz" compression="gzip">
<tarfileset dir=".">
<include name="dist/jinput-osx.jar"/>
</tarfileset>
<tarfileset dir="plugins/OSX/bin">
<include name="*.jnilib"/>
</tarfileset>
</tar>
</target>
<target name="install" description="Installs jinput in to local mvn repo">
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.1.0.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"
classpathref="maven-ant-tasks.classpath"/>
<filter token="VERSION" value="${mvn.version}"/>
<copy tofile="dist/jinput-${mvn.version}.pom" filtering="true">
<fileset file="jinput.pom"/>
</copy>
<copy tofile="dist/jinput-${mvn.version}-platform.pom" filtering="true">
<fileset file="jinput-platform.pom"/>
</copy>
<artifact:pom id="jinputpomfile" file="dist/jinput-${mvn.version}.pom" />
<artifact:pom id="jinputplatformpomfile" file="dist/jinput-${mvn.version}-platform.pom" />
<delete file="dist/jinput-natives-windows.zip" />
<zip destfile="dist/jinput-natives-windows.zip">
<fileset dir="dist/">
<include name="**/*.dll"/>
</fileset>
</zip>
<delete file="dist/jinput-natives-linux.zip"/>
<zip destfile="dist/jinput-natives-linux.zip">
<fileset dir="dist/">
<include name="**/*.so"/>
</fileset>
</zip>
<delete file="dist/jinput-natives-osx.zip"/>
<zip destfile="dist/jinput-natives-osx.zip" >
<fileset dir="dist/">
<include name="**/*.jnilib"/>
</fileset>
</zip>
<delete file="dist/jinput-javadoc.zip"/>
<zip destfile="dist/jinput-javadoc.zip">
<fileset dir="coreAPI/apidocs/"/>
</zip>
<delete file="dist/jinput-sources.zip"/>
<zip destfile="dist/jinput-sources.zip">
<fileset dir=".">
<include name="**/*.java"/>
<include name="**/*.h"/>
<include name="**/*.c"/>
</fileset>
</zip>
<zip destfile="dist/jinput-${mvn.version}.jar">
<zipfileset src="dist/jinput.jar">
<exclude name="net/java/games/util/**"/>
</zipfileset>
</zip>
<artifact:install file="dist/jinput-${mvn.version}.jar">
<pom refid="jinputpomfile" />
<attach file="dist/jinput-javadoc.zip" classifier="javadoc" type="jar"/>
<attach file="dist/jinput-sources.zip" classifier="sources" type="jar"/>
</artifact:install>
<artifact:install file="dist/jinput=${mvn.version}-platform.pom">
<pom refid="jinputplatformpomfile" />
<attach file="dist/jinput-natives-windows.zip" classifier="natives-windows" type="jar"/>
<attach file="dist/jinput-natives-linux.zip" classifier="natives-linux" type="jar"/>
<attach file="dist/jinput-natives-osx.zip" classifier="natives-osx" type="jar"/>
</artifact:install>
</target>
<target name="mvndeploy" depends="install" description="Installs jinput in to local mvn repo">
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}.pom" />
<arg value="-Dfile=dist/jinput-${mvn.version}.jar" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}.pom" />
<arg value="-Dfile=dist/jinput-javadoc.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}.pom" />
<arg value="-Dfile=dist/jinput-sources.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}-platform.pom" />
<arg value="-Dfile=dist/jinput-natives-windows.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=natives-windows" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}-platform.pom" />
<arg value="-Dfile=dist/jinput-natives-linux.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=natives-linux" />
<arg value="-Pgpg" />
</artifact:mvn>
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.1:sign-and-deploy-file" />
<arg value="-Durl=${maven-repository-url}" />
<arg value="-DrepositoryId=${maven-repository-id}" />
<arg value="-DpomFile=dist/jinput-${mvn.version}-platform.pom" />
<arg value="-Dfile=dist/jinput-natives-osx.zip" />
<arg value="-Dpackaging=jar"/>
<arg value="-Dclassifier=natives-osx" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
</project>