-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
405 lines (363 loc) · 18.3 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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Id$ -->
<project name="dellroad-stuff" default="build"
xmlns:dellroad="urn:org.dellroad.ant"
xmlns:antcontrib="urn:net.sf.antcontrib"
xmlns:artifact="antlib:org.apache.maven.artifact.ant"
xmlns:ivy="urn:org.apache.ivy.ant">
<!-- Configure build & stuff -->
<property name="library.version" value="1.0"/>
<property name="javac.compiler.flags" value="-Xlint:all"/>
<!-- Other constants -->
<property name="vaadin.plugin.groupId" value="org.dellroad"/>
<property name="vaadin.plugin.artifactId" value="dellroad-stuff-vaadin"/>
<!-- Import generic build macros -->
<import file="${basedir}/src/build/macros.xml"/>
<!-- Determine SVN revision and full version -->
<dellroad:svnrevision property="svn.revision"/>
<property name="full.version" value="${library.version}.${svn.revision}"/>
<echo message=""/>
<echo message="Version is ${library.version}.${svn.revision}"/>
<echo message=""/>
<!-- Classpath targets -->
<target name="build.classpath" unless="build.classpath.resolved">
<dellroad:ivypath pathid="build.classpath" conf="build"/>
<property name="build.classpath.resolved" value="true"/>
</target>
<target name="javac.classpath" unless="javac.classpath.resolved">
<dellroad:ivypath pathid="javac.classpath" conf="build-vaadin6"/>
<property name="javac.classpath.resolved" value="true"/>
</target>
<target name="javac-vaadin7.classpath" unless="javac-vaadin7.classpath.resolved">
<dellroad:ivypath pathid="javac-vaadin7.classpath" conf="build-vaadin7"/>
<property name="javac-vaadin7.classpath.resolved" value="true"/>
</target>
<target name="vaadin7.classpath" unless="vaadin7.classpath.resolved">
<dellroad:ivypath pathid="vaadin7.classpath" conf="vaadin7"/>
<property name="vaadin7.classpath.resolved" value="true"/>
</target>
<target name="jibx-bind.classpath" unless="jibx-bind.classpath.resolved">
<dellroad:ivypath pathid="jibx-bind.classpath" conf="jibx-bind"/>
<property name="jibx-bind.classpath.resolved" value="true"/>
</target>
<target name="unittest.classpath" depends="jar" unless="unittest.classpath.resolved">
<dellroad:ivypath pathid="unittest.classpath" conf="test"/>
<property name="unittest.classpath.resolved" value="true"/>
</target>
<!-- JAVAC: Main and Vaadin6 classes -->
<target name="javac-vaadin6" depends="javac.classpath, testng.classpath" unless="javac-vaadin6.completed">
<mkdir dir="build/classes"/>
<dellroad:javac-default sourcepath="" srcdir="src/java" destdir="build/classes">
<classpath refid="javac.classpath"/>
<compilerarg line="-proc:none"/>
<include name="**/*.java"/>
<exclude name="org/dellroad/stuff/pobj/vaadin/**/*.java"/>
<exclude name="org/dellroad/stuff/vaadin7/**/*.java"/>
</dellroad:javac-default>
<property name="javac-vaadin6.completed" value="true"/>
</target>
<!-- JAVAC: Vaadin7 classes -->
<target name="javac-vaadin7" depends="javac-vaadin7.classpath, testng.classpath" unless="javac-vaadin7.completed">
<mkdir dir="build/classes"/>
<dellroad:javac-default sourcepath="" srcdir="src/java" destdir="build/classes">
<classpath refid="javac-vaadin7.classpath"/>
<compilerarg line="-proc:none"/>
<include name="org/dellroad/stuff/pobj/vaadin/**/*.java"/>
<include name="org/dellroad/stuff/vaadin7/**/*.java"/>
</dellroad:javac-default>
<property name="javac-vaadin7.completed" value="true"/>
</target>
<target name="javac-main" depends="javac-vaadin6, javac-vaadin7" unless="javac-main.completed">
<property name="javac-main.completed" value="true"/>
</target>
<!-- Resources -->
<target name="resources" unless="resources.completed" description="Gather resources">
<delete dir="build/resources"/>
<mkdir dir="build/resources"/>
<copy todir="build/resources">
<fileset dir="src/properties" includes="${ant.project.name}.properties"/>
<fileset dir="src/java" includes="**/*.xml"/>
<fileset dir="src/java" includes="**/*.xsd"/>
<fileset dir="src/java" includes="**/*.sql"/>
<filterset>
<filter token="VERSION" value="${full.version}"/>
</filterset>
</copy>
<property name="resources.completed" value="true"/>
</target>
<!-- Compile JiBX bindings -->
<target name="jibx-bind" depends="javac, jibx-bind.classpath" unless="jibx-bind.completed"
description="Compile JiBX bindings">
<dellroad:jibx-bind name="test classes">
<classes>
<pathelement location="${basedir}/build/classes"/>
<pathelement location="${basedir}/build/test"/>
</classes>
<bindings>
<include name="src/test/org/dellroad/stuff/jibx/binding1.xml"/>
<include name="src/test/org/dellroad/stuff/jibx/binding2.xml"/>
<include name="src/test/org/dellroad/stuff/pobj/binding.xml"/>
</bindings>
</dellroad:jibx-bind>
<property name="jibx-bind.completed" value="true"/>
</target>
<!-- Setup AspectJ tasks -->
<target name="aop-setup" depends="build.classpath" unless="aop-setup.completed" description="Setup AOP ant tasks">
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties">
<classpath refid="build.classpath"/>
</taskdef>
<property name="aop-setup.completed" value="true"/>
</target>
<!-- Compile Aspects -->
<target name="aspects" depends="javac, aop-setup" unless="aspects.completed" description="Compile AOP aspects">
<path id="aspect.classpath">
<path refid="javac.classpath"/>
<pathelement location="build/classes"/>
</path>
<iajc srcdir="src/java"
destDir="build/classes"
classpathRef="aspect.classpath"
source="1.6"
target="1.6"
verbose="true"
showWeaveInfo="true"
failonerror="true">
<include name="**/*.aj"/>
<exclude name="org/dellroad/stuff/vaadin7/**/*"/>
</iajc>
<property name="aspects.completed" value="true"/>
</target>
<!-- Compile vaadin7 Aspects -->
<target name="aspects-vaadin7" depends="javac, aop-setup, javac-vaadin7" unless="aspects-vaadin7.completed"
description="Compile AOP aspects">
<path id="aspect-vaadin7.classpath">
<path refid="javac-vaadin7.classpath"/>
<pathelement location="build/classes"/>
</path>
<iajc srcdir="src/java"
destDir="build/classes"
classpathRef="aspect-vaadin7.classpath"
source="1.6"
target="1.6"
verbose="true"
showWeaveInfo="true"
failonerror="true">
<include name="org/dellroad/stuff/vaadin7/**/*.aj"/>
</iajc>
<property name="aspects-vaadin7.completed" value="true"/>
</target>
<!-- Main JAR -->
<target name="jar" depends="javac, javac-vaadin7, jibx-bind, aspects, aspects-vaadin7, resources" unless="jar.completed"
description="Build main JAR">
<mkdir dir="build/dist"/>
<delete file="build/dist/${ant.project.name}-${full.version}.jar"/>
<jar destfile="build/dist/${ant.project.name}-${full.version}.jar">
<fileset dir="build/classes"/>
<fileset dir="build/resources"/>
<metainf dir="src/java/org/dellroad/stuff/spring" includes="spring.*"/>
<metainf dir="src/aop" includes="aop.xml"/>
</jar>
<property name="jar.completed" value="true"/>
</target>
<!-- Vaadin addon -->
<target name="addon" depends="javac, javac-vaadin7, aspects, aspects-vaadin7, resources" unless="addon.completed"
description="Build Vaadin add-on">
<mkdir dir="build/addon/maven/${vaadin.plugin.groupId}/${vaadin.plugin.artifactId}"/>
<copy file="src/aop/aop.xml" tofile="build/addon/aop.xml">
<filterchain>
<linecontains negate="true">
<contains value="aspect name="org.dellroad.stuff.spring"/>
</linecontains>
</filterchain>
</copy>
<copy todir="build/addon/maven/${vaadin.plugin.groupId}/${vaadin.plugin.artifactId}">
<fileset dir="src/addon" includes="pom.xml"/>
<filterset>
<filter token="VERSION" value="${full.version}"/>
<filter token="GROUP_ID" value="${vaadin.plugin.groupId}"/>
<filter token="ARTIFACT_ID" value="${vaadin.plugin.artifactId}"/>
</filterset>
</copy>
<mkdir dir="build/dist"/>
<delete file="build/dist/${ant.project.name}-vaadin-addon-${full.version}.jar"/>
<jar destfile="build/dist/${ant.project.name}-vaadin-addon-${full.version}.jar">
<fileset dir="build/classes">
<include name="org/dellroad/stuff/io/NullModemInputStream*"/>
<include name="org/dellroad/stuff/io/WriteCallback*"/>
<include name="org/dellroad/stuff/java/*"/>
<include name="org/dellroad/stuff/spring/AbstractConfigurableAspect*"/>
<include name="org/dellroad/stuff/spring/DelayedAction*"/>
<include name="org/dellroad/stuff/vaadin/**/*"/>
<include name="org/dellroad/stuff/vaadin7/**/*"/>
</fileset>
<fileset dir="build/resources">
<include name="org/dellroad/stuff/vaadin/**/*"/>
<include name="org/dellroad/stuff/vaadin7/**/*"/>
</fileset>
<metainf dir="build/addon" includes="maven/**/*"/>
<metainf dir="build/addon" includes="aop.xml"/>
<manifest>
<attribute name="Vaadin-Package-Version" value="1"/>
<attribute name="Implementation-Title" value="Spring Stuff"/>
<attribute name="Implementation-Version" value="${full.version}"/>
</manifest>
</jar>
<property name="addon.completed" value="true"/>
</target>
<!-- All distribution files -->
<target name="jars" depends="jar, javadoc" unless="jars.completed"
description="Build JARs">
<mkdir dir="build/dist"/>
<delete file="build/dist/${ant.project.name}-sources-${full.version}.zip"/>
<zip destfile="build/dist/${ant.project.name}-sources-${full.version}.zip">
<fileset dir="src/java" includes="**/*"/>
</zip>
<delete file="build/dist/${ant.project.name}-javadocs-${full.version}.zip"/>
<zip destfile="build/dist/${ant.project.name}-javadocs-${full.version}.zip">
<fileset dir="build/reports/javadoc" includes="**/*"/>
</zip>
<property name="jars.completed" value="true"/>
</target>
<!-- Build Javadocs -->
<target name="javadoc" depends="javac, javac-vaadin7, vaadin7.classpath" unless="javadoc.completed"
description="Build API JavaDocs">
<delete dir="build/javadoc"/>
<mkdir dir="build/javadoc"/>
<copy todir="build/javadoc">
<fileset dir="src/java/org/dellroad/stuff" includes="overview.html"/>
<filterset>
<filter token="VERSION" value="${full.version}"/>
</filterset>
</copy>
<dellroad:javadoc overview="build/javadoc/overview.html">
<additional-classpath>
<pathelement path="build/classes"/>
<path refid="vaadin7.classpath"/>
</additional-classpath>
<links>
<link href="https://docs.oracle.com/javase/7/docs/api/"/>
<link href="https://docs.oracle.com/javaee/7/api/"/>
<link href="http://docs.spring.io/spring/docs/4.1.x/javadoc-api/"/>
<link href="http://jibx.sourceforge.net/api/"/>
<link href="http://opencsv.sourceforge.net/apidocs/"/>
<link href="http://vaadin.com/download/release/7.3/7.3.7/docs/api/"/>
<link href="http://www.slf4j.org/api/"/>
<link href="http://www.eclipse.org/aspectj/doc/released/runtime-api/"/>
<link href="http://docs.guava-libraries.googlecode.com/git/javadoc/"/>
</links>
</dellroad:javadoc>
<property name="javadoc.completed" value="true"/>
</target>
<!-- Checkstyle the source -->
<target name="checkstyle" description="Run checkstyle report"
depends="javac.classpath, unittest.classpath, checkstyle.classpath"
unless="checkstyle.completed">
<!-- Work around problem caused by Vaadin6 vs. Vaadin7 classpath -->
<mkdir dir="build/checkstyle"/>
<xslt style="checkstyle-fix.xsl" in="src/build/checkstyle/checkstyle.xml" out="build/checkstyle/config.xml" force="true"/>
<dellroad:checkstyle config="build/checkstyle/config.xml" maxWarnings="0" maxErrors="0"/>
<property name="checkstyle.completed" value="true"/>
</target>
<!-- Run unit tests -->
<target name="tests" description="Run unit tests"
depends="javac, unittest.classpath, testng.classpath, cobertura.classpath"
unless="tests.completed">
<copy todir="build/test" overwrite="true">
<fileset dir="src/test" includes="**/*.xsl"/>
<fileset dir="src/test" includes="**/*.xml"/>
</copy>
<mkdir dir="build/test/META-INF"/>
<copy todir="build/test/META-INF">
<fileset dir="src/java/org/dellroad/stuff/spring" includes="spring.*"/>
</copy>
<copy file="src/xml/log4j-build.xml" tofile="build/test/log4j.xml"/>
<dellroad:unit-tests>
<addclasspath>
<path refid="javac.classpath"/>
</addclasspath>
</dellroad:unit-tests>
<property name="tests.completed" value="true"/>
</target>
<!-- Publish reports -->
<target name="publish" description="Publish build results" depends="reports">
<!-- Remove exisiting stuff first -->
<delete includeemptydirs="false">
<fileset dir="publish">
<include name="**/*"/>
</fileset>
</delete>
<!-- Reports -->
<mkdir dir="publish/reports"/>
<copy todir="publish/reports">
<fileset dir="build/reports">
<include name="**/*"/>
</fileset>
</copy>
</target>
<!-- Publish to maven -->
<target name="mavenpub" depends="jars" description="Deploy JARs to Maven staging repository">
<!-- Define where GPG executable lives -->
<property name="gpg.executable" value="/usr/local/MacGPG2/bin/gpg2"/>
<!-- Define Maven coordinates -->
<property name="groupId" value="org.dellroad"/>
<property name="artifactId" value="${ant.project.name}"/>
<property name="version" value="${full.version}"/>
<!-- Define artifacts' name, which follows the convention of Maven -->
<property name="maven-jar" value="${dist}/lib/${artifactId}-${version}.jar" />
<property name="maven-javadoc-jar" value="${dist}/lib/${artifactId}-${version}-javadoc.jar" />
<property name="maven-sources-jar" value="${dist}/lib/${artifactId}-${version}-sources.jar" />
<!-- Define maven snapshots and staging repository id and url -->
<property name="maven-snapshots-repository-id" value="sonatype-nexus-snapshots" />
<property name="maven-snapshots-repository-url" value="https://oss.sonatype.org/content/repositories/snapshots/" />
<property name="maven-staging-repository-id" value="sonatype-nexus-staging" />
<property name="maven-staging-repository-url" value="https://oss.sonatype.org/service/local/staging/deploy/maven2/" />
<!-- Generate pom.xml -->
<copy todir="build">
<fileset dir="src/mvn" includes="pom.xml"/>
<filterset>
<filter token="VERSION" value="${full.version}"/>
<filter token="GROUP_ID" value="org.dellroad"/>
<filter token="ARTIFACT_ID" value="${ant.project.name}"/>
</filterset>
</copy>
<!-- Sign and deploy the main artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.5:sign-and-deploy-file" />
<arg value="-Dgpg.executable=${gpg.executable}"/>
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=build/pom.xml" />
<arg value="-Dfile=build/dist/${ant.project.name}-${full.version}.jar"/>
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the sources artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.5:sign-and-deploy-file" />
<arg value="-Dgpg.executable=${gpg.executable}"/>
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=build/pom.xml" />
<arg value="-Dfile=build/dist/${ant.project.name}-sources-${full.version}.zip"/>
<arg value="-Dclassifier=sources" />
<arg value="-Pgpg" />
</artifact:mvn>
<!-- sign and deploy the javadoc artifact -->
<artifact:mvn>
<arg value="org.apache.maven.plugins:maven-gpg-plugin:1.5:sign-and-deploy-file" />
<arg value="-Dgpg.executable=${gpg.executable}"/>
<arg value="-Durl=${maven-staging-repository-url}" />
<arg value="-DrepositoryId=${maven-staging-repository-id}" />
<arg value="-DpomFile=build/pom.xml" />
<arg value="-Dfile=build/dist/${ant.project.name}-javadocs-${full.version}.zip"/>
<arg value="-Dclassifier=javadoc" />
<arg value="-Pgpg" />
</artifact:mvn>
</target>
<!-- Reports target -->
<target name="reports-project" depends="javadoc, checkstyle, tests"/>
<!-- Release time stuff -->
<target name="release" depends="clean, jars, addon, reports, publish, mavenpub"
description="Perform release-time tasks"/>
<!-- Default target -->
<target name="build" depends="clean, jars, addon, reports"/>
</project>