-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.xml
213 lines (176 loc) · 7.54 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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
<?xml version="1.0"?>
<project name="bcbsp" default="jar">
<property name="version" value="1.0" />
<property name="Name" value="bcbsp" />
<property name="final.name" value="bcbsp-${version}" />
<property name="year" value="20121204" />
<!-- Load all the default properties, and any the user wants -->
<!-- to contribute (without having to type -D or edit this file -->
<property file="${user.home}/${name}.build.properties" />
<property file="${basedir}/build.properties" />
<property name="src.dir" location="${basedir}/src/java" />
<property name="lib.dir" value="${basedir}/lib" />
<property name="conf.dir" value="${basedir}/conf" />
<property name="docs.dir" value="${basedir}/docs" />
<property name="docs.src" value="${basedir}/src/docs" />
<!-- build properties -->
<property name="test.output" value="no" />
<property name="test.timeout" value="600000" />
<property name="build.dir" location="${basedir}/build" />
<property name="build.lib" location="${build.dir}/lib" />
<property name="build.classes" location="${build.dir}/classes" />
<property name="build.docs" value="${build.dir}/docs/site" />
<property name="build.encoding" value="ISO-8859-1" />
<property name="build.src" value="${build.dir}/src" />
<property name="build.report" value="${build.dir}/reports" />
<property name="build.report.findbugs" value="${build.report}/findbugs" />
<property name="build.report.tests" value="${build.report}/tests" />
<property name="test.build.dir" value="${build.dir}/test" />
<property name="test.junit.output.format" value="plain" />
<property name="dist.dir" value="${build.dir}/${final.name}" />
<property name="javac.deprecation" value="off" />
<property name="javac.debug" value="on" />
<fileset id="lib.jars" dir="${basedir}" includes="lib/*.jar" />
<path id="classpath">
<fileset refid="lib.jars" />
<fileset dir="${lib.dir}/findbugs/">
<include name="*.jar" />
</fileset>
<pathelement location="${build.classes}" />
<pathelement location="${conf.dir}" />
</path>
<taskdef name="findbugs" classpathref="classpath" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" />
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.classes}" />
<mkdir dir="${build.report.findbugs}" />
<mkdir dir="${build.report.tests}" />
<!--Copy bin, lib, and conf. too-->
<mkdir dir="${build.lib}" />
<copy todir="${build.lib}">
<fileset dir="${lib.dir}" />
</copy>
<tempfile property="touch.temp.file" destDir="${java.io.tmpdir}"/>
<touch millis="0" file="${touch.temp.file}">
<fileset dir="${conf.dir}" includes="**/*.template"/>
</touch>
<delete file="${touch.temp.file}"/>
<copy todir="${conf.dir}" verbose="true">
<fileset dir="${conf.dir}" includes="**/*.template"/>
<mapper type="glob" from="*.template" to="*"/>
</copy>
</target>
<!-- ================================================================== -->
<!-- Java Compiler Compiler, generate Parsers -->
<!-- ================================================================== -->
<target name="compile" depends="init">
<!--Compile whats under src and generated java classes made from jsp-->
<mkdir dir="${build.src}" />
<javac encoding="${build.encoding}" srcdir="${src.dir};${build.src}" includes="**/*.java" destdir="${build.classes}" debug="${javac.debug}" deprecation="${javac.deprecation}" includeantruntime="false">
<classpath refid="classpath" />
</javac>
</target>
<!-- Override jar target to specify main class -->
<target name="jar" depends="compile">
<jar jarfile="${build.dir}/${final.name}.jar" basedir="${build.classes}">
</jar>
</target>
<target name="package" depends="jar" description="Build distribution">
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.dir}/lib"/>
<mkdir dir="${dist.dir}/bin"/>
<mkdir dir="${dist.dir}/docs"/>
<mkdir dir="${dist.dir}/docs/api"/>
<copy todir="${dist.dir}" includeEmptyDirs="false" flatten="true">
<fileset dir="${build.dir}">
<include name="${final.name}.jar" />
</fileset>
</copy>
<copy todir="${dist.dir}/bin">
<fileset dir="bin"/>
</copy>
<copy todir="${dist.dir}/conf">
<fileset dir="${conf.dir}" excludes="**/*.template"/>
</copy>
<copy todir="${dist.dir}/lib">
<fileset dir="${build.lib}" />
</copy>
<copy todir="${dist.dir}/docs">
<fileset dir="${build.docs}"/>
</copy>
<copy todir="${dist.dir}">
<fileset dir=".">
<include name="*.txt" />
</fileset>
</copy>
<copy todir="${dist.dir}/" file="build.xml"/>
<copy todir="${dist.dir}/" file="pom.xml"/>
<mkdir dir="${dist.dir}/src" />
<copy todir="${dist.dir}/src" includeEmptyDirs="true">
<fileset dir="src" excludes="**/*.template **/docs/build/**/*" />
</copy>
<chmod perm="ugo+x" type="file" parallel="false">
<fileset dir="${dist.dir}/bin"/>
</chmod>
</target>
<!-- ================================================================== -->
<!-- Make release tarball -->
<!-- ================================================================== -->
<macrodef name="macro_tar" description="Worker Macro for tar">
<attribute name="param.destfile" />
<element name="param.listofitems" />
<sequential>
<tar compression="gzip" longfile="gnu" destfile="@{param.destfile}">
<param.listofitems />
</tar>
</sequential>
</macrodef>
<target name="tar" depends="package" description="Make release tarball">
<macro_tar param.destfile="${build.dir}/${final.name}.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<target name="binary" depends="package" description="Make tarball without source and documentation">
<macro_tar param.destfile="${build.dir}/${final.name}-bin.tar.gz">
<param.listofitems>
<tarfileset dir="${build.dir}" mode="664">
<exclude name="${final.name}/bin/*" />
<exclude name="${final.name}/src/**" />
<exclude name="${final.name}/docs/**" />
<include name="${final.name}/**" />
</tarfileset>
<tarfileset dir="${build.dir}" mode="755">
<include name="${final.name}/bin/*" />
</tarfileset>
</param.listofitems>
</macro_tar>
</target>
<!-- ================================================================== -->
<!-- Doc -->
<!-- ================================================================== -->
<target name="docs" depends="forrest.check" description="Generate forrest-based documentation. To use, specify -Dforrest.home=< on the command line." if="forrest.home">
<exec dir="${docs.src}" executable="${forrest.home}/bin/forrest" failonerror="true">
</exec>
<copy todir="${build.docs}">
<fileset dir="${docs.src}/build/site/" />
</copy>
<delete dir="${docs.src}/build/" />
</target>
<target name="forrest.check" unless="forrest.home">
<fail message="'forrest.home' is not defined. Please pass -Dforrest.home=< to Ant on the command-line." />
</target>
<!-- ================================================================== -->
<!-- Clean. Delete the build files, and their directories -->
<!-- ================================================================== -->
<target name="clean">
<delete dir="${build.dir}" />
</target>
</project>