|
In the Build directory of your project there is a NAnt script named CreateBranch.xml. This script automated most of the work in creating a branch, work that all project have in common. You may find it useful to wrap this script in one of your own to fully automate the process. This script is intended to be executed on the build server, not from a developers machine. This script will shut down the parent branch's CCNet server. It does not restart the parent branch's CCNet server nor start the new branch's CCNet server. This is to allow you the opportunity to customize in a wrapper script.
There are two ways in which you can execute the script: interactive and silent. To execute the script in interactive mode open a command prompt and cd the to the build directory of the codeline you wish to branch from.
It will ask you a series of questions:
The script will check to see if your product's Visual Studio project files have references using absolute paths that will cause issues. If they are detected you be asked, yes or no, if you wish for the script to correct these issues.
It will ask you what you want to name the new branch. This is the name of the folder that the branch will be housed in. In this example I answer "1.0":
This will result in the following folder structure:
You always have the option to run a branch on different machine than the parent branch. This question should provide the machine name of the host for the parent branch. Simply copy and paste it into the answer field if you wish to host this branch on the same machine. Note: if you wish to host this branch on another machine you should copy newly created branch directory from this machine to the machine you intent to host it on. There are several files that are created that are never stored in source control.
The question refers to the port number that this branch's CCNet server will listen on. Please note that the suggestion is not an intelligent one, it is simply and example.
This question is asking for the version prefix that the new branch should use. In this example the parent branch's prefix is "1.0.0." . In my experience you branch to maintain working on a version so this prefix should be carried through to the new branch. Note: this is a prefix so there is a trailing period.
This question is asking about the full version, not just the prefix, of the build scripts CCNet project for the new branch. If you will see more questions, similar to this one, if you have more than the default two CCNet projects.
This question is really centered around the last part of the version. In this simple example it would be concerned with the z: x.x.x.z. Again I recoment maintaining continuity with the parent branch and set this to the version that the parent was at, in the example here I have set it to 2.
In the example the parent branch was Current. This question is asking what to change the version prefix to. In my experience this is something greater than what it was. Here I jump all the way to version 2.0.0.x from 1.0.0.. I can imagine setting this to anything less than 1.0.1..
This is another prefix question, this time for the build script's CCNet project on the parent branch. Adain you will see more questions like this if you have more than the default two CCNet projects.
When the scripts completes it should look very similar to the following screenshot.
To execute the script silently you will need to supply the answers to the questions as NAnt parameters. Here is some example NAnt script to provide the very same answers as were provided in the interactive example above.
<property name="BranchName" value="1.0"/>
<nant buildfile="${BuildDirectory}\CreateBranch.xml" inheritall="false" inheritrefs="false" >
<properties>
<property name="BranchLabelPrefix" value="1.0.0."/>
<property name="BranchParentLabelPrefix" value="2.0.0."/>
<property name="BranchBuildServerPort" value="21237"/>
<property name="BranchBuildServerHostName" value="${environment::get-machine-name()}"/>
<property name="BranchName" value="${BranchName}"/>
<property name="Branch${ProjectName}-${BranchName}BuildScriptsInitialVersion" value="BuildScripts-1.0-1"/>
<property name="Branch${ProjectName}-${BranchName}InitialVersion" value="1.0.0.2"/>
<property name="ParentBranch${ProjectName}-${ProjectCodeLineName}BuildScriptsLabelPrefix" value="${BranchParentLabelPrefix}" dynamic="true"/>
<property name="FixBadRefPath" value="Yes"/>
</properties>
</nant>
The NAnt script above expects that you have included the build file Properties.Build.xml.
|