How to setup building steps for CruiseControl.net from repository of the building project?

后端 未结 2 499
醉酒成梦
醉酒成梦 2021-01-24 17:32

I\'d like to store ccnet.config file (or other cc.net configuration file for this project) in the repository (git) of my project and make CC.NET use it when I force

相关标签:
2条回答
  • 2021-01-24 17:45

    Take a look at the scenario's at http://www.cruisecontrolnet.org/projects/ccnet/wiki/Build_Server_Scenarios

    1. Step 1 Setting up Source Control
    2. Step 2 Build on Check-in
    3. Step 3 Add unit tests
    4. Step 4 Add Coverage
    5. Step 5 Add source code analysis

    There are build scripts foreseen in each step where you can base yourself on.

    0 讨论(0)
  • 2021-01-24 18:00

    Your "ccnet.config" should remain fairly static.

    If you need different "logic" for your solution/project building, then I suggest:

    1.  Write your ccnet.config code to pull source code from repository. (aka, Task #1)
    2.  In your repository, include a MasterBuild.proj (msbuild definition).
    3.  Have cc.net call msbuild.exe on MasterBuild.proj (aka, Task #2).
    4.  Have the majority of your logic inside the MasterBuild.proj file.  That is what you check in/out of source control.
    

    If you think of CC.NET as a "super fancy msbuild.exe executor", you're world will make more sense IMHO.

    Here is a very basic msbuild (definition) file. You can call it

    MySolutionMasterBuild.proj (or similar)

    Put this in the same directory as your .sln file (in source control).

    Use CC.NET to download the code. Then wire up msbuild.exe to call the below file.

    Then have any extra logic inside the .proj file.

    You can do some of the other CC.NET stuff, like post build emailing and merging any results xml, but the majority of the logic (my preference anyways)..........would be in the file below.

    <?xml version="1.0" encoding="utf-8"?>
    <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="AllTargetsWrapped">
        <PropertyGroup>
            <!-- Always declare some kind of "base directory" and then work off of that in the majority of cases  -->
            <WorkingCheckout>.</WorkingCheckout>
            <ArtifactDestinationFolder>$(WorkingCheckout)\ZZZArtifacts</ArtifactDestinationFolder>
        </PropertyGroup>
    
        <Target Name="AllTargetsWrapped">
    
            <CallTarget Targets="CleanArtifactFolder" />
            <CallTarget Targets="BuildItUp" />
            <CallTarget Targets="CopyFilesToArtifactFolder" />
    
        </Target>
    
    
        <Target Name="BuildItUp" >
            <MSBuild Projects="$(WorkingCheckout)\MySolution.sln" Targets="Build" Properties="Configuration=$(Configuration)">
                <Output TaskParameter="TargetOutputs" ItemName="TargetOutputsItemName"/>
            </MSBuild>
            <Message Text="BuildItUp completed" />
        </Target>
    
    
    
        <Target Name="CleanArtifactFolder">
    
    
            <RemoveDir Directories="$(ArtifactDestinationFolder)" Condition="Exists($(ArtifactDestinationFolder))"/>
    
            <MakeDir Directories="$(ArtifactDestinationFolder)" Condition="!Exists($(ArtifactDestinationFolder))"/>
    
            <Message Text="Cleaning done" />
    
    
        </Target>
    
        <Target Name="CopyFilesToArtifactFolder">
    
            <ItemGroup>
                <MyExcludeFiles Include="$(WorkingCheckout)\**\*.doesnotexist" />
            </ItemGroup>
    
            <ItemGroup>
                <MyIncludeFiles Include="$(WorkingCheckout)\bin\$(Configuration)\**\*.*" Exclude="@(MyExcludeFiles)"/>
            </ItemGroup>        
    
    
            <Copy
                    SourceFiles="@(MyIncludeFiles)"
                    DestinationFiles="@(MyIncludeFiles->'$(ArtifactDestinationFolder)\%(Filename)%(Extension)')"
            />
    
        </Target>
    
    </Project>
    
    0 讨论(0)
提交回复
热议问题