Warren  P
Warren P

Reputation: 68902

Sample cruisecontrol.net ccnet.config that works with msbuild and delphi XE?

I asked some time ago for help getting continuous integration working in Delphi previously. One side-answer has partial incomplete (not working for me) information [here][2] for using cruisecontrol.

I have gotten Jenkins/Hudson working, and the easy part about it is that (with Delphi) the configuration is done purely through the Web browser. However with CruiseControl.net is much more difficult to set up.

I would like to see a sample ccnet.config that will build a hello-world delphi project (Project1.dproj) using MSBUILD, from CruiseControl, and auto-rebuild each time that the subversion (or mercurial) upstream sources are modified.

So far I have:

Here's my ccnet.config, originally I had <exec> and changed as suggested below to <msbuild>:

<cruisecontrol xmlns:cb="urn:ccnet.config.builder">
        <!-- CRUISECONTROL.NET Server configuration -->
        <project name="Project1">
            <tasks>
                <msbuild>
                    <projectFile>project1.dproj</projectFile>
                </msbuild>
            </tasks>
        </project>
</cruisecontrol>

Update: I was originally unable to make it read c:\builds\ccnet.config from ccnet.exe but I found that I could run ccnet.exe (non-service mode) with a command line parameter and that got me around the problem finding my ccnet.config.

Upvotes: 4

Views: 5225

Answers (3)

TridenT
TridenT

Reputation: 4909

Concerning your error message

[CCNet Server:ERROR] INTERNAL ERROR: Access to the path 'C:\Program Files (x86)\CruiseControl.NET\server\Project1\WorkingDirectory' is denied.

you should define the working directory and the artifact directory outside CC.NET installation, something like c:\builds.

Upvotes: 1

TridenT
TridenT

Reputation: 4909

Here is a sample configuration block for a project that is rebuild at 05:00 if modification exists:

<!-- DelphiCodeToDoc Project -->
<project name="DelphiCodeToDoc" queue="Q1" queuePriority="1">
  <category>Delphi</category>
  <artifactDirectory>$(ArtifactBaseDir)\DelphiCodeToDoc</artifactDirectory>
  <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc</workingDirectory>
  <triggers>
    <scheduleTrigger time="05:00" buildCondition="IfModificationExists" name="Scheduled" />
  </triggers>

  <!-- SVN implementation -->
  <sourcecontrol type="svn">
    <trunkUrl>http://dephicodetodoc.svn.sourceforge.net/svnroot/dephicodetodoc/trunk/DelphiCodeToDoc/</trunkUrl>
    <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc</workingDirectory>
  </sourcecontrol>

  <!-- Build tasks to implement -->
  <tasks>

    <!-- Compile command-line application -->
    <msbuild>
      <executable>$(MSBuildPath)\MSBuild.exe</executable>
      <workingDirectory>$(WorkingBaseDir)\DelphiCodeToDoc\Source</workingDirectory>
      <projectFile>DCTD_cmd.dproj</projectFile>
      <buildArgs>/target:Build /p:Config=Debug</buildArgs>
      <timeout>900</timeout>
      <logger>$(MSBuildLogger)</logger>
    </msbuild>

  <!-- Publishing compiled results -->
  <publishers>
    <merge>
      <files>
        <file>$(ArtifactBaseDir)\DelphiCodeToDoc\buildlogs*.xml</file>
      </files>
    </merge>

  <!-- Statistics -->
    <xmllogger />
    <rss/>
    <statistics>
    </statistics>

  </publishers>
</project>

You can define variables $(MSBuildPath) in this way:

  <cb:define MSBuildPath="C:\WINDOWS\Microsoft.NET\Framework\v3.5" />

Or replace it directly with the real path.

Upvotes: 5

skolima
skolima

Reputation: 32684

Instead of <exec>, use this:

<msbuild>
  <projectFile>project1.dproj</projectFile>
</msbuild>

Add a trigger to your project:

<triggers>
  <intervalTrigger name="continuous" seconds="30"
    buildCondition="IfModificationExists" initialSeconds="30" />
</triggers>

The rest should work.

Upvotes: 3

Related Questions