-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.xml
99 lines (86 loc) · 3.61 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
<project name="HospitalManager" basedir="." default="main">
<property name="src.dir" value="src" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="jar.dir" value="${build.dir}/jar" />
<property name="main-class" value="hms.HospitalManager" />
<property name="lib.dir" value="lib" />
<property name="test.dir" value="test" />
<property name="conf.dir" value="conf" />
<property name="resource.dir" value="res" />
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar" />
</path>
<path id="application" location="${jar.dir}/${ant.project.name}.jar" />
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="compile">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false" />
<javac srcdir="${test.dir}" destdir="${classes.dir}" classpathref="classpath" includeantruntime="false" />
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" excludes="**/*.java" />
</copy>
<copy todir="${classes.dir}">
<fileset dir="${conf.dir}" />
</copy>
<copy todir="${classes.dir}">
<fileset dir="${resource.dir}" />
</copy>
</target>
<target name="jar" depends="compile">
<pathconvert property="libs.classpath" pathsep=" ">
<mapper>
<chainedmapper>
<!-- remove absolute path -->
<flattenmapper />
<!-- add lib/ prefix -->
<globmapper from="*" to="lib/*" />
</chainedmapper>
</mapper>
<path>
<!-- lib.dir contains all jar files, in several subdirectories -->
<fileset dir="${lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
</pathconvert>
<mkdir dir="${jar.dir}" />
<jar destfile="${jar.dir}/${ant.project.name}.jar" basedir="${classes.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
<attribute name="Class-Path" value="${libs.classpath}" />
</manifest>
</jar>
<mkdir dir="${jar.dir}/lib" />
<copy todir="${jar.dir}/lib" filtering="off">
<flattenmapper />
<fileset dir="${lib.dir}" includes="**/*.jar" />
</copy>
</target>
<target name="run" depends="jar">
<java fork="true" classname="${main-class}">
<!-- Makes Macs close all windows before exiting the application so our window events get handled -->
<sysproperty key="apple.eawt.quitStrategy" value="CLOSE_ALL_WINDOWS" />
<classpath>
<path refid="classpath" />
<path refid="application" />
</classpath>
</java>
</target>
<target name="junit" depends="jar">
<junit printsummary="yes">
<classpath>
<path refid="classpath" />
<path refid="application" />
</classpath>
<batchtest fork="yes">
<fileset dir="${test.dir}" includes="**/*Test.java" />
</batchtest>
<formatter type="brief" usefile="false" />
</junit>
</target>
<target name="clean-build" depends="clean,jar" />
<target name="main" depends="clean,run" />
</project>