将基于eclipse/cdt的构建集成到持续集成中 [英] Untegrating an eclipse/cdt-based build into continuous integration
问题描述
我必须使用CDT,mingw和cdt管理的构建功能(没有外部makefile或构建环境)来重用当前在Eclipse内部开发的主要C ++项目.该项目本身由许多子项目组成.
I have to reuse a major C++ project which is currently developed inside eclipse, using CDT, mingw and cdt managed build feature (no external makefiles or build environment). The project itself is composed of many sub-projects.
我想将该构建集成到一个持续集成服务器(即jenkins)中,因此必须能够自动化无头构建.
I want to integrate that build into a continuous integration server (jenkins namely) and have thus to be able to automate the headless build.
到目前为止,我设法签出了该项目(从jenkins轻松完成),并使用以下命令使用eclipse以无头模式构建它:
So far, I managed to checkout the project (easy from jenkins) and have it build in a headless mode using eclipse, using the following command:
C:\prog\EclipseCdt\eclipse -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import %WORKSPACE%\project1 -import %WORKSPACE%\project2 -import %WORKSPACE%\project3 -build all
但这还不够:
- build是异步的:前一条命令返回(实际上是分叉),而我希望它保持上下文,直到得到结果为止(就像在Linux上使用
make
或在Windows上使用devenv
一样) - 我无法提取构建日志(最好将其保存在文件中):要整合到我的连续信息中,我需要能够解析构建日志以显示有趣的信息(考虑损坏的文件)
- 理想情况下,我想从Eclipse获得指示通过或失败的直接状态(返回代码).
- build is asynchronous : previous command returns (it forks actually) while I expect it to hold context until I have a result (like it would with
make
on linux ordevenv
on windows) - I was unable to extract the build logs (ideally have them in a file) : to integrate within my continuous information, I need to be able to parse my build logs to display interesting information (think about broken files)
- Ideally, I'd like to get from Eclipse a direct status (return code) which indicates pass or fail.
任何想法如何产生这种行为吗?
Any idea how to have this behaviour ?
请注意:
- 当前无法使用备用(外部)构建系统(我必须保持cdt管理的构建,它具有很多复杂的历史记录)
- 尽管我的需求显然很简单,但我已经研究过堆栈溢出和google并没有设法找到一种方法
- 我目前在Windows 7/mingw 4.5.2/用于C/C ++开发人员的Eclipse IDE上版本:Indigo发行版本ID:20110615-0604,但我认为问题是x平台
推荐答案
如果我以交互方式从cmd启动eclipse,它会分叉,如果是从bat脚本启动,则不会.因此,将前一行放在jenkins中就足以解决问题.
it looks like if I start eclipse from a cmd interactively,it forks, if started from a bat script, it doesn't. so putting the previous line in jenkins was enough to do the trick.
注意:
- 您需要添加
-data
参数来定义工作台的位置(每次都会清理构建内容) - 像往常一样,责怪窗户并加引号....
-
--launcher.suppressErrors
:万一发生麻烦,可以防止Eclipse显示弹出窗口(实际上不显示,因此会生成积木)
- you need to add
-data
parameter to define location of your workbench (I clean build each time) - as usual, blame windows and put quotes....
--launcher.suppressErrors
: in case something goes awoc, prevents eclipse from displaying a pop up (which is actually not displayed, thus blocks build)
最终(正常工作!)命令:
Final (working !) command:
C:\prog\EclipseCdt\eclipse --launcher.suppressErrors -nosplash -data "%WORKSPACE%" -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import "%WORKSPACE%\project1" -import "%WORKSPACE%\project2" -import "%WORKSPACE%\project3" -build all
编辑
- 添加了--launcher.suppressErrors
这篇关于将基于eclipse/cdt的构建集成到持续集成中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!