Tuesday, January 15, 2013

CC.Net sample Files

ccnet.config:

<?xml version="1.0" encoding="utf-8"?>
<cruisecontrol>
    <project name="cc-config">
        <!--Project for updating this config file when this config file is also managed in a SVN repository-->
        <triggers>
            <intervalTrigger seconds="30"/>
        </triggers>
        <sourcecontrol type="multi">
            <sourceControls>
                <svn>
                    <workingDirectory>C:\Program Files\CruiseControl.NET\server\cc.net</workingDirectory>
                    <trunkUrl>http://MySVNServer/repos/AutoBuild/CC.Net</trunkUrl>
                    <executable>C:\Program Files\CollabNet Subversion Client\svn.exe</executable>
                    <username>autobuildername</username>
                    <password>password</password>
                </svn>
                <svn>
                    <workingDirectory>C:\MyWorkingFolder\Common\trunk</workingDirectory>
                    <trunkUrl>http://MySVNServer/repos/common/trunk</trunkUrl>
                    <executable>C:\Program Files\CollabNet Subversion Client\svn.exe</executable>
                    <username>autobuildername</username>
                    <password>password</password>
                </svn>
            </sourceControls>
        </sourcecontrol>
    </project>
   
    <project>
        <name>MyProject</name>
        <webURL></webURL>
        <triggers>
            <intervalTrigger seconds="1800"/>
        </triggers>
        <workingDirectory>C:\MyWorkingFolder\MyProject</workingDirectory>
        <modificationDelaySeconds>300</modificationDelaySeconds>
        <labeller type="assemblyVersionLabeller">
            <major>1</major>
            <minor>8</minor>
            <build>4</build>
            <incrementOnFailure>false</incrementOnFailure>
        </labeller>
        <sourcecontrol type="multi">
            <sourceControls>
                <!-- Updating dependedcy 1 -->
                <svn>
                    <trunkUrl>http://MySVNServer/repos/Nsis/trunk/headers</trunkUrl>
                    <executable>C:\Program Files\CollabNet Subversion Client\svn.exe</executable>
                    <username>autobuildername</username>
                    <password>password</password>
                    <workingDirectory>C:\MyWorkingFolder\installer\NsisCommon\headers</workingDirectory>
                </svn>
                <svn>
                    <trunkUrl>http://MySVNServer/repos/dependency1/trunk</trunkUrl>
                    <executable>C:\Program Files\CollabNet Subversion Client\svn.exe</executable>
                    <username>autobuildername</username>
                    <password>password</password>
                    <workingDirectory>C:\MyWorkingFolder\dependency1\trunk</workingDirectory>
                </svn>
                <svn>
                    <trunkUrl>http://MySVNServer/repos/MyProject/trunk</trunkUrl>
                    <executable>C:\Program Files\CollabNet Subversion Client\svn.exe</executable>
                    <username>autobuildername</username>
                    <password>password</password>
                    <workingDirectory>C:\MyWorkingFolder\Trunk</workingDirectory>
                </svn>
            </sourceControls>
        </sourcecontrol>
        <tasks>
            <exec>
                <executable>C:\Windows\System32\cmd.exe</executable>
                <buildArgs>/c DEL /q /s "build result\*.*" </buildArgs>
                <buildTimeoutSeconds> 1200 </buildTimeoutSeconds>
            </exec>           
            <msbuild>
                <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
                <workingDirectory>C:\MyWorkingFolder\dependency1\Trunk</workingDirectory>
                <projectFile>C:\MyWorkingFolder\dependency1\Trunk\dependency1.msbuild</projectFile>
                <buildArgs>/noconsolelogger /p:Configuration=Release /v:diag /t:BuildProjectRes;BuildSelfUpdateRes;Build</buildArgs>
                <timeout>900</timeout>
                <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
                <environment>
                    <variable name="BDS" value="C:\Program Files\Codegear\RAD Studio\8.0"/>
                    <variable name="Path" value="C:\Program Files\Codegear\RAD Studio\8.0\bin;%Path%"/>
                    <variable name="Win32LibraryPath" value="C:\Program Files\CodeGear\RAD Studio\8.0\lib\Win32\Release"/>                   
                    <variable name="DXVCL" value="C:\Delphi\Third Party Packages\DevEx.VCL.56"/>
                </environment>
            </msbuild>           
            <msbuild>
                <executable>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe</executable>
                <workingDirectory>C:\MyWorkingFolder\MyProject\trunk\src</workingDirectory>
                <projectFile>MyProject.msbuild</projectFile>
                <buildArgs>/noconsolelogger /t:BuildProjectRes;Build /p:Configuration=Release;DCC_ExeOutput="..\bin" /v:diag</buildArgs>
                <timeout>900</timeout>
                <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll</logger>
                <environment>
                    <variable name="BDS" value="C:\Program Files\Codegear\RAD Studio\8.0"/>
                    <variable name="Path" value="C:\Program Files\Codegear\RAD Studio\8.0\bin;%Path%"/>
                    <variable name="Win32LibraryPath" value="C:\Program Files\CodeGear\RAD Studio\8.0\lib\Win32\Release"/>
                    <variable name="DXVCL" value="F:\Delphi\Third Party Packages\DevEx.VCL.56"/>
                </environment>
            </msbuild>
            <exec>
                <executable>C:\Windows\System32\cmd.exe</executable>
                <buildArgs>/c xcopy /Y "bin\MyProject.exe" "Build Result\Indivisual File\bin\"</buildArgs>
                <!-- above path is related to workingDirectory of Project -->
            </exec>
            <exec>
                <!-- add EurekaLog -->
                <executable>C:\Program Files\CodeGear\RAD Studio\8.0\Bin\ecc32.exe</executable>
                <buildArgs> --el_alter_exe"src\MyProject.dproj;bin\MyProject.exe" --el_config"src\MyProject.dproj"</buildArgs>
                <buildTimeoutSeconds>900</buildTimeoutSeconds>
            </exec>
            <!-- below two build msi installer -->
            <exec>
               
                <executable>C:\Program Files\WiX Toolset v3.6\bin\candle.exe </executable>
                <buildArgs>@installer\MyProject-candle-response.txt</buildArgs>
                <buildTimeoutSeconds>1200 </buildTimeoutSeconds>
            </exec>
            <exec>
                <executable>C:\Program Files\WiX Toolset v3.6\bin\light.exe</executable>
                <buildArgs>@installer\MyProject-light-response.txt</buildArgs>
                <buildTimeoutSeconds>1200 </buildTimeoutSeconds>
            </exec>
            <exec>
                <executable>C:\Program Files\NSIS\makensis.exe</executable>
                <buildArgs>/V3 /DOS_Platform_Specification=MyProject32BitSpecification /DOutputDir="..\Build Result\Installer" "installer\MyProject.nsi"</buildArgs>
                <buildTimeoutSeconds>1200</buildTimeoutSeconds>
            </exec>
            <exec>
                <executable>C:\Windows\System32\cmd.exe</executable>
                <buildArgs>/c del "Build Result\Installer\*.wixpdb"</buildArgs>
                <buildTimeoutSeconds> 1200 </buildTimeoutSeconds>
            </exec>
        </tasks>
        <publishers>
            xmllogger=""
            <statistics/>
            <email mailport="25" includeDetails="TRUE" mailhostUsername="autobuildername" mailhostPassword="password" useSSL="FALSE">
                <from>productauto.builder@MyCompany.com</from>
                <mailhost>My-SMTP-Server</mailhost>
                <users>
                    <user name="BuildGuru" group="buildmaster" address="master@MyCompany.com"/>
                    <user name="Developer1" group="developers" address="developer1@MyCompany.com"/>
                    <user name="Tester1" group="testers" address="tester1@MyCompany.com"/>
                </users>
                <groups>
                    <group name="developers">
                        <notifications>
                            <notificationType>Failed</notificationType>
                            <notificationType>Fixed</notificationType>
                        </notifications>
                    </group>
                    <group name="testers">
                        <notifications>
                            <notificationType>Fixed</notificationType>
                        </notifications>
                    </group>
                    <group name="buildmaster">
                        <notifications>
                            <notificationType>Always</notificationType>
                        </notifications>
                    </group>
                </groups>
                <converters>
                    <!-- regexConverter find="$" replace="@TheCompany.com" /
-->
                </converters>
                <modifierNotificationTypes>
                    <NotificationType>Failed</NotificationType>
                    <NotificationType>Fixed</NotificationType>
                </modifierNotificationTypes>
                <subjectSettings>
                    <subject buildResult="StillBroken" value="Build is still broken for My Project"/>
                </subjectSettings>               
            </email>
            <buildpublisher>
                <sourceDir>Build Result</sourceDir>
                <publishDir>\\MyServer\Installs\MyProject\Installation Files\Version 1.8.4\Builds</publishDir>
                <useLabelSubDirectory>true</useLabelSubDirectory>
                <alwaysPublish>false</alwaysPublish>
            </buildpublisher>
        </publishers>
    </project>   
</cruisecontrol>

MSBuild file:

<?xml version="1.0" encoding="utf-8"?>
<Project
    xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
    >
    <!-- below import only works when this .msbuild file has the same name as the Delphi project file name -->
    <Import
        Project="$(MSBuildProjectName).dproj"
        />
    <!-- these two target are for debugging path purpose -->
    <Target
        Name="ShowDelphiProjectToBuild"
        >
        <Message
            Text="$(MSBuildProjectName).dproj"
            />
    </Target>
    <Target
        Name="ShowDCCPath"
        >
        <Message
            Text="$(DCC_UnitSearchPath)"
            />
    </Target>
    <UsingTask
        TaskName="DCC"
        AssemblyFile="$(BDS)\bin\Borland.Build.Tasks.Delphi.dll"
        />
    <Target
        Name="GetRevision"
        ><!-- SvnVersion is in the MSBuild Community Tasks Targets -->
        <SvnVersion
            LocalPath="$(MSBuildProjectDirectory)"
            >
            <Output
                TaskParameter="Revision"
                PropertyName="Revision"
                />
        </SvnVersion>
    </Target>
    <Target
        Name="BuildProjectRes"
        DependsOnTargets="Versioning"
        >
        <Microsoft.Build.Tasks.Exec
            Command="brcc32 $(ProjectName).rc $(ProjectName).res"
            />
    </Target>
    <!-- use Microsoft HTML Workshop for building CHM help file -->
    <Target
        Name="MakeHelp"
        >
        <Microsoft.Build.Tasks.Exec
            Command="hhc &quot;ProjectHelp.hhp&quot;"
            WorkingDirectory="$(ProjectRoot)\Help\"
            />
        <Microsoft.Build.Tasks.Copy
            SourceFiles="$(ProjectRoot)\Help\ProjectHelp.chm"
            DestinationFolder="$(PackingRoot)\InstallFiles\Project\Help"
            />
    </Target>
    <Target
        Name="PrepareDirForPublish"
        DependsOnTargets="BuildProjectRes"
        >
        <Microsoft.Build.Tasks.MakeDir
            Directories="$(CCNetWorkingDirectory)\$(MajorVer).$(MinorVer).$(ReleaseVer).$(Revision)"
            />
        <Microsoft.Build.Tasks.Copy
            SourceFiles="$(PackingRoot)\Output\$(MSBuildProjectName)Setup.exe"
            DestinationFolder="$(CCNetWorkingDirectory)\$(MajorVer).$(MinorVer).$(ReleaseVer).$(Revision)"
            />
        <Microsoft.Build.Tasks.Copy
            SourceFiles="$(PackingRoot)\InstallFiles\Project\Bin\$(MSBuildProjectName).exe"
            DestinationFolder="$(CCNetWorkingDirectory)\$(MajorVer).$(MinorVer).$(ReleaseVer).$(Revision)"
            />
    </Target>
    <Import
        Project="C:\Program Files\MSBuild\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"
        />
    <!--PropertyGroup-->
    <PropertyGroup>
        <ThirdPartyComponents>F:\Delphi\Third Party Packages</ThirdPartyComponents>
        <Abbrevia>$(ThirdPartyComponents)\Abbrevia\4.0\source</Abbrevia>
        <ComponentRoot></ComponentRoot>
        <DelphiColl>$(ThirdPartyComponents)\Delphi-coll\Library</DelphiColl>
        <DevExpress>$(ThirdPartyComponents)\DevEx.VCL.56\Library\Delphi15</DevExpress>
        <EurekaLog>$(ThirdPartyComponents)\EurekaLog 6\Delphi15</EurekaLog>
        <InstallScriptSourceDir></InstallScriptSourceDir>
        <JEDI>$(ThirdPartyComponents)\Jedi345</JEDI>
        <JCL>$(JEDI)\jcl</JCL>
        <JCLLib>$(JCL)\lib\d15;$(JCL)\source\common;$(JCL)\Source\windows;$(JCL)\Source;$(JCL)\Source\include</JCLLib>
        <JVCL>$(JEDI)\jvcl</JVCL>
        <JVCLLib>$(JVCL)\lib\d15;$(JVCL)\common;$(JVCL)\resources;$(JVCL)\run</JVCLLib>
        <ProjectRoot></ProjectRoot>
        <PackingRoot>$(ProjectRoot)\Installer</PackingRoot>
        <PublishRootDir></PublishRootDir>
        <TMS>$(ThirdPartyComponents)\TMS 6.0.3.0\</TMS>
        <VT>$(ThirdPartyComponents)\Soft Gems\Virtual Treeview 4.8.7\Source</VT>
        <OmniXML>$(ThirdPartyComponents)\OmniXML</OmniXML>
    </PropertyGroup>
    <PropertyGroup>
        <DCC_UnitSearchPath>$(BDS)\Lib\Win32\Release;$(Abbrevia);$(DevExpress);$(EurekaLog);$(FastMM);$(JCLLib);$(JVCLLib);$(TMS);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
        <DCC_UnitSearchPath>$(SqliteLib);$(ClaimsLib);F:\Build\delphi_client\trunk\Common;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
        <DCC_UnitSearchPath>$(ManagedDLL);$(VT);$(Zip);$(OmniXML);$(BDS)\Lib\Indy10;$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
        <DCC_UnitSearchPath>$(DelphiColl);$(DCC_UnitSearchPath)</DCC_UnitSearchPath>
        <UnitSearchPath>$(DCC_UnitSearchPath)</UnitSearchPath>
        <!-- DCC_Define>compiler directives are specified in the .dproj file, they are not necessary to define here</DCC_Define -->
        <DCC_ObjPath>$(DCC_ObjectPath);$(UnitSearchPath)</DCC_ObjPath>
        <DCC_ResourcePath>$(DCC_ResourcePath);$(UnitSearchPath)</DCC_ResourcePath>
        <DCC_IncludePath>$(DCC_IncludePath);$(UnitSearchPath)</DCC_IncludePath>
        <ObjPath>$(UnitSearchPath)</ObjPath>
        <ResourcePath>$(UnitSearchPath)</ResourcePath>
        <IncludePath>$(UnitSearchPath)</IncludePath>
        <DCC_ExeOutput>C:\MyWorkingFolder\MyProject\Output</DCC_ExeOutput>
        <DCC_DcuOutput></DCC_DcuOutput>
        <ProjectName>MyProject</ProjectName>
        <MajorVer>1</MajorVer>
        <MinorVer>8</MinorVer>
        <ReleaseVer>4</ReleaseVer>
        <ProductVersion>$(MajorVer),$(MinorVer)</ProductVersion>
        <CompanyName>My Company Name</CompanyName>
        <Comments/>
    </PropertyGroup>
    <Target
        Name="MsBuildBinPath"
        >
        <Message
            Text="$(MSBuildBinPath)"
            />
    </Target>
    <Target
        Name="Versioning"
        DependsOnTargets="GetRevision"
        >
        <ItemGroup>
            <Tokens
                Include="MajorVer"
                >
                <ReplacementValue>$(MajorVer)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="MinorVer"
                >
                <ReplacementValue>$(MinorVer)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="ReleaseVer"
                >
                <ReplacementValue>$(ReleaseVer)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="Revision"
                >
                <ReplacementValue>$(Revision)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="ProductVersion"
                >
                <ReplacementValue>$(ProductVersion)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="CompanyName"
                >
                <ReplacementValue>$(CompanyName)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="FileDescription"
                >
                <ReplacementValue>$(FileDescription)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="InternalName"
                >
                <ReplacementValue>$(InternalName)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="LegalCopyRight"
                >
                <ReplacementValue>$(LegalCopyRight)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="LegalTrademarks"
                >
                <ReplacementValue>$(LegalTrademarks)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="OriginalFilename"
                >
                <ReplacementValue>$(OriginalFilename)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="ProductName"
                >
                <ReplacementValue>$(ProductName)</ReplacementValue>
            </Tokens>
            <Tokens
                Include="Comments"
                >
                <ReplacementValue>$(Comments)</ReplacementValue>
            </Tokens>
        </ItemGroup>
        <TemplateFile
            Template="versioninfo.template.rc"
            OutputFilename="$(ProjectName).rc"
            Tokens="@(Tokens)"
            />
        <TemplateFile
            Template="$(MSBuildProjectDirectory)\..\..\installer\product-version.template.nsh"
            OutputFilename="$(MSBuildProjectDirectory)\..\..\installer\product_version.nsh"
            Tokens="@(Tokens)"
            />
    </Target>
</Project>

 

Versioninfo.template.rc:

VS_VERSION_INFO VERSIONINFO
FILEVERSION ${MajorVer},${MinorVer},${ReleaseVer},${Revision}
PRODUCTVERSION ${ProductVersion}
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x4L
FILETYPE 0x1L
FILESUBTYPE 0x0L
BEGIN
  BLOCK "StringFileInfo"
  BEGIN
    BLOCK "080904B0"
    BEGIN
      VALUE "CompanyName",      "${CompanyName}\0"
      VALUE "FileDescription",  "${FileDescription}\0"
      VALUE "FileVersion",      "${MajorVer}.${MinorVer}.${ReleaseVer}.${Revision}\0"
      VALUE "InternalName",     "${InternalName}\0"
      VALUE "LegalCopyright",   "${LegalCopyRight}\0"
      VALUE "LegalTrademarks",  "${LegalTrademarks}\0"
      VALUE "OriginalFilename", "${OriginalFilename}\0"
      VALUE "ProductName",      "${ProductName}\0"
      VALUE "ProductVersion",   "${ProductVersion}\0"
      VALUE "Comments",         "${Comments}\0"
    END
  END

  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x809,1200
  END
END

No comments:

Post a Comment