-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
168 lines (139 loc) · 5.98 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="build-jar" name="Basic Storage Server">
<property environment="env"/>
<property name="debuglevel" value="source,lines,vars"/>
<property name="target" value="1.7"/>
<property name="source" value="1.7"/>
<property name="build.dir" value="bin"/>
<property name="src.dir" value="src"/>
<property name="lib.dir" value="libs"/>
<!-- Configuration for client application -->
<property name="clientjar.file" value="m2-client.jar"/>
<property name="clientmanifest.file" value="CLIENT_MANIFEST.MF"/>
<property name="clientmain.class" value="app_kvClient.KVClient"/>
<!-- Configuration for server application -->
<property name="serverjar.file" value="m2-server.jar"/>
<property name="servermanifest.file" value="SERVER_MANIFEST.MF"/>
<property name="servermain.class" value="app_kvServer.KVServer"/>
<!-- Configuration for ecs application -->
<property name="ecsjar.file" value="m2-ecs.jar"/>
<property name="ecsmanifest.file" value="ECS_MANIFEST.MF"/>
<property name="ecsmain.class" value="app_kvECS.ECSClient"/>
<!-- Configuration for ecs application -->
<property name="performancejar.file" value="m2-performance.jar"/>
<property name="performancemanifest.file" value="PERFORMANCE_MANIFEST.MF"/>
<property name="performancemain.class" value="performance.PerformanceTester"/>
<!-- path to libraries-->
<path id="external.jars">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<!-- Build path -->
<path id="project.buildpath">
<pathelement location="${src.dir}"/>
<path refid="external.jars" />
</path>
<!-- Class path -->
<path id="project.classpath">
<pathelement location="${build.dir}"/>
<path refid="external.jars" />
</path>
<target name="init">
<mkdir dir="${build.dir}"/>
<copy includeemptydirs="false" todir="${build.dir}">
<fileset dir="${src.dir}">
<exclude name="**/*.launch"/>
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
<delete file="${clientjar.file}" />
<delete file="${clientmanifest.file}" />
<delete file="${serverjar.file}" />
<delete file="${servermanifest.file}" />
</target>
<target name="cleanall" depends="clean"/>
<!-- build complete project -->
<target name="build" depends="init">
<echo message="${ant.project.name}: ${ant.file}"/>
<javac debug="true" debuglevel="${debuglevel}" destdir="bin"
source="${source}" target="${target}"
classpathref="project.classpath" includeantruntime="false">
<src path="${src.dir}"/>
</javac>
</target>
<!-- build client jar -->
<target name="build-client-jar" depends="build">
<delete file="${clientjar.file}" />
<delete file="${clientmanifest.file}" />
<manifest file="${clientmanifest.file}" >
<attribute name="built-by" value="${user.name}" />
<attribute name="Main-Class" value="${clientmain.class}" />
<attribute name="Class-Path" value="${project.classpath}"/>
</manifest>
<jar destfile="${clientjar.file}" basedir="${build.dir}"
manifest="${clientmanifest.file}">
<fileset dir="${build.dir}" includes="**/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
</jar>
</target>
<!-- build server jar -->
<target name="build-server-jar" depends="build">
<delete file="${serverjar.file}" />
<delete file="${servermanifest.file}" />
<manifest file="${servermanifest.file}" >
<attribute name="built-by" value="${user.name}" />
<attribute name="Main-Class" value="${servermain.class}" />
<attribute name="Class-Path" value="${project.classpath}"/>
</manifest>
<jar destfile="${serverjar.file}" basedir="${build.dir}"
manifest="${servermanifest.file}">
<fileset dir="${build.dir}" includes="**/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
</jar>
</target>
<!-- build ecs jar -->
<target name="build-ecs-jar" depends="build">
<delete file="${ecsjar.file}" />
<delete file="${ecsmanifest.file}" />
<manifest file="${ecsmanifest.file}" >
<attribute name="built-by" value="${user.name}" />
<attribute name="Main-Class" value="${ecsmain.class}" />
<attribute name="Class-Path" value="${project.classpath}"/>
</manifest>
<jar destfile="${ecsjar.file}" basedir="${build.dir}"
manifest="${ecsmanifest.file}">
<fileset dir="${build.dir}" includes="**/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
</jar>
</target>
<!-- build performance jar -->
<target name="build-performance-jar" depends="build">
<delete file="${performancejar.file}" />
<delete file="${performancemanifest.file}" />
<manifest file="${performancemanifest.file}" >
<attribute name="built-by" value="${user.name}" />
<attribute name="Main-Class" value="${performancemain.class}" />
<attribute name="Class-Path" value="${project.classpath}"/>
</manifest>
<jar destfile="${performancejar.file}" basedir="${build.dir}"
manifest="${performancemanifest.file}">
<fileset dir="${build.dir}" includes="**/*.class" />
<zipgroupfileset dir="${lib.dir}" includes="**/*.jar" />
</jar>
</target>
<!-- generate separate jar files for client and server application -->
<target name="build-jar" depends="build-client-jar, build-server-jar, build-ecs-jar" />
<!-- run test cases -->
<target name="test" depends="build">
<junit>
<classpath refid="project.classpath" />
<formatter type="brief" usefile="false" />
<test name="testing.AllTests" />
</junit>
</target>
<target name="run" >
<java classname="${main.class}" classpathref="class.path"/>
</target>
</project>