Skip to content

Commit e832226

Browse files
author
Steve Powell
committed
Added bundlor targets to ant build.xml to OSGi-ify rabbitmq-client.jar
1 parent 3c96aef commit e832226

17 files changed

+122
-67
lines changed

build.properties

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1+
alt.javac.source=1.6
2+
alt.javac.target=1.6
13
build.out=build
2-
retrotranslator=retrotranslator
3-
lib.out=${build.out}/lib
4+
bundle.name=RabbitMQ Java AMQP client library
5+
bundle.out=${build.out}/bundle
6+
bundle.symbolicName=com.rabbitmq.client
7+
bundlor.home=bundlor
48
dist.out=${build.out}/dist
5-
src.generated=${build.out}/gensrc
9+
java-jvm-1.4=c:/Program Files/java/j2re1.4.2_14/bin/java
610
javac.debug=true
11+
javac.out=${build.out}/classes
12+
javadoc.out=build/doc/api
13+
lib.out=${build.out}/lib
14+
python.bin=python
15+
retrotranslator=retrotranslator
16+
sibling.codegen.dir=../rabbitmq-codegen/
17+
spec.version=0.9.1
18+
src.generated=${build.out}/gensrc
719
standard.javac.source=1.5
820
standard.javac.target=1.5
9-
alt.javac.source=1.6
10-
alt.javac.target=1.6
11-
javac.out=${build.out}/classes
1221
test.javac.out=${build.out}/test/classes
1322
test.src.home=test/src
14-
java-jvm-1.4=c:/Program Files/java/j2re1.4.2_14/bin/java
15-
sibling.codegen.dir=../rabbitmq-codegen/
16-
spec.version=0.9.1
17-
bundle.out=${build.out}/bundle
18-
javadoc.out=build/doc/api
19-
python.bin=python

build.xml

Lines changed: 89 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0"?>
2-
<project name="RabbitMQ Java client" default="build">
2+
<project name="RabbitMQ Java client" default="build"
3+
xmlns:bundlor="antlib:com.springsource.bundlor.ant">
34

45
<property file="build.properties"/>
56
<property file="config.properties"/>
@@ -45,14 +46,14 @@
4546
unless="amqp.generate.notRequired" description="generate AMQP.java and AMQImpl.java from AMQP spec">
4647
<mkdir dir="${src.generated}/com/rabbitmq/client/"/>
4748
<exec dir="." executable="${python.bin}"
48-
errorproperty="amqp.generate.error1"
49+
errorproperty="amqp.generate.error1"
4950
resultproperty="amqp.generate.result1">
5051
<arg line="codegen.py"/>
5152
<arg line="header"/>
5253
<arg line="${AMQP_SPEC_JSON_PATH}"/>
5354
<arg line="${src.generated}/com/rabbitmq/client/AMQP.java"/>
5455
</exec>
55-
<fail message="Generation of AMQP.java failed with message:${line.separator}${amqp.generate.error1}">
56+
<fail message="Generation of AMQP.java failed with message:${line.separator}${amqp.generate.error1}">
5657
<condition>
5758
<not>
5859
<equals arg1="${amqp.generate.result1}" arg2="0" />
@@ -68,28 +69,28 @@
6869
<arg line="${AMQP_SPEC_JSON_PATH}"/>
6970
<arg line="${src.generated}/com/rabbitmq/client/impl/AMQImpl.java"/>
7071
</exec>
71-
<fail message="Generation of AMQPImpl.java failed with message:${line.separator}${amqp.generate.error2}">
72-
<condition>
73-
<not>
74-
<equals arg1="${amqp.generate.result2}" arg2="0" />
75-
</not>
76-
</condition>
77-
</fail>
72+
<fail message="Generation of AMQPImpl.java failed with message:${line.separator}${amqp.generate.error2}">
73+
<condition>
74+
<not>
75+
<equals arg1="${amqp.generate.result2}" arg2="0" />
76+
</not>
77+
</condition>
78+
</fail>
7879
</target>
7980

8081
<target name="build" depends="amqp-generate" description="Build the client library.">
8182
<mkdir dir="${javac.out}"/>
8283
<copy file="src/com/rabbitmq/client/impl/ClientVersion.java.in"
83-
tofile="${src.generated}/com/rabbitmq/client/impl/ClientVersion.java">
84+
tofile="${src.generated}/com/rabbitmq/client/impl/ClientVersion.java">
8485
<filterset>
85-
<filter token="VERSION" value="${impl.version}"/>
86+
<filter token="VERSION" value="${impl.version}"/>
8687
</filterset>
8788
</copy>
8889
<javac destdir="${javac.out}"
89-
classpathref="javac.classpath"
90-
source="${standard.javac.source}"
91-
target="${standard.javac.target}"
92-
debug="${javac.debug}">
90+
classpathref="javac.classpath"
91+
source="${standard.javac.source}"
92+
target="${standard.javac.target}"
93+
debug="${javac.debug}">
9394
<src path="src"/>
9495
<src path="${src.generated}"/>
9596
</javac>
@@ -178,22 +179,22 @@
178179
</target>
179180

180181
<target name="test-prepare">
181-
<property name="haltOnFailureJunit" value="yes" />
182-
<property name="haltOnFailureJava" value="true" />
182+
<property name="haltOnFailureJunit" value="yes" />
183+
<property name="haltOnFailureJava" value="true" />
183184
</target>
184185

185186
<target name="test-build" depends="test-prepare">
186-
<antcall target="test-build-param">
187-
<param name="javac.source" value="${standard.javac.source}"/>
188-
<param name="javac.target" value="${standard.javac.target}"/>
189-
</antcall>
187+
<antcall target="test-build-param">
188+
<param name="javac.source" value="${standard.javac.source}"/>
189+
<param name="javac.target" value="${standard.javac.target}"/>
190+
</antcall>
190191
</target>
191192

192193
<target name="test-build-alt" depends="test-prepare">
193-
<antcall target="test-build-param">
194-
<param name="javac.source" value="${alt.javac.source}"/>
195-
<param name="javac.target" value="${alt.javac.target}"/>
196-
</antcall>
194+
<antcall target="test-build-param">
195+
<param name="javac.source" value="${alt.javac.source}"/>
196+
<param name="javac.target" value="${alt.javac.target}"/>
197+
</antcall>
197198
</target>
198199

199200
<!-- Used to rebuild the tests every time, ( dependency on clean-tests )
@@ -317,18 +318,18 @@
317318
</target>
318319

319320
<target name="test-suite-prepare">
320-
<property name="haltOnFailureJunit" value="no" />
321-
<property name="haltOnFailureJava" value="false" />
321+
<property name="haltOnFailureJunit" value="no" />
322+
<property name="haltOnFailureJava" value="false" />
322323
</target>
323324

324325
<target name="test-suite" depends="test-suite-prepare, test-suite-run" description="Run all test suites.">
325-
<fail message="Errors occured in tests">
326-
<condition>
327-
<not>
328-
<equals arg1="${test.failure}" arg2="" />
329-
</not>
330-
</condition>
331-
</fail>
326+
<fail message="Errors occured in tests">
327+
<condition>
328+
<not>
329+
<equals arg1="${test.failure}" arg2="" />
330+
</not>
331+
</condition>
332+
</fail>
332333
</target>
333334

334335
<target name="test-suite-run" depends="test-client, test-ssl, test-server, test-functional, test-main-silent"/>
@@ -405,7 +406,7 @@
405406
</junit>
406407
</target>
407408

408-
<target name="jar" depends="build">
409+
<target name="jar" depends="build, bundlor.do">
409410
<mkdir dir="${lib.out}"/>
410411
<antcall target="doJarWithTags">
411412
<param name="jar.name" value="rabbitmq-client"/>
@@ -429,41 +430,42 @@
429430
token="VERSION" value="${impl.version}"/>
430431
</target>
431432

432-
<target name="test-jar" depends="test-build">
433+
<target name="test-jar" depends="test-build, test-bundlor.do">
433434
<mkdir dir="${lib.out}"/>
434435
<antcall target="doJarWithTags">
435436
<param name="jar.name" value="rabbitmq-client-tests"/>
436437
<param name="base" value="${test.javac.out}"/>
437438
</antcall>
438439
</target>
439-
440-
<target name="doJarWithTags">
441-
<jar destfile="${lib.out}/${jar.name}.jar"
442-
basedir="${base}">
443-
<manifest>
444-
<section name="${jar.name}">
445-
<attribute name="Specification-Title" value="AMQP"/>
446-
<attribute name="Specification-Version" value="${spec.version}"/>
447-
<attribute name="Specification-Vendor" value="AMQP Working Group (www.amqp.org)"/>
448-
<attribute name="Implementation-Title" value="RabbitMQ"/>
449-
<attribute name="Implementation-Version" value="${impl.version}"/>
450-
<attribute name="Implementation-Vendor" value="Rabbit Technologies Ltd. (www.rabbitmq.com)"/>
451-
</section>
452-
</manifest>
453-
</jar>
454-
</target>
440+
441+
<target name="doJarWithTags">
442+
<jar destfile="${lib.out}/${jar.name}.jar"
443+
basedir="${base}"
444+
filesetmanifest="merge">
445+
<manifest>
446+
<section name="${jar.name}">
447+
<attribute name="Specification-Title" value="AMQP"/>
448+
<attribute name="Specification-Version" value="${spec.version}"/>
449+
<attribute name="Specification-Vendor" value="AMQP Working Group (www.amqp.org)"/>
450+
<attribute name="Implementation-Title" value="RabbitMQ"/>
451+
<attribute name="Implementation-Version" value="${impl.version}"/>
452+
<attribute name="Implementation-Vendor" value="Rabbit Technologies Ltd. (www.rabbitmq.com)"/>
453+
</section>
454+
</manifest>
455+
</jar>
456+
</target>
455457

456458
<target name="dist" depends="jar, test-jar">
457459
<mkdir dir="${dist.out}"/>
458460
<copy todir="${dist.out}">
459461
<!-- ant doesn't seem to provide any form of usable abstraction over sets of file names -->
460462
<!-- consequently we repeat ourselves here. see definition of javac.classpath, supra -->
461463
<fileset dir="lib">
462-
<include name="**/*.jar"/>
464+
<include name="**/*.jar"/>
463465
</fileset>
464466

465467
<fileset dir="${lib.out}">
466-
<include name="**/*.jar"/>
468+
<include name="**/*.jar"/>
467469
</fileset>
468470

469471
<fileset dir="scripts">
@@ -510,4 +512,36 @@
510512
<target name="clean-tests">
511513
<delete dir="build/test"/>
512514
</target>
515+
516+
<target name="bundlor.init">
517+
<taskdef resource="com/springsource/bundlor/ant/antlib.xml"
518+
uri="antlib:com.springsource.bundlor.ant">
519+
<classpath id="bundlor.classpath">
520+
<fileset dir="${bundlor.home}/dist"/>
521+
<fileset dir="${bundlor.home}/lib"/>
522+
</classpath>
523+
</taskdef>
524+
</target>
525+
526+
<target name="bundlor.do" depends="bundlor.init">
527+
<bundlor:bundlor
528+
inputPath="${javac.out}"
529+
outputPath="${javac.out}"
530+
manifestTemplatePath="bundlorTemplate.mf">
531+
<propertyset>
532+
<propertyref builtin="all"/>
533+
</propertyset>
534+
</bundlor:bundlor>
535+
</target>
536+
537+
<target name="test-bundlor.do" depends="bundlor.init">
538+
<bundlor:bundlor
539+
inputPath="${test.javac.out}"
540+
outputPath="${test.javac.out}"
541+
manifestTemplatePath="bundlorTestTemplate.mf">
542+
<propertyset>
543+
<propertyref builtin="all"/>
544+
</propertyset>
545+
</bundlor:bundlor>
546+
</target>
513547
</project>
131 KB
Binary file not shown.
16.6 KB
Binary file not shown.
13.3 KB
Binary file not shown.
Binary file not shown.
40.6 KB
Binary file not shown.
42.5 KB
Binary file not shown.
32.5 KB
Binary file not shown.
22 KB
Binary file not shown.

0 commit comments

Comments
 (0)