简易打造自己的自动构建任务

上一篇 / 下一篇  2009-08-18 14:01:00 / 个人分类:实践实战

在没有成熟的构建系统和团队的情况,依靠批处理文件和Windows的任务计划我们可以构造一个简易的自动构建任务。

环境:
操作系统 Windows Server 2003 
代码编译环境 Visual Studio 2005 sp2
代码管理工具 Subversion
安装包制作工具Inno Setup 5

基本思路为:写一个批处理文件执行本地代码更新、编译以及调用Inno脚本制作安装包,将这个批处理文件加到windows server系统的任务计划中(可以设置为每日、每周、或者更长的运行间隔)定期执行。

批处理如下:(将该批处理文件放在本地源码根目录下)
echo ======Set realted Dirs and parameters======
set SVNdir=C:\Program Files\Subversion\bin
set SourceCodePath=E:\SourceCode
set Innocomdir=C:\Program Files\Inno Setup 5
set path=%path%;C:\Program Files\Microsoft Visual Studio 8\VC\bin;
call vcvars32.bat
set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio 8\Common7\IDE
set SolutionConfig=release
set BuildType=/rebuild
set CommandOption1=update
set CommandOption2=log

echo ======Update source code to the latest======
taskkill /f /im TSVNCache.exe
call "%SVNdir%\svn.exe" %CommandOption1% %SourceCodePath%
call "%Workdir%\svn.exe" %CommandOption2% -q %SourceCodePath% >VersionInfo.txt
 
echo ======Create foler to accomodate build log files======
md %cd%\AutoBuildLogs

echo ======Cleanning up log files======
del /Q %cd%\AutoBuildLogs\timestart.txt
del /Q %cd%\AutoBuildLogs\timeend.txt
del /Q %cd%\AutoBuildLogs\CommonBuild.log

echo ======Processing all build======
echo %date% %time% > %cd%\AutoBuildLogs\timestart.txt"
call "%VSINSTALLDIR%\DEVENV.COM" %BuildType% %SolutionConfig% "%SourceCodePath%\Common.sln" /out "%cd%\AutoBuildLogs\CommonBuild.log"
rem "you can expand any more solutions which are ready to build"
echo %date% %time% > %cd%\AutoBuildLogs\timeend.txt"

echo ======Create installer======
call "%Innocomdir%\compil32" /cc "E:\sourcecode\Build.iss"
rem "you can apply any other installer tool to perform. installer creation"

TAG:

 

评分:0

我来说两句

日历

« 2024-05-04  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 13042
  • 日志数: 9
  • 图片数: 2
  • 建立时间: 2007-12-23
  • 更新时间: 2009-08-27

RSS订阅

Open Toolbar