CruiseControl实现C++项目的每日构建(持续集成)
时间:2010-05-30 来源:zjzfb
网络上现有的CruiseControl项目大都以JAVA项目为例
本例以C++项目为实现目标,实现每日自动构建
学习VC编译框架,采用pre_build/build/post_build术语
CruiseControl项目:置于安装目录下projects/workspace
workspace实际项目:置于F:\CIrepos\workspace下
先决条件:已经svn co workspace项目,并且已经mwc.pl -type vc8 workspace.mwc生成VC工程文件
pre_build:实现项目工程临时文件清除,更新工程版本,重新生成VC工程文件
build:实现项目工程编译,同时实现简单的CppUnit编译后自动化测试
post_build:将实现CppUnit单元测试、打包等(CppUnit单元测试一直在工程编译后执行,所以不是很紧迫)
1. config.xml
[code]<cruisecontrol>
<project name="workspace">
<listeners>
<currentbuildstatuslistener file="projects/${project.name}/log/status.txt"/>
</listeners>
<schedule interval="86400">
<ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml"/>
</schedule>
<log>
<merge dir="projects/${project.name}/log/test-results"/>
</log>
</project>
</cruisecontrol>[/code]
2. build.xml
[code]<project name="workspace" default="all">
<target name="all" depends="pre_build, build, post_build"/>
<target name="pre_build">
<exec executable="cmd.exe">
<arg line="/c pre_build.bat" />
</exec>
</target>
<target name="build">
<exec executable="cmd.exe">
<arg line="/c build.bat" />
</exec>
</target>
<target name="post_build">
<exec executable="cmd.exe">
<arg line="/c post_build.bat" />
</exec>
</target>
</project>[/code]
3. pre_build.bat
[code]F:
cd CIrepos\workspace
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com" /clean "Release" workspace.sln /out clean.out
svn update
mwc.pl -type vc8 workspace.mwc[/code]
4. build.bat
[code]F:
cd CIrepos\workspace
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com" /build "Release" workspace.sln /out build.out[/code]
5. post_build.bat
[code]F:
cd CIrepos\workspace[/code]
本例以C++项目为实现目标,实现每日自动构建
学习VC编译框架,采用pre_build/build/post_build术语
CruiseControl项目:置于安装目录下projects/workspace
workspace实际项目:置于F:\CIrepos\workspace下
先决条件:已经svn co workspace项目,并且已经mwc.pl -type vc8 workspace.mwc生成VC工程文件
pre_build:实现项目工程临时文件清除,更新工程版本,重新生成VC工程文件
build:实现项目工程编译,同时实现简单的CppUnit编译后自动化测试
post_build:将实现CppUnit单元测试、打包等(CppUnit单元测试一直在工程编译后执行,所以不是很紧迫)
1. config.xml
[code]<cruisecontrol>
<project name="workspace">
<listeners>
<currentbuildstatuslistener file="projects/${project.name}/log/status.txt"/>
</listeners>
<schedule interval="86400">
<ant anthome="apache-ant-1.7.0" buildfile="projects/${project.name}/build.xml"/>
</schedule>
<log>
<merge dir="projects/${project.name}/log/test-results"/>
</log>
</project>
</cruisecontrol>[/code]
2. build.xml
[code]<project name="workspace" default="all">
<target name="all" depends="pre_build, build, post_build"/>
<target name="pre_build">
<exec executable="cmd.exe">
<arg line="/c pre_build.bat" />
</exec>
</target>
<target name="build">
<exec executable="cmd.exe">
<arg line="/c build.bat" />
</exec>
</target>
<target name="post_build">
<exec executable="cmd.exe">
<arg line="/c post_build.bat" />
</exec>
</target>
</project>[/code]
3. pre_build.bat
[code]F:
cd CIrepos\workspace
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com" /clean "Release" workspace.sln /out clean.out
svn update
mwc.pl -type vc8 workspace.mwc[/code]
4. build.bat
[code]F:
cd CIrepos\workspace
"C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.com" /build "Release" workspace.sln /out build.out[/code]
5. post_build.bat
[code]F:
cd CIrepos\workspace[/code]
相关阅读 更多 +