-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
191 lines (147 loc) · 5.92 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
187
188
189
190
191
<?xml version="1.0"?>
<project name="jeneric-functions" default="root-jar">
<property name="lib.dir" location="lib" />
<property name="src.dir" location="src" />
<property name="build.dir" location="build" />
<property name="dist.dir" location="dist" />
<property name="main.src.dir" location="${src.dir}/main" />
<property name="main.classes.dir" location="${build.dir}/main" />
<property name="test.src.dir" location="${src.dir}/test" />
<property name="test.classes.dir" location="${build.dir}/test" />
<property name="test.reports.dir" location="test-output" />
<property name="examples.src.dir" location="examples" />
<property name="examples.classes.dir" location="${build.dir}/examples" />
<property name="imposed.project.name" value="genericFunctions" />
<property name="normal.jar.name" value="${imposed.project.name}.jar" />
<property name="extended.jar.name" value="${imposed.project.name}Extended.jar"
/>
<property name="dist.both.jar" location="${dist.dir}/${normal.jar.name}" />
<property name="dist.extended.jar"
location="${dist.dir}/${extended.jar.name}"
/>
<property name="release.zip" value="project.zip" />
<property name="zip.prefix.dir" value="g05" />
<property name="slides.pdf" location="p2.pdf" />
<path id="classpath">
<pathelement location="${main.classes.dir}" />
</path>
<path id="test.compile.classpath">
<path refid="classpath" />
<pathelement location="${lib.dir}/junit.jar" />
<pathelement location="${test.classes.dir}" />
</path>
<path id="test.run.classpath">
<path refid="test.compile.classpath" />
<pathelement location="${lib.dir}/hamcrest-core.jar" />
</path>
<!-- =================================================================== -->
<!-- Compilation -->
<!-- =================================================================== -->
<target name="compile" depends="compile-main" />
<target name="compile-main" depends="clean-main, init-main">
<javac srcdir="${main.src.dir}"
destdir="${main.classes.dir}"
includeantruntime="false">
<!-- <classpath refid="classpath" /> -->
</javac>
</target>
<target name="compile-test" depends="compile-main, init-test">
<javac srcdir="${test.src.dir}"
destdir="${test.classes.dir}"
includeantruntime="false">
<classpath refid="test.compile.classpath" />
</javac>
</target>
<target name="compile-examples" depends="compile-main, init-examples">
<javac srcdir="${examples.src.dir}"
destdir="${examples.classes.dir}"
includeantruntime="false">
<classpath refid="classpath" />
</javac>
</target>
<target name="jar" depends="jar-both" />
<target name="jar-both" depends="init-jar, compile-main">
<jar destfile="${dist.both.jar}" basedir="${main.classes.dir}" />
</target>
<target name="jar-extended" depends="jar-both">
<jar destfile="${dist.extended.jar}">
<zipfileset src="${dist.both.jar}" />
</jar>
</target>
<!-- =================================================================== -->
<!-- Release -->
<!-- =================================================================== -->
<target name="root-jar" depends="jar-both">
<copy file="${dist.both.jar}" todir="." />
</target>
<target name="release">
<zip destfile="${release.zip}">
<zipfileset dir="." includes="lib/**/*" prefix="${zip.prefix.dir}" />
<zipfileset dir="." includes="src/**/*" prefix="${zip.prefix.dir}" />
<zipfileset dir="." includes="build.xml" prefix="${zip.prefix.dir}" />
<zipfileset dir="." includes="${slides.pdf}" prefix="${zip.prefix.dir}" />
</zip>
</target>
<target name="zip" depends="release" />
<!-- =================================================================== -->
<!-- Testing -->
<!-- =================================================================== -->
<target name="test" depends="init-test-reports, compile-test">
<junit printsummary="yes" haltonfailure="no">
<classpath refid="test.run.classpath" />
<formatter type="plain" />
<batchtest fork="yes" todir="${test.reports.dir}">
<fileset dir="${test.src.dir}" />
</batchtest>
</junit>
</target>
<!-- =================================================================== -->
<!-- Build preparation and cleaning -->
<!-- =================================================================== -->
<target name="clean"
depends="clean-main,
clean-release,
clean-jar,
clean-test,
clean-test-reports,
clean-examples">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="init-main">
<mkdir dir="${main.classes.dir}" />
</target>
<target name="clean-main">
<delete dir="${main.classes.dir}" />
</target>
<target name="init-jar">
<mkdir dir="${dist.dir}" />
</target>
<target name="clean-jar">
<delete file="${dist.both.jar}" />
</target>
<target name="init-release" />
<target name="clean-release">
<delete file="${normal.jar.name}" />
<delete file="${extended.jar.name}" />
<delete file="${release.zip}" />
</target>
<target name="init-test">
<mkdir dir="${test.classes.dir}" />
</target>
<target name="clean-test">
<delete dir="${test.classes.dir}" />
</target>
<target name="init-test-reports">
<mkdir dir="${test.reports.dir}" />
</target>
<target name="clean-test-reports">
<delete dir="${test.reports.dir}" />
</target>
<target name="init-examples">
<mkdir dir="${examples.classes.dir}" />
</target>
<target name="clean-examples">
<delete dir="${examples.classes.dir}" />
</target>
</project>