summaryrefslogtreecommitdiff
path: root/qpid/java/common.xml
blob: 388dae1f40debc5f63bf8c41bdacdaf6de2603bd (plain)
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
<!--
 -
 - Licensed to the Apache Software Foundation (ASF) under one
 - or more contributor license agreements.  See the NOTICE file
 - distributed with this work for additional information
 - regarding copyright ownership.  The ASF licenses this file
 - to you under the Apache License, Version 2.0 (the
 - "License"); you may not use this file except in compliance
 - with the License.  You may obtain a copy of the License at
 - 
 -   http://www.apache.org/licenses/LICENSE-2.0
 - 
 - Unless required by applicable law or agreed to in writing,
 - software distributed under the License is distributed on an
 - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 - KIND, either express or implied.  See the License for the
 - specific language governing permissions and limitations
 - under the License.
 -
 -->
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="common">

  <dirname property="project.root" file="${ant.file.common}"/>

  <property name="project.name"          value="qpid"/>
  <property name="project.version"       value="0.20"/>
  <property name="project.url"           value="http://qpid.apache.org"/>
  <property name="project.groupid"       value="org.apache.qpid"/>
  <property name="project.namever"       value="${project.name}-${project.version}"/>

  <property name="resources"             location="${project.root}/resources"/>
  <property name="test.profiles"         location="${project.root}/test-profiles"/>
  <property name="build"                 location="${project.root}/build"/>
  <property name="build.scratch"         location="${build}/scratch"/>
  <property name="build.bin"             location="${build}/bin"/>
  <property name="build.etc"             location="${build}/etc"/>
  <property name="build.lib"             location="${build}/lib"/>
  <property name="build.api"             location="${build}/api"/>
  <property name="build.test.api"        location="${build}/test-api"/>
  <property name="build.results"         location="${build}/results"/>
  <property name="build.failed"          location="${build.results}/FAILED"/>
  <property name="build.report"          location="${build}/report"/>
  <property name="build.release"         location="${build}/release"/>
  <property name="build.release.prepare" location="${build.release}/prepare"/>
  <property name="build.scratch.broker.plugins.lib"  location="${build.scratch}/broker-plugins/lib"/>
  <property name="build.coverage.report" location="${build}/coverage/report"/>
  <property name="build.coverage.src"    location="${build}/coverage/src"/>
  <property name="build.findbugs"        location="${build}/findbugs"/>

  <property name="java.target"           value="1.5"/>
  <property name="java.source"           value="1.5"/>

  <property name="release"               location="${project.root}/release"/>

  <property name="tasks"                 location="${project.root}/tasks"/>
  <property name="tasks.classes"         location="${tasks}/classes"/>
  <property name="tasks.src"             location="${tasks}/src"/>

  <property name="qpid.home"             location="${project.root}/build"/>
  <property name="qpid.work"             location="${qpid.home}/work"/>

  <property name="javac.compiler.args"   value=""/>

  <property name="cobertura.dir" value="${project.root}/lib/cobertura" />
  <property name="cobertura.version" value="1.9.4.1" />

  <path id="cobertura.classpath">
    <fileset dir="${cobertura.dir}">
        <include name="**/*.jar" />
    </fileset>
  </path>

  <property name="mllib.dir" value="${project.root}/../python" />
  <property name="findbugs.dir" value="${project.root}/lib/findbugs" />

  <!-- properties used to control Ant Eclipse for Eclipse classpath/project files etc -->
  <property name="eclipse.updatealways" value="false"/>
  <property name="eclipse.compilercompliance" value="5.0"/>
  <property name="eclipse.container" value="JVM 1.5"/>

  <!-- properties for generating the maven artifacts -->
  <property name="maven.local.repo"      value="${build.scratch}/maven-local-repo"/>
  <property name="maven.settings.xml"    value="${project.root}/maven-settings.xml"/>
  <property name="maven.unique.version"  value="false"/>
  <property name="maven.snapshot"        value="true"/>
  <condition property="maven.version.suffix" value="" else="-SNAPSHOT">
    <isfalse value="${maven.snapshot}"/>
  </condition>

  <!-- properties for uploading our Maven artifacts to Nexus using Ivy -->
  <property name="ivy.organisation"      value="org/apache"/>
  <property name="nexus.organisation"    value="org.apache"/>
  <property name="nexus.host"            value="repository.apache.org"/>
  <property name="nexus.upload.url"      value="https://${nexus.host}/service/local/staging/deploy/maven2"/>

  <!-- properties for deplying snapshot artifacts -->
  <property name="maven.snapshots.repo.id"     value="apache.snapshots.https"/>
  <property name="maven.snapshots.repo.url"     value="https://${nexus.host}/content/repositories/snapshots"/>

  <!-- properties for downloading ivy, and then our dependencies -->
  <property name="ivy.jar.dir"         value="${project.root}/lib/ivy" />
  <property name="ivy.install.version" value="2.2.0" />
  <property name="ivy.jar.file"        value="${ivy.jar.dir}/ivy-${ivy.install.version}.jar" />
  <property name="ivy.m2repo.url"      value="http://repo1.maven.org/maven2"/>
  <property name="ivy.repo.url"        value="${ivy.m2repo.url}/org/apache/ivy/ivy"/>
  <property name="ivy.jar.url"         value="${ivy.repo.url}/${ivy.install.version}/ivy-${ivy.install.version}.jar"/>

  <available property="ivy.jar.file.exists" file="${ivy.jar.file}"/>
  <property name="retrieve.dependencies"    value="true" />
  <property name="optional.dependencies"    value="false" />

  <condition property="dont.download.ivy">
    <!-- Set prop to stop Ivy download if asked not to retrieve
    the dependencies, or the ivy jar is already present -->
    <or>
      <isfalse value="${retrieve.dependencies}"/>
      <and>
        <isset property="ivy.jar.file.exists"/>
        <istrue value="${ivy.jar.file.exists}"/>
      </and>
    </or>
  </condition>

  <condition property="ivy.dont.retrieve">
    <isfalse value="${retrieve.dependencies}"/>
  </condition>
  <condition property="ivy.configured">
    <isfalse value="${retrieve.dependencies}"/>
  </condition>
  <condition property="ivy.retrieve.optional">
    <and>
      <istrue value="${retrieve.dependencies}"/>
      <or>
        <istrue value="${optional.dependencies}"/>
        <istrue value="${optional}"/>
      </or>
    </and>
  </condition>


  <macrodef name="indirect">
    <attribute name="name"/>
    <attribute name="variable"/>
    <sequential>
      <property name="@{name}" value="${@{variable}}"/>
    </sequential>
  </macrodef>

  <macrodef name="echo-path">
    <attribute name="refid"/>
    <sequential>
      <property name="@{refid}" refid="@{refid}"/>
      <echo message="@{refid} = ${@{refid}}"/>
      <pathconvert property="@{refid}.pretty"
                   refid="@{refid}"
                   pathsep="${line.separator}    |-- "/>
      <echo message="@{refid}.pretty =${line.separator}    |-- ${@{refid}.pretty}"/>
    </sequential>
  </macrodef>

  <macrodef name="echo-prop">
    <attribute name="name"/>
    <sequential>
      <echo message="@{name} = ${@{name}}"/>
    </sequential>
  </macrodef>

  <macrodef name="findSubProjects">
	<attribute name="dir"/>
        <attribute name="name"/>
	<attribute name="excludes" default=""/>
	  
	<sequential>
	  <dirset id="@{dir}.refid" dir="@{dir}" excludes="@{excludes}">
	   <present targetdir="@{dir}">
        	 <mapper type="glob" from="*" to="*/build.xml" />
	   </present>
	  </dirset>

	  <pathconvert property="@{name}"
        	       refid="@{dir}.refid"
	               pathsep=" ">
		<map from="${project.root}/" to=""/>
          </pathconvert>
 	</sequential>
  </macrodef>

  <macrodef name="jython">
    <attribute name="path"/>
    <element name="args"/>
    <sequential>
      <java jar="${project.root}/${jython}" fork="true" failonerror="true">
        <arg value="-Dpython.path=@{path}"/>
        <args/>
      </java>
    </sequential>
  </macrodef>

  <mkdir dir="${tasks.classes}"/>
  <javac source="${java.source}" target="${java.target}" srcdir="${tasks.src}" destdir="${tasks.classes}"  classpath="${java.class.path}" includeantruntime="false">
    <compilerarg line="${javac.compiler.args}"/>
  </javac>


  <typedef name="propertymapper" classname="org.apache.qpid.tasks.PropertyMapper"
             classpath="${tasks.classes}"/>

  <taskdef name="map" classname="org.apache.qpid.tasks.Map"
           classpath="${tasks.classes}"/>
  <taskdef name="foreach" classname="org.apache.qpid.tasks.Foreach"
           classpath="${tasks.classes}"/>

  <macrodef name="copylist">
    <attribute name="todir"/>
    <attribute name="dir"/>
    <attribute name="files"/>
    <sequential>
      <foreach property="file" list="@{files}">
        <copy todir="@{todir}" flatten="true">
          <fileset dir="@{dir}" includes="${file}"/>
        </copy>
      </foreach>
    </sequential>
  </macrodef>

  <macrodef name="copytofile">
    <attribute name="tofile"/>
    <attribute name="dir"/>
    <attribute name="include"/>
    <attribute name="failOnError" default="false"/>
    <sequential>
      <copy tofile="@{tofile}" failOnError="@{failOnError}">
        <fileset dir="@{dir}">
          <include name="@{include}"/>
        </fileset>
      </copy>
    </sequential>
  </macrodef>


  <target name="clean-tasks">
    <delete dir="${tasks.classes}"/>
  </target>

  <target name="clean-results">
    <delete dir="${build.results}"/>
  </target>

  <target name="report" description="generate test report">
    <delete dir="${build.report}"/>
    <mkdir dir="${build.report}"/>
    <junitreport todir="${build.report}">
      <fileset dir="${build.results}">
        <include name="**/TEST-*.xml"/>
      </fileset>
      <report todir="${build.report}"/>
    </junitreport>
  </target>

  <target name="cobertura-init">
    <taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
  </target>

  <target name="findbugs-init">

    <mkdir dir="${findbugs.dir}"/>
    <!-- Hack to make the FindBugs jars retrieved using Ivy work with the Ant Task,
    because it expects certain jar names without versions like in the .zip release -->
    <copytofile tofile="${findbugs.dir}/findbugs.jar" dir="${findbugs.dir}" include="findbugs-?.*.*.jar"/>
    <copytofile tofile="${findbugs.dir}/findbugs-ant.jar" dir="${findbugs.dir}" include="findbugs-ant-?.*.*.jar"/>
    <copytofile tofile="${findbugs.dir}/bcel.jar" dir="${findbugs.dir}" include="bcel-*.jar"/>
    <copytofile tofile="${findbugs.dir}/annotations.jar" dir="${findbugs.dir}" include="annotations-?.*.*.jar"/>
    <copytofile tofile="${findbugs.dir}/jsr305.jar" dir="${findbugs.dir}" include="jsr305-*.jar"/>
    <copytofile tofile="${findbugs.dir}/jFormatString.jar" dir="${findbugs.dir}" include="jFormatString-*.jar"/>

    <available file="${findbugs.dir}/findbugs-ant.jar" property="findbugs-ant.jar.present"/>
    <fail unless="findbugs-ant.jar.present" message="FindBugs was not found. Please add -Doptional.dependencies=true to your build command to retrieve FindBugs"/>

    <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs.dir}/findbugs-ant.jar"/>
  </target>


  <!-- targets for downloading ivy and retrieving dependencies -->
  <target name="retrieve-dependencies" depends="load-ivy, configure-ivy, retrieve-optional-dependencies" unless="${ivy.dont.retrieve}">
    <echo message="Resolving and retrieving dependencies..."/>
    <ivy:resolve type="jar,bundle,war" file="${project.root}/ivy.retrieve.xml" conf="required"/>
    <ivy:retrieve type="jar,bundle,war" conf="required" sync="true"
        pattern="${project.root}/lib/required/[artifact]-[revision].[ext]" />
  </target>

  <target name="retrieve-optional-dependencies" if="${ivy.retrieve.optional}">
    <echo message="Resolving and retrieving optional dependencies..."/>
    <ivy:resolve type="jar" file="${project.root}/ivy.retrieve.xml" conf="findbugs"/>
    <ivy:retrieve type="jar" conf="findbugs" sync="true"
        pattern="${findbugs.dir}/[artifact]-[revision].[ext]" />

    <ivy:resolve type="jar" file="${project.root}/ivy.retrieve.xml" conf="cobertura"/>
    <ivy:retrieve type="jar" conf="cobertura" sync="true"
        pattern="${cobertura.dir}/[artifact]-[revision].[ext]" />
  </target>


  <target name="configure-ivy" unless="${ivy.configured}">
    <ivy:configure file="${project.root}/ivysettings.retrieve.xml" override="true"/>
    <property name="ivy.configured" value="true" />
  </target>

  <target name="load-ivy" depends="download-ivy" unless="${ivy.dont.retrieve}">
    <!-- Try to load Ivy from local ivy dir, in case the user has not already dropped it into
         Ant's lib dir (note that the latter copy will always take precedence). Won't
         fail so long as Ivy is in at least one of the locations. -->
    <mkdir dir="${ivy.jar.dir}"/>
    <path id="ivy.lib.path">
        <fileset dir="${ivy.jar.dir}" includes="*.jar"/>
    </path>
    <taskdef resource="org/apache/ivy/ant/antlib.xml"
              uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
  </target>

  <target name="download-ivy" unless="${dont.download.ivy}">
    <mkdir dir="${ivy.jar.dir}"/>
    <echo message="Downloading ivy..."/>
    <get src="${ivy.jar.url}" dest="${ivy.jar.file}" usetimestamp="true"/>
  </target>


  <target name="help" description="display detailed build documentation">
    <echo>
  ant build

    This target compiles all sources, creates java archives, and
    copies scripts and configurations into the build directory:

      ${build}

    The build directory is treated as a live distro which this target
    will incrementally update. Developers can put the build/bin
    directory into their path in order to run any scripts or code
    directly out of the live build:

      ${build.bin}

  ant test [ -Dtest=&lt;pattern&gt; ] [-Dprofile=&lt;profile&gt;] [ report ]

    Execute unit tests and place the output in the build results
    directory:

      ${build.results}

    All test output will be redirected to a file of the form:

      TEST-&lt;class&gt;.txt

    The same output is available using an xml file format:

      TEST-&lt;class&gt;.xml

    The test system property may be used to restrict the number of
    tests run by a given invocation of the ant test target. The
    following command will run just the MongooseTest test case:

      ant test -Dtest=MongooseTest

    In addition, patterns may be used to specify more than one test.
    The following command will run both the MongooseTest and GooseTest
    test cases:

      ant test -Dtest=*ooseTest

    If no test property is specified, the "ant test" target will
    default to running all available tests for the project or module
    depending on the current working directory.

    Test Reports

    It can be useful to append the report target in order to
    generate an html summary of the tests that were just run. The
    following command will run both the MongooseTest and GooseTest
    test cases and generate an html summary of the results:

      ant test -Dtest=*ooseTest report

    See the documentation for the "ant report" target for more details
    on the generated report.

    Test Profiles

    There are a number of profiles defined for running the test suite.
    These test profiles define how the test should be run. If the test
    profile is not specified then 'default.testprofile' is utilised.
    This runs the system tests against the Java InVM broker. Additional
    test profiles exists as follows:

        cpp : Runs against the built cpp tree broker.

  ant report

    The report target will generate an html summary of the current
    test results into the report directory:

      ${build.report}

    The report target will operate on all results currently in the
    build results directory. Results are not cleared unless the clean
    target is used. This means that several consecutive test runs can
    be summarized into a single report. The following commands will
    produce a report summarizing both the MongooseTest and GooseTest
    test cases:

      ant test -Dtest=MongooseTest
      ...
      ant test -Dtest=GooseTest
      ...
      ant report

  ant release

    The release target generates binary distribution archives and
    places them into the release directory:

      ${release}

  ant release-bin
    
    The release-bin target generates binary distribution archives for 
    modules that have a specific binary package configured.
    To enable for other modules create a target "release-bin" that 
    depends on target "release-bin-tasks". The output is placed in: 

      ${module.release}

  ant clean

    The clean target removes build artifacts. When invoked from the
    project root this target will remove the entire project build and
    release directories:

      ${build}
        and
      ${release}
	and
      ${module.release}

    When invoked from a specific module, the clean target will delete
    that modules build root from underneath the project build root:

      ${build}/&lt;module&gt;

  ant clean-results

    The clean-results target removes all test output from the test
    results directory:

      ${build.results}

  ant eclipse

    Generates project and classpath files for the Eclispe IDE.  Requires that
    the Ant Eclipse task (http://ant-eclipse.sourceforge.net/) has been installed
    in $ANT_HOME/lib.

    The following system properties will be passed to the task. These can be usefully
    overridden from the command line.

    eclipse.updatealways - forces Eclipse files to be regenerated even if they are newer then the build.xml (default ${eclipse.updatealways}).
    eclipse.container - controls the Eclipse container (default ${eclipse.container}).
    eclipse.compilercompliance" - controls the Eclipse compiler compliance (default ${eclipse.compilercompliance}).

    </echo>
  </target>

</project>