-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
114 lines (100 loc) · 3.75 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
<?xml version="1.0" encoding="UTF-8"?>
<project name="routemaster" default="help">
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="src.dir" value="src/main/java" />
<property name="src.html.dir" value="src/main/html" />
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<target name="clean">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<path id="classpath">
<fileset dir="lib/runtime">
<include name="*.jar"/>
</fileset>
</path>
<target name="compile" depends="clean,init" description="compile the code">
<javac srcdir="${src.dir}" destdir="${build.dir}" debug="on" includeantruntime="false" compiler="javac1.6" classpathref="classpath">
<include name="**/*.java" />
<exclude name="fi/iki/elonen/InternalRewrite.java" />
<exclude name="fi/iki/elonen/*WebServer*.java" />
</javac>
</target>
<!--
Build all of the distributables:
- routemaster with and without templar
- example with and without templar
-->
<target name="dist" depends="clean,init,dist-routemaster,dist-routemaster-templar,dist-example" description="build the example, all in one and standalone binary distributable" />
<!--
Build the routemaster jar without templar
-->
<target name="dist-routemaster" depends="clean,init,compile" description="build the standalone binary distributable">
<jar destfile="${dist.dir}/${ant.project.name}.jar" manifest="src/main/META-INF/manifest.mf">
<fileset dir="${build.dir}">
<include name="**/*.class" />
<exclude name="**/*TemplarServant.class" />
</fileset>
<fileset dir="${src.dir}">
<include name="**/*.example.properties" />
</fileset>
</jar>
</target>
<!--
Build the routemaster jar with templar
-->
<target name="dist-routemaster-templar" depends="clean,init,compile" description="build the standalone binary distributable">
<copy file="${src.dir}/routemaster.example.templar.properties" tofile="${build.dir}/routemaster.example.properties" />
<jar destfile="${dist.dir}/${ant.project.name}-templar.jar" manifest="src/main/META-INF/manifest.mf">
<fileset dir="${build.dir}">
<include name="**/*.class" />
<include name="**/routemaster.example.properties" />
</fileset>
<fileset dir="${src.dir}">
<include name="**/mimetypes.example.properties" />
</fileset>
<fileset dir="${src.html.dir}">
<include name="**/mimetypes.example.properties" />
</fileset>
<zipgroupfileset dir="lib/runtime" includes="*.jar" />
</jar>
<delete file="${build.dir}/routemaster.example.properties" />
</target>
<target name="dist-example" depends="clean,init,compile" description="build the example zip file">
<!-- Copy over the example templar files -->
<copy file="${src.dir}/routemaster.example.fileservant.properties" tofile="${build.dir}/routemaster.properties" />
<copy file="${src.dir}/mimetypes.example.properties" tofile="${build.dir}/mimetypes.properties" />
<!--
Now zip it all up
-->
<zip destfile="${dist.dir}/${ant.project.name}-example.zip" >
<zipfileset dir="${dist.dir}" prefix="routemaster">
<include name="${ant.project.name}-templar.jar" />
</zipfileset>
<zipfileset dir="${build.dir}" prefix="routemaster">
<include name="mimetypes.properties" />
<include name="routemaster.properties" />
</zipfileset>
<zipfileset dir="${src.html.dir}" prefix="routemaster">
<include name="**/*.*" />
</zipfileset>
</zip>
<!-- delete the files -->
<delete>
<fileset dir="${build.dir}">
<include name="**/*.properties" />
</fileset>
</delete>
</target>
<target name="help" description="hopefully helpful help">
<echo>
type:
ant -p
to see a complete list of ant targets
</echo>
</target>
</project>