blob: 9a13ba91132e768a4a7013591776e05042b06900 [file] [log] [blame]
<div class="wiki-content maincontent"><h2>Building NMS</h2><p>Currently our main build tool for NMS is <a shape="rect" href="http://nant.sourceforge.net/">NAnt</a>.</p><structured-macro ac:macro-id="cd851e40-51da-4354-9757-59ae2cad278a" ac:name="tip" ac:schema-version="1"><parameter ac:name="title">Setup For *NIX Users</parameter><rich-text-body><ul><li>Install <a shape="rect" href="http://www.mono-project.com">Mono</a></li><li><p>On some operating systems (e.g. OS X), you may need to point the <strong>PKG_CONFIG_PATH</strong> environment variable at the mono packages</p><structured-macro ac:macro-id="e7bed819-de8c-437a-ab84-d93eec8d82f4" ac:name="noformat" ac:schema-version="1"><plain-text-body>export PKG_CONFIG_PATH="/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig/:${PKG_CONFIG_PATH}"
</plain-text-body></structured-macro></li><li>Depending on your installation of <a shape="rect" href="http://www.mono-project.com">Mono</a>, you may need additional steps to get NAnt going on OS X. The more recent versions of the Mono installer for OS X seem to set things up properly. However, if you are having problems running NAnt, try the following:<ul><li>download the binary of <a shape="rect" href="http://nant.sourceforge.net/">NAnt</a></li><li>create a script file called nant</li><li>chmod a+x nant</li><li><p>put the following into the script...</p><structured-macro ac:macro-id="bbe1b5e9-c409-48e5-8ae5-7d72c9f9da78" ac:name="noformat" ac:schema-version="1"><plain-text-body>#!/bin/sh
exec /usr/bin/mono /path/to/nant/NAnt.exe "$@"
</plain-text-body></structured-macro></li></ul></li></ul><p>Thanks to the hints from <a shape="rect" href="http://cs-sdl.sourceforge.net/index.php/The_absolute_newbies_guide_to_SDL.NET">this page</a>.</p></rich-text-body></structured-macro><h3>Building NMS with Nant</h3><p>There are two steps to build the NMS project code, we'll look at each now.</p><h4>Setting up your NAnt Repository.</h4><p>Before you can build the NMS API and the various provider libraries you need to initialize your local NAnt repository so that you have all the required dependencies available for the provider's NAnt build scripts to pull in during their builds. We maintain a tree in the NMS SVN repo with all the required dependencies which allow you to easily populate you NAnt repo. You can check out this tree by executing the following:</p><structured-macro ac:macro-id="86ea8e40-59d7-4664-a9da-10036af9af90" ac:name="noformat" ac:schema-version="1"><plain-text-body>svn co https://svn.apache.org/repos/asf/activemq/activemq-dotnet/vendor/
</plain-text-body></structured-macro><p>Now that you have the vendor tree checkout out you can install the various libaries into you NAnt repo by running each one's build script and with the 'install' target. You will need nant-0.91 or higher. The version 0.90 won't work. Let's take the NUnit testing framework libraries as an example, you install them like so:</p><structured-macro ac:macro-id="2ef2e3db-85c4-401d-b73f-a40f820da55f" ac:name="noformat" ac:schema-version="1"><plain-text-body>cd ./activemq-dotnet/vendor/NUnit/2.5.8
nant install
</plain-text-body></structured-macro><p>Install each of the vendor libraries using the same process and then you are ready to build the NMS libraries.</p><h4>Building the NMS API and Provider libraries.</h4><p>To build the code with Nant you will need to build the individual modules, starting with the main NMS module first. Following are the steps needed to build all of the modules, but depending on which provider you are using, you may only need to build the main Apache.NMS module and then your specific provider module. For example, if you are only working with ActiveMQ, then you would need to build the Apache.NMS module and the Apache.NMS.ActiveMQ provider module. Here are the steps to build all of the modules for the trunk version. Modify the paths to build a particular tag release (e.g., change the <strong>trunk</strong> folder to <strong>tags\1.0.0</strong>):</p><structured-macro ac:macro-id="e10124cb-b80f-480b-b95a-1aa286c8a299" ac:name="noformat" ac:schema-version="1"><plain-text-body>cd activemq-dotnetcd Apache.NMS\trunk
nant
cd ..\..\Apache.NMS.ActiveMQ\trunk
nant
cd ..\..\Apache.NMS.AMQP\trunk
nant
cd ..\..\Apache.NMS.EMS\trunk
nant
cd ..\..\Apache.NMS.MQTT\trunk
nant
cd ..\..\Apache.NMS.MSMQ\trunk
nant
cd ..\..\Apache.NMS.Stomp\trunk
nant
cd ..\..\Apache.NMS.WCF\trunk
nant
cd ..\..\Apache.NMS.ZMQ\trunk
nant </plain-text-body></structured-macro><p>This will build all of the providers. The only module that needs to be built first is the Apache.NMS module, as all of the other provider modules depend upon that module. <strong>IMPORTANT:</strong> In order to build the Apache.NMS.EMS module, you must have a licensed copy of the TIBCO.EMS.dll. This module is not available from The Apache Software Foundation.</p><structured-macro ac:macro-id="972b1522-2be5-411c-b495-de86a7ad85b5" ac:name="warning" ac:schema-version="1"><parameter ac:name="title">Running the Unit Tests</parameter><rich-text-body><p>The unit tests depend on an ActiveMQ broker running on tcp://localhost:61616 so that the test cases can connect to ActiveMQ and send and receive messages etc. So if you have a distribution of ActiveMQ, <a shape="rect" href="http://activemq.apache.org/getting-started.html#GettingStarted-StartingActiveMQ">run the broker</a> first before testing Apache.NMS.ActiveMQ.</p></rich-text-body></structured-macro><p>If you want to run a build with the unit tests (assuming you have a broker running) then type the following from the <strong>trunk</strong> folder of the provider module:</p><structured-macro ac:macro-id="553fdf82-7d60-41c8-9c58-213e096c32ba" ac:name="noformat" ac:schema-version="1"><plain-text-body>nant test
</plain-text-body></structured-macro><p>Alternatively, you can use the NUnit graphical interface to load the appropriate module's nunit project file. Each project includes a file named Apache.NMS.<em>modulename</em>.Test.nunit, where <em>modulename</em> matches the provider module's name (e.g., ActiveMQ, AMQP, EMS, MQTT, MSMQ, Stomp, WCF, or ZMQ). This file can be loaded into the NUnit's graphical application to run all of the unit tests and see their output.</p><h2>IDE Tips</h2><p>If you are on windows then you probably want to use Visual Studio 2008; we highly recommend using <a shape="rect" href="http://www.jetbrains.com/resharper/">ReSharper</a> as well, - its a shame there is not a distro for OS X and Linux <emoticon ac:name="sad"></emoticon>.</p><h3>Using <a shape="rect" href="http://monodevelop.com/">MonoDevelop</a> to edit C#</h3><p>If you are on OS X or Linux (and even Windows nowdays) we recommend the use of <a shape="rect" href="http://monodevelop.com">MonoDevelop</a> for editing, refactoring and running the code. MonoDevelop can load the NMS Visual Studio Project files, and is integrated with the Mono debugger as well.</p><h3>Using Eclipse to edit C#</h3><p>You can use Eclipse as your IDE to edit C# code.</p><p>If you want to use Eclipse there are the following two C# eclipse plugins we are aware of</p><ul><li><a shape="rect" href="http://emonic.sourceforge.net/">Emonic</a></li><li><a shape="rect" href="http://black-sun.sourceforge.net/">BlackSun</a></li><li><a shape="rect" href="http://www.improve-technologies.com/alpha/esharp/">Improve C#</a></li></ul><p>We tend to use BlackSun as it has auto-format and outline view support along with compiler warnings (though you might want to change the default font size).</p></div>