summaryrefslogtreecommitdiffstats
path: root/build.xml
blob: eb1f47c350efa01d74acce4fcea0529036ccb553 (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
<!-- Buildfile -->
<project name="jake2" default="dist" basedir=".">

	<taskdef name="proguard" classname="proguard.ant.ProGuardTask">
		<classpath>
    		<pathelement location="lib/proguard/proguard.jar"/>
    	</classpath>
	</taskdef>
	
	<!-- properties -->
	<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/linux/jogl.jar"/>
		<pathelement location="lib/joal/linux/joal.jar"/>
	</path>
	
	<!-- 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 libs -->
	<target name="copylibs">
		<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>
		</copy>
		<chmod perm="755">
			<fileset dir="${dist}">
				<include name="*.sh"/>
			</fileset>
		</chmod>
	</target>
	
	<!-- copy resources -->
	<target name="copyres">
		<copy todir="${build}">
			<fileset dir="src">
				<include name="jake2/*.properties"/>
			</fileset>
		</copy>
	</target>
		
	<!-- jar -->
	<target name="jar" depends="compile,copyres">
		<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/linux/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,copylibs">
	</target>
		
	<!-- binary distribution -->
	<target name="bindist" depends="dist">
		<tar destfile="jake2.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.zip">
			<zipfileset dir="${dist}" prefix="Jake2">
				<include name="**"/>
			</zipfileset>
		</zip>
	</target>
	
	<!-- source distribution -->
	<target name="srcdist" >
		<tar destfile="jake2-src.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"/>
			</tarfileset>
		</tar>
		<zip destfile="jake2-src.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"/>
			</zipfileset>
		</zip>
	</target>
	
	<!-- clean -->
	<target name="clean">
		<delete dir="${build}"/>
		<delete dir="${gensrc}"/>
	</target>
	
	<!-- distclean -->
	<target name="distclean" depends="clean">
		<delete dir="${dist}"/>
		<delete>
			<fileset dir=".">
				<include name="*.tar.gz"/>
				<include name="*.zip"/>
			</fileset>
		</delete>
	</target>
</project>