Saturday, 27 February 2010

Delphi/Surround/Cruisecontrol.net 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:

var
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))
else
res := TextTestRunner.RunRegisteredTests
else
res := TextTestRunner.RunRegisteredTests
else
GUITestRunner.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.

Saturday, 2 January 2010

MVC Framework in Delphi

A real world example can be found here on Joanna Carter's pages.

Thursday, 7 May 2009

CI Updated

I now have all of our projects in CCNET, and am using this to control the port of code to Delphi 2009. I am also moving code around, so this helps. I had to patch a few things, but I have DUnit outputing xml that is then picked up by CCNET and displayed graphically (this is cool).

I have also taken the Cyclometric Complexity tool that I use and created a command-line version (this used the OTA interface before), which also outputs to XML. I'll then plug this into the projects and this will allow us to automatically measure complexity!

Thursday, 16 April 2009

Getting testing working

OK, so I have the source checked out, and then I have built it. I even have a test application, that outputs XML. However, we have a graphical login. So I need to be able to pass in the signon somehow. OK, so I need to think a bit more about this.

Tuesday, 7 April 2009

Cruisecontrol.net howto (draft)

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

1. Install Apache 2.
2. Install Mod_ASPDotNet.
3. Install CruiseControl.Net.
4. Install CCTray.
5. Create a project to test.
7. Setup connection to Seapine Surround.
8. Setup the MSBuild section to build the application.
9. Modify the DUnit tests to output XML.

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

var
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))
else
res := TextTestRunner.RunRegisteredTests
else
res := TextTestRunner.RunRegisteredTests
else
GUITestRunner.RunRegisteredTests;

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



More later!

Monday, 6 April 2009

CI Update

Well, after much messing about I now have CI working for Delphi. It checks out the code from Surround (easy to configure), calls MSBuild (again easy), and this then compiles the Delphi source (tricky and required me to mess about and reinstall CruiseControl.NET). It now checks out 5 projects (3 of which compile, 1 fails due to a missed file, and 1 needs an project to be registered), which is about what I expected.

Hurrah!