-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathbuild.xml
235 lines (211 loc) · 10 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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
<?xml version="1.0" encoding="UTF-8"?>
<project name="NotationToolkit" default="package" basedir=".">
<description>Builds, tests, and runs the project NotationToolkit.</description>
<!-- Initialization target -->
<target name="initialization">
<tstamp/>
<!-- Give user a chance to override without editing this file and without using -D arguments each time they build using build.properties files). -->
<property file="${basedir}/build.properties" />
<property name="name" value="HELMNotationToolkit"/>
<property name="version" value="1.0"/>
<property name="version.impl" value="${version}"/>
<property name="version.spec" value="1.1"/>
<property name="year" value="2012"/>
<echo message="----------- ${name} ${version} ------------"/>
<property name="compile.debug" value="true" />
<property name="compile.optimize" value="true" />
<property name="compile.target" value="1.7" />
<property name="compile.source" value="1.7" />
<property name="compile.deprecation" value="true" />
<property name="src.dir" value="${basedir}/source"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="test.lib.dir" value="${lib.dir}/test"/>
<property name="packages" value="org.helm.notation.*"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.src" value="${basedir}/build/src"/>
<property name="build.dest" value="${basedir}/build/classes"/>
<property name="build.javadoc" value="${basedir}/build/javadoc"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="publish.dir" value="${basedir}/publish"/>
<property name="publish.jar.dir" value="${publish.dir}/jar"/>
<property name="publish.javadoc.dir" value="${publish.dir}/javadoc"/>
<property name="demo.src" value="${basedir}/demo"/>
<property name="demo.dest" value="${build.dir}/demo"/>
<filter token="year" value="${year}"/>
<filter token="version" value="${version}"/>
<filter token="date" value="${TODAY}"/>
<filter token="log" value="true"/>
<filter token="verbose" value="true"/>
<property name="marvin.dir" value="${basedir}/lib"/>
<property name="marvin.jar.name" value="MarvinBeans-5.0.jar"/>
<property name="toolkit.jar.file.name" value="${name}-${version}.jar"/>
<property name="test.src" value="${basedir}/test"/>
<property name="test.dest" value="${build.dir}/test"/>
<property name="reports" value="${test.dest}/reports"/>
<!-- Compilation class path, include every jar file in lib.dir -->
<path id="compile.class.path">
<fileset dir="${lib.dir}">
<include name="jdom-1.1.jar"/>
<include name="xerces.jar"/>
<include name="sdlib.jar"/>
</fileset>
<fileset dir="${marvin.dir}">
<include name="${marvin.jar.name}"/>
</fileset>
</path>
<path id="demo.class.path">
<path refid="compile.class.path"/>
<pathelement location="${build.dest}"/>
<pathelement location="${demo.dest}"/>
</path>
<!-- Run test class path, include everything from compile.class.path and compiled classes -->
<path id="test.class.path">
<path refid="demo.class.path"/>
<fileset dir="${test.lib.dir}">
<include name="junit-4.11.jar"/>
<include name="hamcrest-core-1.3.jar"/>
</fileset>
<pathelement location="${test.dest}"/>
</path>
</target>
<!-- Help on usage -->
<target name="usage">
<echo message=""/>
<echo message=""/>
<echo message="NotationToolkit Build file"/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=" available targets are:"/>
<echo message=""/>
<echo message=" publish --> publish the NotationToolkit jar and javadoc"/>
<echo message=" package --> compiles the source code, and generate the NotationToolkit jar"/>
<echo message=" javadoc --> generates the API documentation"/>
<echo message=" cleanall --> cleans up the build and dist directory"/>
<echo message=""/>
<echo message=" See the comments inside the build.xml file for more details."/>
<echo message="-------------------------------------------------------------"/>
<echo message=""/>
<echo message=""/>
</target>
<!-- Prepares the build directory -->
<target name="prepare" depends="initialization">
<mkdir dir="${build.dir}"/>
</target>
<!-- Prepares the source code -->
<target name="prepare-src" depends="prepare">
<!-- create directories -->
<mkdir dir="${build.src}"/>
<mkdir dir="${build.dest}"/>
<!-- copy src files -->
<copy todir="${build.src}" filtering="yes">
<fileset dir="${src.dir}"/>
</copy>
</target>
<!-- Compiles the source directory -->
<target name="compile-source" depends="prepare-src" description="Compiles the source code">
<javac srcdir="${build.src}"
destdir="${build.dest}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="compile.class.path"/>
</javac>
</target>
<!-- Creates the class package -->
<target name="package" depends="compile-source" description="Creates the class package, include xml and xsd files">
<delete dir = "${dist.dir}" />
<mkdir dir = "${dist.dir}" />
<copy todir="${build.dest}" filtering="yes">
<fileset dir="${build.src}">
<include name="**/*.xml"/>
<include name="**/*.xsd"/>
<include name="**/*.properties"/>
</fileset>
</copy>
<jar jarfile="${dist.dir}/${toolkit.jar.file.name}" basedir="${build.dest}" />
</target>
<!-- Publish jar and javadoc -->
<target name="publish" depends="cleanall, package, javadoc" description="Move jar and javadoc into publish folder">
<copy todir="${publish.jar.dir}" >
<fileset dir="${dist.dir}" >
<include name="**/*.jar"/>
</fileset>
</copy>
<jar jarfile="${dist.dir}/${name}-${version}-javadoc.zip" basedir="${build.javadoc}" />
<copy todir="${publish.javadoc.dir}" >
<fileset dir="${dist.dir}">
<include name="**/*.zip"/>
</fileset>
</copy>
</target>
<!-- Creates the API documentation -->
<target name="javadoc" depends="prepare-src" description="Creates the API documentation">
<mkdir dir="${build.javadoc}"/>
<javadoc packagenames="${packages}"
sourcepath="${build.src}"
destdir="${build.javadoc}"
author="true"
version="true"
use="true"
splitindex="true"
noindex="false"
windowtitle="${name} v${version}"
doctitle="${name} v${version}<br>API Specification"
header="<b>${name}<br><font size='-1'>${version}</font></b>"
bottom="Copyright © ${year}, The Pistoia Alliance">
<classpath refid="compile.class.path"/>
</javadoc>
</target>
<!-- Clean build and dist folder -->
<target name="cleanall" depends="initialization" description="Removes all build and dist files">
<delete dir="${dist.dir}"/>
<delete dir="${build.dir}"/>
</target>
<!-- Compiles the demo directory -->
<target name="compile-demo" depends="package" description="Compiles the demo directory">
<mkdir dir="${demo.dest}"/>
<javac srcdir="${demo.src}"
destdir="${demo.dest}"
debug="${compile.debug}"
optimize="${compile.optimize}"
target="${compile.target}"
source="${compile.source}"
deprecation="${compile.deprecation}">
<classpath refid="demo.class.path"/>
</javac>
</target>
<!-- Run demo file ToolkitSample -->
<target name="run-demo" depends="compile-demo" description="Run ToolkitSample class" >
<java classname="org.helm.notation.demo.tools.ToolkitSample">
<classpath refid="demo.class.path"/>
</java>
</target>
<!-- Compile JUnit test classes -->
<target name="compile-test" depends="compile-demo" description="Compiles test code">
<mkdir dir="${test.dest}"/>
<mkdir dir="${reports}"/>
<copy todir="${test.dest}" filtering="yes">
<fileset dir="${test.src}">
<include name="**/*.xhelm" />
</fileset>
</copy>
<javac srcdir="${test.src}" destdir="${test.dest}" source="1.6" target="1.6" debug="true" debuglevel="lines,vars,source">
<classpath refid="test.class.path"/>
</javac>
</target>
<!-- Run JUnit tests -->
<target name="run-test" depends="compile-test" description="Run unit tests">
<junit printsummary="yes" haltonfailure="yes" showoutput="yes">
<classpath refid="test.class.path"/>
<batchtest fork="yes" todir="${reports}">
<formatter type="xml"/>
<formatter type="plain"/>
<fileset dir="${test.src}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>