为 C++ 构建解决方案
我想为在 Visual Studio 2005 中开发的非托管 C++ 代码设置构建服务器。构建服务器应该能够执行以下操作:
- 监视 Subversion 存储库中的代码更改并安排构建
- 从 Subversion 检出代码并运行单元测试
- 提供关于构建成功和与先前构建的更改的某种报告
我最初一直在考虑将 CruiseControl 与 Ant 结合使用。 有更好的解决方案吗? 也许是 CruiseControl.Net 和 NAnt?
I'd like to setup a build server for unmanaged C++ code developed in Visual Studio 2005. The build server should be able to do the following:
- Monitor a Subversion repository for code changes and schedule a build
- Checkout code from Subversion and run unit tests
- Provide some sort of report on build success and changes from previous build
I've initially been looking at using CruiseControl with Ant. Is there a better solution? Perhaps CruiseControl.Net, and NAnt?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
NAnt 需要做相当多的工作才能有效地构建 C++。 它确实是一个彻头彻尾的.NET 构建系统。 我们正在为四个 C++ 平台和一组 .NET 工具构建我们的游戏,并且花了一段时间才使 NAnt 适应我们的需求。 例如,NAnt 的 C++ 依赖分析非常糟糕,我们不得不自己编写。 它有很多性能问题,我们必须努力解决它。
所以不要双脚都跳进去。 进行一些初步测试,以确保它确实可以实现您想要的功能,并了解您需要对 C++ 进行多少修改。
此外,我们还使用 CruiseControl.NET 来处理一些 NUnit 内容,我们已将其内置到驱动我们正在开发的游戏的工具之一中。 对此非常满意,设置起来非常简单。 在这里竖起大拇指。
在之前的演出中,我在您描述的确切场景中使用了 Final Builder - 在构建服务器上。 本地构建是使用 Visual Studio 完成的。 这是一个非常棒的产品,如果你有一点钱可以花,我会认真考虑它。 我们没有得到什么,只是得到了好的结果。
在我现在的公司,我们选择了 NAnt,因为我们不想为团队中的每个工程师购买 FB。 我们也不喜欢 FB 的封闭源代码。 所以我们 100% Nant 并且喜欢它。 只是花了一些时间才将其成型!
NAnt takes quite a bit of work to build C++ effectively. It really is a .NET build system through and through. We're building our title to four C++ platforms plus a set of .NET tools, and it took a while to bend NAnt to our needs. For example, NAnt's C++ dependency analysis is so broken that we had to write our own. And it has a lot of perf issues that we had to go hack away at it to fix.
So don't jump in with both feet on this. Do some preliminary testing to make sure it really can do what you want and get a feel for how much you'll have to modify it for C++.
Also, we're using CruiseControl.NET also for some NUnit stuff we have built into one of our tools that drives the game we're developing. Very happy with this, it was brain-dead easy to set up. Big thumbs up here.
At a previous gig I used Final Builder in the exact scenario you describe - on the build server. Local builds were done using Visual Studio. It's a pretty awesome product that I'd seriously consider if you have a little money to spend. We had nothing but good results from it.
At my current company we went with NAnt because we didn't want to buy FB for every engineer on the team. We also didn't like how FB is closed source. So we're 100% Nant and are liking it. Just took some time to bang it into shape!
由于没有人提到,Jenkins 是一个很好的 CI,并且变得越来越常见(免费也没有坏处):
http://jenkins-ci.org/
易于安装、使用和监控,并与许多东西(SVN、GIT 等)很好地集成。 也非常可定制。 需要 5 分钟才能启动并运行。
Since no one has mentioned, Jenkins is a good CI and is becoming more and more common (being free doesn't hurt either):
http://jenkins-ci.org/
Easy to install, use and monitor and integrates nicely with lots of things (SVN, GIT etc). Also very customizable. Takes 5 mins to get it up and running.
我刚刚开始使用 Visual Build Professional,印象非常深刻,您可以从这里下载功能齐全的 30 天试用版:
http://www.kinook.com/VBP/
SVN 也完全支持。
I've just started using Visual Build Professional and am very impressed, You can download a fully-featured 30 day trial from here:
http://www.kinook.com/VBP/
SVN is fully supported too.
我们使用 FinalBuilder 来构建 Visual Studio 2005 项目,包括使用 InstallShield 打包最终的 exe 和 dll,并将它们放在共享服务器上。
我们还(从 FinalBuilder)远程登录到许多其他平台(Unix/Linux/OpenVMS),并通过在那里运行 makefile 来启动远程构建。
我们不使用连续构建,但有一个 FinalBuilder Server 可以处理该问题,并且免费提供 FinalBuilder Professional 许可证。
我们对 FinalBuilder 非常满意,它很容易上手,而且功能强大,足以解决大多数问题。
We use FinalBuilder for building our Visual Studio 2005 projects including packaging the final exes and dlls with InstallShield and putting them up on a shared server.
We also telnet out (from FinalBuilder) to a number of other platforms (Unix/Linux/OpenVMS) and start remote builds by running makefiles there.
We do not use continous build, but there is a FinalBuilder Server which handles that and comes free with the FinalBuilder Professional license.
We are very happy with FinalBuilder, it's quite easy to get up to speed with and powerful enough to solve most problems.
我们使用 CruiseControl.Net 和 NAnt(和 Subversion),我们对结果很满意。
We use CruiseControl.Net, and NAnt (and Subversion) and we are happy with the results.
除了 Ant CruiseControl 还支持 NAnt 和 执行。
但如果你真的想走前卫,你可以考虑 Rake (大约:Rake,.Net 上的 Rake 入门)。
In addition to Ant CruiseControl also supports NAnt and Exec.
But if you really want to go avant-garde you could consider Rake (about: Rake, Getting Started with Rake on .Net).
Visual Studio 2005 项目完全能够从命令行运行! 只需执行
(将
whatever
替换为您的项目名称,并将Release|Win32
替换为您需要的配置和平台)。 这可以通过 CruiseControl 或 Jenkins 等轻松运行。Visual Studio 2005 projects are perfectly capable of being run from command-line! Just do
(replace
whatever
with your project name andRelease|Win32
with the configuration and platform you need). This can be trivially run by CruiseControl or Jenkins or whatever.在 Visual Studio 2010 中,Microsoft 最终将 Visual C++ 项目文件 (.vcproj) 的格式升级为其基于 XML 的 NAnt 克隆格式 MSBuild,现命名为 .vcxproj。 这意味着使用该任务可以轻松编译 C++ 项目。
如果您可以预见您只会拥有一个小团队和有限数量的构建,我会推荐 TeamCity (http://www.jetbrains.com/teamcity/) 和 NAnt。 TeamCity 是一个基于 Java 的 CI 服务器(更容易在 Linux 构建服务器上部署),支持单独的构建代理(因此您可以有多个 Windows 虚拟机或专用机器来运行您的构建)。
TeamCity 对 MSBuild、NAnt 和基于 Ant 的构建的支持非常出色,并且它有一个非常漂亮的基于 AJAX 的 GUI,使用起来很有趣,并允许您从浏览器设置和配置项目。 然而,如果您跨过免费版 20 个项目的门槛,它就会变得不合理的昂贵。
我可以推荐的另一个选项是 Jenkins 与 NAnt、Ant、MSBuild 或 Jenkins 可以支持的其他许多构建系统之一。 Jenkins 是开源的,可以处理无限的项目,例如 TeamCity,它可以在服务器上运行,同时将构建发送到单独的构建代理,并且它具有许多 C++ 工具的插件(例如静态分析、单元测试和打包)。
Jenkins 的 Web 界面不像 TeamCity 那样方便和漂亮,但它被广泛使用,并且几乎有任何东西的插件。
In Visual Studio 2010, Microsoft finally upgraded the format of Visual C++ project files (.vcproj) to its XML-based NAnt clone format MSBuild, now named .vcxproj. This means C++ projects will compile without much effort using the task.
If you can foresee that you're only going to have a small team and a limited number of builds, I would recommend TeamCity (http://www.jetbrains.com/teamcity/) with NAnt. TeamCity is a CI server based on Java (easier to deploy on a Linux build server) that supports separate build agents (so you could have several Windows virtual machines or dedicated box running your builds).
TeamCity's support for MSBuild, NAnt and Ant based builds is excellent and it has a very nice AJAX-based GUI that is a joy to use and allows you to set up and configure projects from your browser. If you cross the 20 project threshold of the free edition, it becomes unreasonably expensive, however.
The other option I can recommend would be Jenkins with NAnt, Ant, MSBuild or one of the other many build systems Jenkins can support. Jenkins is Open Source and will handle unlimited projects, like TeamCity it can run on a server while sending builds to separate build agents and it has plugins for many C++ tools (think static analysis, unit testing and packaging).
Jenkins' web interface is not quite so convenient and beauftiful as TeamCity, but it's widely used and has plugins for almost anything.