-
Notifications
You must be signed in to change notification settings - Fork 13
/
build.xml
186 lines (166 loc) · 5.69 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
<!-- vim: set noexpandtab tabstop=4 shiftwidth=4: -->
<project name="XRay" default="dist" basedir=".">
<description>
Minecraft X-Ray
</description>
<!-- Project attributes -->
<property name="version" value="3.6.2"/>
<property name="export_base" value="minecraft_xray_${version}"/>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist_base" location="dist"/>
<property name="dist" location="${dist_base}/${export_base}"/>
<!-- log4j configuration -->
<property name="log4j.properties.path" location="support/log4j.properties" />
<!-- Would be nice if ant's "tar" task understood executable bits -->
<patternset id="all.files">
<include name="${export_base}/**"/>
</patternset>
<selector id="executable.files">
<or>
<filename name="${export_base}/minecraft_xray_osx.command" />
<filename name="${export_base}/minecraft_xray.sh" />
</or>
</selector>
<!-- launch4j, for building the Windows EXE -->
<property name="launch4j.dir" location="support/launch4j-dist" />
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${launch4j.dir}/launch4j.jar:${launch4j.dir}/xstream.jar" />
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}" debug="true" includeantruntime="false">
<compilerarg value="-Xlint:unchecked"/>
<classpath>
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</classpath>
</javac>
</target>
<target name="run" depends="compile"
description="run the application" >
<!-- Run our compiled sourcecode -->
<java fork="true" classname="com.apocalyptech.minecraft.xray.XRay">
<classpath>
<pathelement path="${build}" />
<fileset dir="lib">
<include name="*.jar" />
</fileset>
</classpath>
<jvmarg value="-Xms256m" />
<jvmarg value="-Xmx1024m" />
<sysproperty key="java.library.path" value="lib/native" />
<sysproperty key="log4j.configuration" value="file:${log4j.properties.path}" />
</java>
</target>
<target name="prepare_distdir" depends="compile"
description="prepares the distribution directories for release" >
<!-- Create the distribution directories -->
<mkdir dir="${dist}"/>
<!-- Put everything in ${build} into xray.jar file -->
<jar jarfile="${dist}/xray.jar" basedir="${build}" manifest="META-INF/MANIFEST.MF" />
<!-- Dump all our support libraries, launchers, etc in the distdir -->
<copy todir="${dist}">
<fileset dir="support">
<exclude name="launch4j*" />
<exclude name="launch4j-dist/**" />
</fileset>
<fileset dir=".">
<include name="Changelog.txt" />
<include name="BUILDING.txt" />
<include name="TODO.txt" />
<include name="README.txt" />
<include name="COPYING.txt" />
<include name="COPYING-lwjgl.txt" />
<include name="COPYING-log4j.txt" />
<include name="COPYING-jsmooth.txt" />
<include name="COPYING-launch4j.txt" />
<include name="COPYING-snakeyaml.txt" />
</fileset>
</copy>
<copy todir="${dist}/lib">
<fileset dir="lib" />
</copy>
<copy todir="${dist}/blockdefs">
<fileset dir="blockdefs" />
</copy>
<copy todir="${dist}/textures">
<fileset dir="textures" />
</copy>
<!-- Mark the UNIXy ones as executable -->
<chmod perm="a+x">
<fileset dir="${dist}">
<include name="minecraft_xray_osx.command" />
<include name="minecraft_xray.sh" />
</fileset>
</chmod>
<!-- While we're at it, archive the source dir in there too. -->
<mkdir dir="${dist}/src"/>
<copy todir="${dist}/src">
<fileset dir=".">
<include name="**/*" />
<exclude name="bin/" />
<exclude name="build/" />
<exclude name="dist/" />
<exclude name="lib/" />
<exclude name="textures/" />
<exclude name=".git/" />
<exclude name=".gitignore" />
</fileset>
</copy>
</target>
<target name="launch4j" depends="prepare_distdir">
<launch4j configFile="support/launch4j.xml" />
<move todir="${dist}">
<fileset dir="support">
<include name="minecraft_xray.exe" />
</fileset>
</move>
</target>
<target name="dist" depends="launch4j"
description="generate the distribution" >
<!-- Create our zipfiles, both "binary" and source. -->
<zip destfile="${dist_base}/${export_base}.zip" basedir="${dist_base}" includes="${export_base}/"/>
<tar destfile="${dist_base}/${export_base}.tbz2" compression="bzip2">
<tarfileset dir="${dist_base}" filemode="755">
<patternset refid="all.files" />
<selector refid="executable.files" />
</tarfileset>
<tarfileset dir="${dist_base}">
<patternset refid="all.files" />
<not>
<selector refid="executable.files" />
</not>
</tarfileset>
</tar>
<tar destfile="${dist_base}/${export_base}.tgz" compression="gzip">
<tarfileset dir="${dist_base}" filemode="755">
<patternset refid="all.files" />
<selector refid="executable.files" />
</tarfileset>
<tarfileset dir="${dist_base}">
<patternset refid="all.files" />
<not>
<selector refid="executable.files" />
</not>
</tarfileset>
</tar>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete file="${dist_base}/${export_base}.zip"/>
<delete file="${dist_base}/${export_base}.tbz2"/>
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>