CruiseControl.NET and NSIS Installer

The last piece of the build that I had to add to CruiseControl.NET for our new project is the installer. We want to be able to drop a full installer to the clients every two weeks, so we have to build the installer first. It seems backwards, but I think it's the way to go. One ends up with a deliverable product at the end of each iteration.

We are using the NSIS installer package, along with the HM NIS editor to create the installer. It's a great open source project that does all of what the big guys do, and again is free and open source.

Interestingly, CruiseControl.NET uses NSIS to create their installers, so I thought there would be tasks to call NSIS from within CruiseControl. However, I could not find any, so again, I went out and wrote some.

Because the command line tool for NSIS (makeNSIS) doesn't output XML, I wrote a wrapper script to call makensis and parse the text output into XML. Then I wrote some xsl to transform that to HTML. [Warning: the xsl is not pretty]. And another warning; the wrapper script is Perl. It's called, unsurprisingly, execNSIS.pl. Its two arguments are the location of makensis.exe and the installer .nsi file. I can hear Jamie already: "What, is it 1998? C'mon!" Those warnings aside, we can now run NSIS in our CruiseControl.NET job and get nice pretty logs. Here are the files; use them as follows

  • Add the NSISReport.xsl and NSISSummary.xsl to the webdashboard/xsl directory.
  • Add the following lines to the dashboard.config file.
            <buildPlugins>
                <buildReportBuildPlugin>
                    <xslFileNames>
                        <!-- other stuff here -->
                        <xslFile>xsl\NSISSummary.xsl</xslFile>
                    </xslFileNames>
                </buildReportBuildPlugin>
                <buildLogBuildPlugin />
                <!-- other stuff here -->
                <xslReportBuildPlugin description="NSIS Report" actionName="NSISReport" xslFileName="xsl\NSISReport.xsl" />
         
    
  • Add lines to your ccnet.config file to call NSIS through the execNSIS.pl Perl script, and remember to merge the log into your build log.
          <!-- NSIS Installer -->
          <exec>
            <executable>C:\program files\perl\bin\perl.exe</executable>
            <baseDirectory>C:\cruisecontrol\Example\trunk\installer</baseDirectory>
            <buildArgs>C:\cruisecontrol\utilities\execNSIS.pl "C:\Program Files\NSIS\makensis.exe" ExampleInstaller.nsi</buildArgs>
            <buildTimeoutSeconds>3000</buildTimeoutSeconds>
          </exec>
        </tasks>
    
        <publishers>
          <merge>
            <files>
              <file>..\installer\ExampleInstaller.xml</file> <!-- NSIS log file -->
            </files>
          </merge>
          <xmllogger logDir="log" />
        </publishers>
         
    

These files are released under an MIT license. Feel free to do what you want with them.

Post new comment

The content of this field is kept private and will not be shown publicly.