-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
45 lines (40 loc) · 1.73 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
<project name="ArcherGame" default="jarfile">
<!-- Initialise build properties -->
<target name="init" description="Initialises properties">
<property name="project.name" value="ArcherGame" />
<property name="src.dir" value="src" />
<property name="main.class" value="ArcherGame/Main.java" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="ArcherGame/build/classes" />
<property name="lib.dir" value="lib" />
<path id="classpath">
<fileset dir="lib" includes="**/*.jar" />
</path>
</target>
<!-- Creates the build directories to hold JAR and Class files -->
<target name="prepare" description="Creates the build and classes directories" depends="init">
<mkdir dir="ArcherGame/build/classes" />
</target>
<!-- Removes the build directory -->
<target name="clean" description="Clean up project" depends="init">
<delete dir="ArcherGame/build" />
</target>
<!-- Compiles the source code -->
<target name="compile" description="Compiles the source code" depends="prepare">
<javac srcdir="${src.dir}" destdir="ArcherGame/build/classes">
<classpath>
<fileset dir="lib" includes="**/*.jar" />
</classpath>
</javac>
</target>
<!-- Creates a JAR file -->
<target name="jarfile" description="Archives the code" depends="compile">
<jar destfile="build/ArcherGame.jar" basedir="ArcherGame/build/classes">
<manifest>
<attribute name="Main-Class" value="${main.class}" />
<attribute name="Class-Path" value="${lib.dir}" />
</manifest>
<zipgroupfileset dir="lib" includes="*.jar"/>
</jar> <!-- A <zipgroupfileset> allows for multiple zip files to be merged into the archive -->
</target>
</project>