CC.NET,NANT的相关配置

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

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

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

语法:

Parameters

AttributeTypeDescriptionRequired
filefileThe file to copy. False
flattenboolIgnore directory structure of source directory, copy all files into a single directory, specified by the todir attribute. The default is false. False
includeemptydirsboolCopy any empty directories included in the <fileset>. The default is true. False
inputencodingEncoding The encoding to use when reading files. The default is the system's current ANSI code page. False
outputencodingEncoding The encoding to use when writing the files. The default is the encoding of the input file. False
overwriteboolOverwrite existing files even if the destination files are newer. The default is false. False
todirdirectoryThe directory to copy to. False
tofilefileThe file to copy to. False
failonerrorboolDetermines if task failure stops the build, or is just reported. The default is true. False
ifboolIf true then the task will be executed; otherwise, skipped. The default is true. False
unlessboolOpposite of if. If false then the task will be executed; otherwise, skipped. The default is false. False
verboseboolDetermines 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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值