Saturday, 27 February 2010

Delphi/Surround/ howto (updated)

This is a further draft of what I had to do to get CruiseControl.Net and Delphi to play nicely - I will fill out further the details later!

  1. Configured IIS in Windows (see here)
  2. Install CruiseControl.Net 3.5 RC1 (see release notes) - Make sure that the user that the CruiseControl.Net is being run by is able to see and use Delphi (i.e. probably not by default)
  3. Install CCTray
  4. Set the BDS environment setting to point to where Delphi lives (this may have been done when Delphi was installed)
  5. Create a definitions.xml file that has all of the required defaults, for accessing Surround, MSBuild, etc.
  6. Create a project to test. It is difficult to post a real example, as this is code that my company owns, rather than me, but an example could be pulled out and added to this article.
  7. Setup connection to Seapine Surround. I had a real problem with using Delphi and Surround, as by default the code is checked out as readonly, and Delphi needs to write to the working directory (especially when building typelibraries, etc). I have not spent too much time fiddling with it as I have a patch for the CruiseControl.NET source.
  8. Setup the MSBuild section to build the application (in the definitions.xml file)
  9. Setup the configuration to be managed by CruiseControl.NET and Surround, so that the files can be just checked out, modified and then checked in again - this avoids having to access the server machine.
  10. Each developer now gets emailed whenever a build fails, and we can see the running of tests as well, after each build, see below.
  11. Modify the DUnit tests to output XML.

This I did using the code from the link above, and changed the base UnitTest program code to look like this:

res : TTestResult;


if IsConsole then
if ParamCount <> 0 then
if (copy(ParamStr(1), 0, 5) = '/xml=') then
res := XMLTestRunner.RunRegisteredTests(copy(ParamStr(1), 6, length(ParamStr(1)) -5))
res := TextTestRunner.RunRegisteredTests
res := TextTestRunner.RunRegisteredTests

if (res.ErrorCount <> 0) then
halt (1);

Other things I have done ...

  • Modify (legally I'm not sure if I can publish it) the code from Run-Time Systems Cyclomatic Complexity Calculator for Delphi so that it outputs the results as an XML file - it actually does this already internally, but doesn't write the results out.
  • Create a task to generate developer documentation using doc-o-matic as a task.

No comments: