1 <!-- NAnt build file. -*- nxml -*- -->
2 <project name="RabbitMQ C# Client" default="build" basedir=".">
4 <property name="target.framework" value="mono-2.0" />
5 <property name="debug" value="false"/>
6 <property name="msbuild" value="msbuild"/>
8 <property name="build.dir" value="build"/>
9 <property name="bin.dir" value="${build.dir}/bin" />
10 <property name="dist.dir" value="${build.dir}/dist" />
11 <property name="wcf.dist.dir" value="${dist.dir}/wcf" />
12 <property name="doc.dir" value="${build.dir}/doc" />
13 <property name="gendoc.xml.dir" value="${doc.dir}/xml" />
14 <property name="gendoc.html.dir" value="${doc.dir}/html" />
15 <property name="gensrc.dir" value="${build.dir}/gensrc" />
16 <property name="apigen.exename" value="${bin.dir}/rabbitmq-dotnet-apigen.exe" />
17 <property name="target.dllname.base" value="RabbitMQ.Client" />
18 <property name="target.dllname" value="${bin.dir}/${target.dllname.base}.dll" />
19 <property name="bootstrap.dllname" value="${bin.dir}/apigen-bootstrap.dll" />
20 <property name="existence.test.probe" value="${gensrc.dir}/autogenerated-api-0-9.cs"/>
21 <property name="unit-tests.dllname" value="${bin.dir}/unit-tests.dll"/>
22 <property name="nunit.dllname" value="src/unit/nunit/nunit.framework.dll"/>
24 <property name="core.assemblyinfo.src" value="src/client/api/AssemblyInfo.cs.in"/>
25 <property name="core.assemblyinfo.target" value="${gensrc.dir}/AssemblyInfo.cs"/>
26 <property name="wcf.assemblyinfo.src" value="src/wcf/RabbitMQ.ServiceModel/AssemblyInfo.cs.in"/>
27 <property name="wcf.assemblyinfo.target" value="src/wcf/RabbitMQ.ServiceModel/AssemblyInfo.cs"/>
29 <property name="wcf.bin.dir" value="src/wcf/RabbitMQ.ServiceModel/bin"/>
30 <property name="wcf.test.bin.dir" value="src/wcf/Test/bin"/>
32 <property name="hg.exec" value="/usr/bin/hg" />
34 <include buildfile="local.build" />
35 <include buildfile="configs/${config.name}.build" />
36 <property name="nant.settings.currentframework" value="${target.framework}" />
38 <property name="fullversion" value="${version.major.minor.release}"/>
39 <property name="version.assembly" value="${fullversion}.0" />
41 <property name="nameversion" value="rabbitmq-dotnet-client-${fullversion}"/>
42 <property name="release.dir" value="releases/rabbitmq-dotnet-client"/>
43 <property name="release.version.dir" value="${release.dir}/v${fullversion}"/>
44 <property name="release.src.zip" value="${nameversion}.zip" />
46 <target name="clean" description="remove all generated files"
47 depends="clean-base,clean-wcf" />
49 <target name="clean-base" description="remove all generated files in the core client">
50 <delete dir="${build.dir}" failonerror="false" />
53 <target name="clean-wcf" description="remove all generated files in the WCF binding">
54 <delete dir="${wcf.bin.dir}" failonerror="false" />
55 <delete dir="${wcf.test.bin.dir}" failonerror="false" />
56 <delete dir="src/wcf/RabbitMQ.ServiceModel/obj" failonerror="false" />
57 <delete dir="src/wcf/Test/obj" failonerror="false" />
58 <delete dir="src/wcf/ConfigDemo/Client/bin" failonerror="false"/>
59 <delete dir="src/wcf/ConfigDemo/Client/obj" failonerror="false"/>
60 <delete dir="src/wcf/ConfigDemo/Server/bin" failonerror="false"/>
61 <delete dir="src/wcf/ConfigDemo/Server/obj" failonerror="false"/>
62 <delete dir="src/wcf/ConfigDemo/WcfServiceLibrary1/bin" failonerror="false"/>
63 <delete dir="src/wcf/ConfigDemo/WcfServiceLibrary1/obj" failonerror="false"/>
64 <delete file="${wcf.assemblyinfo.target}" failonerror="false"/> <!-- it's autogenerated -->
67 <target name="generate-assemblyinfo">
68 <if test="${(not file::up-to-date(gen.assemblyinfo.src, gen.assemblyinfo.target))}">
69 <delete file="${gen.assemblyinfo.target}" failonerror="false" />
70 <copy file="${gen.assemblyinfo.src}" tofile="${gen.assemblyinfo.target}">
73 <token key="VERSION" value="${version.assembly}" />
80 <target name="build" description="compiles the source code"
81 depends="generate-api">
82 <mkdir dir="${bin.dir}" />
83 <mkdir dir="${doc.dir}" />
84 <property name="gen.assemblyinfo.src" value="${core.assemblyinfo.src}"/>
85 <property name="gen.assemblyinfo.target" value="${core.assemblyinfo.target}"/>
86 <call target="generate-assemblyinfo"/>
88 output="${target.dllname}"
89 doc="${bin.dir}/${target.dllname.base}.xml"
92 <include name="src/client/**/*.cs" />
93 <include name="src/util/**/*.cs" />
94 <include name="${gensrc.dir}/**/*.cs" />
97 <warning number="1591"/>
102 <target name="build-wcf" description="Builds the WCF component. Requires .NET 3.0."
104 <property name="gen.assemblyinfo.src" value="${wcf.assemblyinfo.src}"/>
105 <property name="gen.assemblyinfo.target" value="${wcf.assemblyinfo.target}"/>
106 <call target="generate-assemblyinfo"/>
107 <exec program="${msbuild}" workingdir="src/wcf/RabbitMQ.ServiceModel">
108 <arg value="RabbitMQ.ServiceModel.csproj"/>
112 <target name="wcf-examples" description="Builds the WCF examples. Requires .NET 3.0."
114 <exec program="${msbuild}" workingdir="src/wcf/Test">
115 <arg value="RabbitMQ.ServiceModel.Test.csproj"/>
117 <exec program="${msbuild}" workingdir="src/wcf/ConfigDemo/WcfServiceLibrary1">
118 <arg value="WcfServiceLibrary1.csproj"/>
120 <exec program="${msbuild}" workingdir="src/wcf/ConfigDemo/Server">
121 <arg value="Server.csproj"/>
123 <exec program="${msbuild}" workingdir="src/wcf/ConfigDemo/Client">
124 <arg value="Client.csproj"/>
128 <target name="wcf-doc" description="produces HTML documentation from the code"
130 <property name="wcf.xml.dir" value="${wcf.bin.dir}/Debug/doc/xml"/>
131 <property name="wcf.html.dir" value="${wcf.bin.dir}/Debug/doc/html"/>
132 <delete dir="${wcf.xml.dir}" failonerror="false" />
133 <delete dir="${wcf.html.dir}" failonerror="false" />
134 <mkdir dir="${wcf.xml.dir}" />
135 <mkdir dir="${wcf.html.dir}" />
136 <exec program="tools/ndocproc-bin/bin/ndocproc.exe" useruntimeengine="true">
137 <arg value="/nosubtypes"/>
138 <arg value="${wcf.xml.dir}"/>
139 <arg value="${wcf.bin.dir}/Debug/RabbitMQ.ServiceModel.xml"/>
140 <arg value="docs/namespaces.xml"/>
142 <nant buildfile="tools/ndocproc-bin/xsl/transform-xml.build">
144 <property name="xml.dir" value="${project::get-base-directory()}/${wcf.xml.dir}"/>
145 <property name="html.dir" value="${project::get-base-directory()}/${wcf.html.dir}"/>
148 <copy file="tools/ndocproc-bin/xsl/style.css" todir="${wcf.html.dir}"/>
151 <target name="stamp" description="removes the version identifier, so that the next build generates a fresh one">
152 <delete file="${assemblyinfo.target}" failonerror="false" />
155 <target name="doc" description="produces HTML documentation from the code"
156 depends="build,generate-docs,copy-stylesheet" />
158 <target name="generate-docs">
159 <delete dir="${gendoc.xml.dir}" failonerror="false" />
160 <delete dir="${gendoc.html.dir}" failonerror="false" />
161 <mkdir dir="${gendoc.xml.dir}" />
162 <mkdir dir="${gendoc.html.dir}" />
163 <exec program="tools/ndocproc-bin/bin/ndocproc.exe" useruntimeengine="true">
164 <arg value="/nosubtypes"/>
165 <arg value="/suppress:RabbitMQ.Client.Framing.v0_8"/>
166 <arg value="/suppress:RabbitMQ.Client.Framing.v0_8qpid"/>
167 <arg value="/suppress:RabbitMQ.Client.Framing.v0_9"/>
168 <arg value="/suppress:RabbitMQ.Client.Framing.Impl.v0_8"/>
169 <arg value="/suppress:RabbitMQ.Client.Framing.Impl.v0_8qpid"/>
170 <arg value="/suppress:RabbitMQ.Client.Framing.Impl.v0_9"/>
171 <arg value="/suppress:RabbitMQ.Client.Impl"/>
172 <arg value="/suppress:RabbitMQ.Client.Apigen.Attributes"/>
173 <arg value="${gendoc.xml.dir}"/>
174 <arg value="${bin.dir}/${target.dllname.base}.xml"/>
175 <arg value="docs/namespaces.xml"/>
177 <nant buildfile="tools/ndocproc-bin/xsl/transform-xml.build">
179 <property name="xml.dir" value="${project::get-base-directory()}/${gendoc.xml.dir}"/>
180 <property name="html.dir" value="${project::get-base-directory()}/${gendoc.html.dir}"/>
185 <target name="copy-stylesheet">
186 <copy file="tools/ndocproc-bin/xsl/style.css" todir="${gendoc.html.dir}"/>
189 <target name="generate-api" description="runs apigen to build the autogen part of the client"
191 <if test="${(not file::up-to-date(bootstrap.dllname,existence.test.probe)) or
192 (not file::up-to-date(apigen.exename,existence.test.probe))}">
193 <delete file="${existence.test.probe}" failonerror="false"/>
195 <if test="${not file::exists(existence.test.probe)}">
196 <mkdir dir="${gensrc.dir}" />
197 <exec program="${apigen.exename}" useruntimeengine="true">
198 <arg value="/apiName:AMQP_0_9"/>
199 <arg value="docs/specs/amqp0-9.xml"/>
200 <arg value="${gensrc.dir}/autogenerated-api-0-9.cs" />
202 <exec program="${apigen.exename}" useruntimeengine="true">
203 <arg value="/apiName:AMQP_0_8_QPID"/>
204 <arg value="/n:v0_8qpid"/>
205 <arg value="docs/specs/qpid-amqp.0-8.xml"/>
206 <arg value="${gensrc.dir}/autogenerated-api-qpid-0-8.cs" />
208 <exec program="${apigen.exename}" useruntimeengine="true">
209 <arg value="/apiName:AMQP_0_8"/>
210 <arg value="/n:v0_8"/>
211 <arg value="docs/specs/amqp0-8.xml"/>
212 <arg value="${gensrc.dir}/autogenerated-api-0-8.cs" />
217 <target name="apigen" description="compile the API autogeneration tool"
218 depends="bootstrap-model">
219 <mkdir dir="${bin.dir}" />
220 <csc target="exe" output="${apigen.exename}" debug="true">
222 <include name="src/apigen/**/*.cs" />
225 <include name="${bootstrap.dllname}"/>
230 <target name="bootstrap-model" description="compile the apigen bootstrap DLL">
231 <mkdir dir="${bin.dir}" />
232 <csc target="library"
233 output="${bootstrap.dllname}"
236 <include name="src/client/api/IModel.cs" />
237 <include name="src/client/api/IContentHeader.cs" />
238 <include name="src/client/api/IBasicProperties.cs" />
239 <include name="src/client/api/IFileProperties.cs" />
240 <include name="src/client/api/IStreamProperties.cs" />
241 <include name="src/client/api/AmqpTimestamp.cs" />
242 <include name="src/client/api/IBasicConsumer.cs" />
243 <include name="src/client/api/ShutdownEventArgs.cs" />
244 <include name="src/client/api/ShutdownInitiator.cs" />
245 <include name="src/client/api/PublicationAddress.cs" />
246 <include name="src/client/events/BasicReturnEventArgs.cs" />
247 <include name="src/client/events/BasicReturnEventHandler.cs" />
248 <include name="src/client/events/CallbackExceptionEventArgs.cs" />
249 <include name="src/client/events/CallbackExceptionEventHandler.cs" />
250 <include name="src/client/events/ModelShutdownEventHandler.cs"/>
255 <target name="one-example">
256 <csc target="exe" output="${bin.dir}/${example.program}.exe" debug="true">
258 <include name="src/examples/${example.program}.cs" />
261 <include name="${target.dllname}"/>
266 <target name="examples" description="compile C# client sample code"
268 <mkdir dir="${bin.dir}" />
269 <property name="example.program" value="SendString"/><call target="one-example"/>
270 <property name="example.program" value="SendMap"/><call target="one-example"/>
271 <property name="example.program" value="LogTail"/><call target="one-example"/>
272 <property name="example.program" value="SingleGet"/><call target="one-example"/>
273 <property name="example.program" value="ExceptionTest"/><call target="one-example"/>
274 <property name="example.program" value="DeclareQueue"/><call target="one-example"/>
275 <property name="example.program" value="AddServer"/><call target="one-example"/>
276 <property name="example.program" value="AddClient"/><call target="one-example"/>
279 <target name="build-unit" description="compile unit tests"
281 <mkdir dir="${bin.dir}" />
282 <csc target="library" output="${unit-tests.dllname}" debug="true">
284 <include name="src/unit/*.cs" />
287 <include name="${target.dllname}"/>
288 <include name="${nunit.dllname}"/>
291 <copy file="${nunit.dllname}" todir="${bin.dir}"/>
294 <target name="unit" description="run unit tests"
295 depends="build-unit">
296 <exec program="src/unit/nunit/nunit-console.exe" useruntimeengine="true">
297 <arg value="${unit-tests.dllname}"/>
301 <target name="dist" description="build a binary distribution zip"
302 depends="clean,doc,build-doc-zip,dist-dir,build-dist-zip"/>
304 <target name="wcf-dist" description="build a binary distribution zip"
305 depends="clean,doc,build-doc-zip,wcf-doc,build-wcf-doc-zip,wcf-dist-dir,build-wcf-dist-zip"/>
307 <target name="build-doc-zip" description="(internal) zips up a HTML doc distribution">
308 <property name="fq.dist"
309 value="${nameversion}-${target.framework}-htmldoc"/>
310 <property name="doc.zip.source.dir" value="${gendoc.html.dir}"/>
311 <call target="generic-build-doc-zip"/>
314 <target name="build-wcf-doc-zip" description="(internal) zips up a WCF HTML doc distribution">
315 <property name="fq.dist"
316 value="${nameversion}-net-3.0-wcf-htmldoc"/>
317 <property name="doc.zip.source.dir" value="${wcf.bin.dir}/Debug/doc/html"/>
318 <call target="generic-build-doc-zip"/>
321 <target name="generic-build-doc-zip">
322 <property name="fq.dist.dir" value="${build.dir}/${fq.dist}"/>
323 <property name="fq.dist.zipname" value="${fq.dist.dir}.zip"/>
324 <mkdir dir="${fq.dist.dir}"/>
325 <copy todir="${fq.dist.dir}">
326 <fileset basedir="${doc.zip.source.dir}">
327 <include name="**/*"/>
330 <copy todir="${fq.dist.dir}">
332 <include name="LICENSE"/>
333 <include name="LICENSE-APACHE2"/>
334 <include name="LICENSE-MPL-RabbitMQ"/>
337 <zip zipfile="${fq.dist.zipname}" encoding="ASCII">
338 <fileset basedir="${fq.dist.dir}" prefix="${fq.dist}">
339 <include name="**/*"/>
342 <delete dir="${fq.dist.dir}"/>
345 <target name="build-dist-zip" description="(internal) zips up a binary distribution">
346 <property name="basename.suffix" value=""/>
347 <call target="generic-build-dist-zip"/>
350 <target name="build-wcf-dist-zip" description="(internal) zips up a binary distribution">
351 <property name="target.framework" value="net-3.0"/>
352 <property name="basename.suffix" value="-wcf"/>
353 <call target="generic-build-dist-zip"/>
356 <target name="generic-build-dist-zip" description="(internal) zips up a binary distribution">
357 <property name="fq.dist" value="${nameversion}-${target.framework}${basename.suffix}"/>
358 <property name="fq.dist.dir" value="${build.dir}/${fq.dist}"/>
359 <property name="fq.dist.zipname" value="${fq.dist.dir}.zip"/>
360 <move todir="${fq.dist.dir}">
361 <fileset basedir="${dist.dir}">
362 <include name="**/*"/>
365 <delete dir="${dist.dir}"/>
366 <zip zipfile="${fq.dist.zipname}" encoding="ASCII">
367 <fileset basedir="${fq.dist.dir}" prefix="${fq.dist}">
368 <include name="**/*"/>
371 <delete dir="${fq.dist.dir}"/>
374 <target name="dist-dir" description="clean and build a binary distribution (not packed into a zip)"
375 depends="clean,examples,build-dist-dir"/>
377 <target name="wcf-dist-dir" description="clean and build a WCF binary distribution (not packed into a zip)"
378 depends="dist-dir,wcf-examples,build-wcf-dist-dir"/>
380 <target name="build-dist-dir" description="(internal) just copy files into a dist dir, without cleaning or stamping">
381 <delete dir="${dist.dir}" failonerror="false"/>
382 <mkdir dir="${dist.dir}"/>
383 <copy todir="${dist.dir}">
385 <include name="README.txt"/>
386 <include name="LICENSE"/>
387 <include name="LICENSE-APACHE2"/>
388 <include name="LICENSE-MPL-RabbitMQ"/>
392 <token key="FULLVERSION" value="${fullversion}" />
396 <mkdir dir="${dist.dir}/bin"/>
397 <copy todir="${dist.dir}/bin" flatten="true">
399 <include name="${target.dllname}"/>
400 <include name="${bin.dir}/SendString.exe"/>
401 <include name="${bin.dir}/SendMap.exe"/>
402 <include name="${bin.dir}/LogTail.exe"/>
403 <include name="${bin.dir}/SingleGet.exe"/>
404 <include name="${bin.dir}/ExceptionTest.exe"/>
405 <include name="${bin.dir}/DeclareQueue.exe"/>
408 <mkdir dir="${dist.dir}/examples"/>
409 <copy todir="${dist.dir}/examples">
410 <fileset basedir="src/examples">
411 <include name="**/*.cs"/>
416 <target name="build-wcf-dist-dir" description="(internal) just copy WCF files into a dist dir, without cleaning or stamping">
417 <delete dir="${wcf.dist.dir}" failonerror="false"/>
418 <mkdir dir="${wcf.dist.dir}"/>
420 <mkdir dir="${wcf.dist.dir}/bin"/>
421 <copy todir="${wcf.dist.dir}/bin">
422 <fileset basedir="${wcf.bin.dir}">
423 <include name="Debug/*"/>
424 <exclude name="Debug/doc"/>
425 <include name="Release/*"/>
426 <exclude name="Release/doc"/>
430 <mkdir dir="${wcf.dist.dir}/doc"/>
431 <copy todir="${wcf.dist.dir}/doc">
432 <fileset basedir="docs">
433 <include name="RabbitMQ Service Model.*"/>
437 <mkdir dir="${wcf.dist.dir}/examples/basic/bin"/>
438 <copy todir="${wcf.dist.dir}/examples/basic/bin">
439 <fileset basedir="${wcf.test.bin.dir}">
440 <include name="Debug/**/*"/>
441 <include name="Release/**/*"/>
445 <mkdir dir="${wcf.dist.dir}/examples/basic/source"/>
446 <copy todir="${wcf.dist.dir}/examples/basic/source">
447 <fileset basedir="src/wcf/Test">
448 <include name="**/*.cs"/>
449 <include name="**/*.csproj"/>
450 <include name="**/*.config"/>
451 <exclude name="bin/**/*"/>
455 <mkdir dir="${wcf.dist.dir}/examples/config-demo/bin"/>
456 <copy todir="${wcf.dist.dir}/examples/config-demo/bin">
457 <fileset basedir="src/wcf/ConfigDemo/Server/bin">
458 <include name="Debug/**/*"/>
459 <include name="Release/**/*"/>
462 <copy todir="${wcf.dist.dir}/examples/config-demo/bin">
463 <fileset basedir="src/wcf/ConfigDemo/Client/bin">
464 <include name="Debug/**/*"/>
465 <include name="Release/**/*"/>
469 <mkdir dir="${wcf.dist.dir}/examples/config-demo/source"/>
470 <copy todir="${wcf.dist.dir}/examples/config-demo/source">
471 <fileset basedir="src/wcf/ConfigDemo">
472 <include name="**/*.cs"/>
473 <include name="**/*.csproj"/>
474 <include name="**/*.sln"/>
475 <include name="**/*.config"/>
476 <exclude name="**/bin/**/*"/>
481 <target name="release-dir">
482 <delete dir="${release.dir}" failonerror="false"/>
483 <mkdir dir="${release.version.dir}"/>
486 <target name="copy-deliverables">
487 <copy todir="${release.version.dir}">
488 <fileset basedir="${build.dir}">
489 <include name="*.zip"/>
494 <target name="src-dist" description="create zip from current state of the repository">
495 <mkdir dir="${build.dir}"/>
496 <exec program="${python.exec}">
497 <arg value="${hg.exec}"/>
498 <arg value="archive"/>
502 <arg value="${fullversion}"/>
503 <arg value="${build.dir}/${release.src.zip}" />
507 <target name="windows-deliverables"
508 depends="release-dir">
509 <call target="dist"/>
510 <zip zipfile="${build.dir}/${nameversion}-tmp-xmldoc.zip" encoding="ASCII">
511 <fileset basedir="${gendoc.xml.dir}">
512 <include name="**/*"/>
515 <call target="copy-deliverables"/>
516 <call target="clean"/>
517 <call target="wcf-dist"/>
518 <call target="copy-deliverables"/>
519 <call target="clean"/>
520 <call target="src-dist"/>
521 <call target="copy-deliverables"/>