CC.NET,NANT的相关配置

来源:互联网 发布:南宁伯才网络坑人 编辑:程序博客网 时间:2024/04/28 07:50

语法详见http://nant.sourceforge.net,

http://confluence.public.thoughtworks.org/display/CCNET

1.Copy Task(用来拷贝文件)

语法:

Parameters

AttributeTypeDescriptionRequiredfilefileThe file to copy. FalseflattenboolIgnore directory structure of source directory, copy all files into a single directory, specified by the todir attribute. The default is false. FalseincludeemptydirsboolCopy any empty directories included in the <fileset>. The default is true. FalseinputencodingEncoding The encoding to use when reading files. The default is the system's current ANSI code page. FalseoutputencodingEncoding The encoding to use when writing the files. The default is the encoding of the input file. FalseoverwriteboolOverwrite existing files even if the destination files are newer. The default is false. FalsetodirdirectoryThe directory to copy to. FalsetofilefileThe file to copy to. FalsefailonerrorboolDetermines if task failure stops the build, or is just reported. The default is true. FalseifboolIf true then the task will be executed; otherwise, skipped. The default is true. FalseunlessboolOpposite of if. If false then the task will be executed; otherwise, skipped. The default is false. FalseverboseboolDetermines whether the task should report detailed build log messages. The default is false. False

经常用到的是目录(子目录拷贝),文件拷贝,重命名文件目录

1 ) 文件拷贝

<copy todir="config_backup" overwrite="true">
      <fileset basedir=".">
        <include name="*.*"/>
      </fileset>
    </copy>

2)目录拷贝(**表示用来递归拷贝哦。。。

What makes this process work is the **/*.* in the include section.  the **/ tells nant to do a recursive copy.

<copy todir="bin_backup" includeemptydirs="true" overwrite="true" verbose="true">
  <fileset basedir="./bin">
   <include name="**/*.*"/>
  </fileset>
 </copy>

 

failonerror:Determines if task failure stops the build, or is just reported. The default is true.

针对Unit Test操作或者Clean文件等等,要设置为False,比较合理。

3)重命名,甚至可以用C#来做哦。。。。。C#和Nant结合起来,果然非常强大。

<target name="test-rendir" >
<property name="rendir.from" value="d:/temp/lala" />
<property name="rendir.to" value="d:/temp/lili" />
<script language="C#">
<code><![CDATA[
public static void ScriptMain(Project project) {
Directory.Move( project.Properties[ "rendir.from" ],
project.Properties[ "rendir.to" ] );
}
]]></code>
</script>
</target>

 

2. CC.NET triggers 用来建立Project之间依赖,如何触发Build的设置

语法:

Trigger blocks allow you to specify when CruiseControl.NET will start a new integration cycle.
Specifying an empty element (<triggers />) means integrations are only ever forced manually (for example using CCTray or the Web Dashboard.) Not including a <triggers> element at all means the project will behave like a <triggers /> element (before 1.4.3 the default when not including a <triggers> was a single Interval Trigger with default configuration).

http://confluence.public.thoughtworks.org/display/CCNET/Trigger+Blocks

 

 

Trigger blocks allow you to specify when CruiseControl.NET will start a new integration cycle.

For CI you'll want to use an Interval Trigger. Also useful is the Schedule Trigger for implementing daily builds.
Use the Filter Trigger to prevent builds from occurring at certain times (such as when your source control repository is undergoing backup).
If you want to set up a project that will only respond to force build requests, you should specify an empty trigger section like this: <triggers/>,

 

The Multiple Trigger is used to support the execution of multiple nested triggers.

 

Types of Integration Trigger Block are:

  • Filter Trigger
  • Interval Trigger
  • Multiple Trigger
  • Parameter Trigger
  • Project Trigger
  • Schedule Trigger
  • Url Trigger
原创粉丝点击