aboutsummaryrefslogtreecommitdiffstats
path: root/build.xml
blob: 67eaee9ba6de490e9a786e4b1479be4ba736521e (plain)
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
<?xml version="1.0"?>

<project name="Sun Games Initiative Client Technologies" basedir="." default="all">
    <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>

	<macrodef name="iterate">
		<attribute name="target"/>
		<sequential>
			<subant target="@{target}">
				<fileset file="coreAPI/build.xml"/>
				<fileset file="plugins/linux/build.xml"/>
				<fileset file="plugins/windows/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="dist" depends="init" description="Build the distribution file for this system">
		<iterate target="all"/>
        <mkdir dir="dist"/>
		<jar jarfile="dist/jinput.jar" compress="true">
			<fileset dir="coreAPI/classes">
				<include name="**/*.class"/>
				<exclude name="**/test/*.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>
			<zipfileset src="lib/jutils.jar" includes="**/*.class"/>
		</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"/>
		</copy>
    </target>
	
	<target name="simple_dist" depends="dist,simple_windows,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"/>
		</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"/>
		</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_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"/>
		</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>
</project>