Delphi:Daily build实践
添加时间: 2006-2-25 5:31:59 作者: Delphi教程 阅读次数:45 来源: http://www.d9soft.com
Daily build作为软件开发的最佳实践之一,微软甚至将它称为项目管理的心跳,可见其在软件开发中的重要作用。为什么会有这么高的评价? 除了平常提到的一些显著改进外,主要是因为实现daily build前有一些先决条件,即意味着你至少已经实现下列scm管理:
1.源代码管理
2.单元测试
3.版本管理
4.bug管理
在上述基础上进行的daily build,可以说是软件开发的一种习惯。刚开始可能会有所不适应,但逐渐变为一种习惯后,就离不开了。
Daily build现在有很多流行的工具,比如说final builder,支持脚本编写,是很不错的工具。但是没有钱购买工具怎么办,其实简单使用脚本来编写一个批处理工具,来进行daily build,也可以基本实现daily build的功能。下面就已source safe + delphi为例,来实现daily build。
|
::Daily Build Script ::viery 2004/07/20 ::Your project's path in VSS set SSProject="$/Project1/Source" ::Your VSS username and password set Username=Viery set Password=password ::Path to VSS command line tool and the VSS DB you want to use. set VSSPath="C:\Develop\Vss\win32\ss.exe" set SSDIR=C:\develop\vss ::Path to the directory where you will be keeping the archive set ArchivePath=C:\Project\build ::Path to the delphi executable. set DelphiPath="C:\Program files\Borland\Delphi7\Bin\dcc32.exe" ::Path to library set Delphi="C:\Program files\Borland\Delphi7" ::Delphi Project Name |
|
set ProjectName=Project1 ::LibPath Set LibPath="C:\Program files\Borland\Delphi7\Lib; " ::Begin Code for /F "tokens=2-4 delims=/- " %%A in ('date/T') do set strdate=%%C%%A%%B mkdir %ArchivePath%\%strdate%\ABC0DEF cd %ArchivePath%\%strdate% %VSSPath% get %SSProject% -Y%Username%,%Password% -R -I- %DelphiPath% -u%LibPath% -nc:\Project\build\dcu %ArchivePath%\%strdate%\%ProjectName% ::archive ::move to release location ::Label the files %VSSPath% label %SSProject% -L%strdate% -Y%Username%,%Password% -I- ::send emails to all to report |
以上就是一个基本的daily build脚本,实现的基本功能包括:
1.从source safe中get lastest version
2.调用delphi编译,创建最新的版本
3.将新版本发布到特定版本的目录
4.压缩,发布,发送email
5.将最新的版本号Label源代码。
然后将此批处理在windows的调度任务里设定为每天晚上定时执行,即可实现简单的daily build管理。
从简单处着手,daily build,最重要的是开始。
上一篇文章: 教你如何用Delphi注册快捷方式 下一篇文章: Delphi控制Excel的重要属性和方法
相关文章:

