aboutsummaryrefslogtreecommitdiffstats
path: root/build.xml
blob: f1b92dab0d1ca1591303e5369ec0976779c2e1d6 (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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!-- Buildfile -->
<project name="jake2" default="usage" basedir=".">

	<taskdef name="proguard" classname="proguard.ant.ProGuardTask">
		<classpath>
    		<pathelement location="lib/proguard/proguard.jar"/>
    	</classpath>
	</taskdef>
	
	<!-- properties -->
	<property name="version" value="cvs"/> 
	<property name="src" location="src"/>
	<property name="test" location="test"/>
	<property name="build" location="build"/>
	<property name="dist" location="dist"/>

	<!-- different classpaths -->
	<path id="build.class.path">
		<pathelement location="lib/jogl/jogl.jar"/>
		<pathelement location="lib/joal/linux/joal.jar"/>
	</path>
	
	<!-- usage -->
	<target name="usage">
		<echo message="command line arguments for build.sh or build.bat"/>
		<echo message=""/>
		<echo message="bindist      build only binary distribution"/>
		<echo message="srcdist      build only source distribution"/>
		<echo message="all          build source and binary distribution"/>
		<echo message="clean        delete classfiles keep jake2*.tar.gz and jake2*.zip"/>
		<echo message="distclean    delete all generated files"/>
		<echo message="jar          build only dist/lib/jake2.jar"/>
		<echo message=""/>
	</target>

	<!-- initialize directories -->
	<target name="init">
		<mkdir dir="${build}"/>
		<mkdir dir="${dist}/lib"/>
	</target>

	<!-- compile -->
	<target name="compile" depends="init">
		<javac destdir="${build}" optimize="on" debug="off" source="1.4">
			<src path="${src}"/>
			<include name="jake2/**"/>
			<classpath refid="build.class.path"/>
		</javac>
	</target>
		
	<!-- copy files -->
	<target name="copy">
		<copy todir="${dist}/lib">
			<fileset dir="lib/jogl">
				<include name="*.jar"/>
			</fileset>	
		</copy>
		<copy todir="${dist}/lib/linux">
			<fileset dir="lib/jogl/linux">
				<include name="*"/>
			</fileset>
			<fileset dir="lib/joal/linux">
				<include name="*"/>
			</fileset>			
		</copy>
		<copy todir="${dist}/lib/windows">
			<fileset dir="lib/jogl/windows">
				<include name="*"/>
			</fileset>
			<fileset dir="lib/joal/windows">
				<include name="*"/>
			</fileset>			
		</copy>		
		<copy todir="${dist}">
			<fileset dir="scripts">
				<include name="Jake2.*"/>
			</fileset>
			<fileset dir=".">
				<include name="ChangeLog"/>
				<include name="LICENSE"/>
				<include name="README"/>
				<include name="readme.id"/>			
			</fileset>
		</copy>
		<chmod perm="755">
			<fileset dir="${dist}">
				<include name="*.sh"/>
			</fileset>
		</chmod>
		<fixcrlf srcdir="${dist}"
			eol="crlf"
			includes="*.bat"
		/>
		<fixcrlf srcdir="${dist}"
			eol="lf"
			includes="*.sh"
		/> 		
	</target>
		
	<!-- jar -->
	<target name="jar" depends="compile">
		<jar destfile="${dist}/lib/jake.jar" basedir="${build}">
			<include name="jake2/**"/>
		</jar>
		<proguard printseeds="on" printusage="off" outjar="${dist}/lib/jake2.jar"
			defaultpackage="" overloadaggressively="off">
			<injar name="${dist}/lib/jake.jar"/>
			<libraryjar name="lib/jogl/jogl.jar"/>
			<libraryjar name="lib/joal/linux/joal.jar"/>
			<libraryjar name="${java.home}/lib/rt.jar"/>
			<keep access="public" name="jake2.Jake2">
				<method name="main(java.lang.String[])"/>
			</keep>
		</proguard>
		<delete file="${dist}/lib/jake.jar"/>		
	</target>
				
	<!-- everything -->
	<target name="all" depends="bindist,srcdist">
	</target>

	<!-- dist -->
	<target name="dist" depends="jar,copy">
	</target>
		
	<!-- binary distribution -->
	<target name="bindist" depends="dist">
		<tar destfile="jake2-${version}.tar.gz" compression="gzip">
			<tarfileset dir="${dist}" prefix="Jake2" mode="755">
				<include name="*.sh"/>
			</tarfileset>
			<tarfileset dir="${dist}" prefix="Jake2">
				<include name="**"/>
				<exclude name="*.sh"/>
			</tarfileset>
		</tar>
		<zip destfile="jake2-${version}.zip">
			<zipfileset dir="${dist}" prefix="Jake2">
				<include name="**"/>
			</zipfileset>
		</zip>
	</target>
	
	<!-- source distribution -->
	<target name="srcdist">
		<tar destfile="jake2src-${version}.tar.gz" compression="gzip">
			<tarfileset dir="." prefix="Jake2" mode="755">
				<include name="scripts/*.*"/>
				<include name="build.sh"/>
			</tarfileset>
			<tarfileset dir="." prefix="Jake2">
				<include name="src/jake2/**"/>
				<include name="lib/**"/>
				<include name="build.xml"/>
				<include name="build.bat"/>
				<include name="ChangeLog"/>
				<include name="LICENSE"/>
				<include name="README"/>
				<include name="readme.id"/>
			</tarfileset>
		</tar>
		<zip destfile="jake2src-${version}.zip">
			<zipfileset dir="." prefix="Jake2">
				<include name="src/jake2/**"/>
				<include name="scripts/*.*"/>
				<include name="lib/**"/>
				<include name="build.xml"/>
				<include name="build.sh"/>
				<include name="build.bat"/>
				<include name="ChangeLog"/>
				<include name="LICENSE"/>
				<include name="README"/>
				<include name="readme.id"/>				
			</zipfileset>
		</zip>
	</target>
	
	<!-- clean -->
	<target name="clean">
		<delete dir="${build}"/>
	</target>
	
	<!-- distclean -->
	<target name="distclean" depends="clean">
		<delete dir="${dist}"/>
		<delete>
			<fileset dir=".">
				<include name="*.tar.gz"/>
				<include name="*.zip"/>
			</fileset>
		</delete>
	</target>
</project>