简体   繁体   English

Qt的连续构建系统

[英]Continuous build system for Qt

I am a Qt/C++ developer. 我是Qt / C ++开发人员。 I would like to setup a continuous integration environment whereby after committing the source code, it triggers a build process that build the code for the 3 platforms I'm using: 我想设置一个持续集成环境,在提交源代码之后,它会触发一个构建过程,为我正在使用的3个平台构建代码:

  • Linux Linux的
  • OS X OS X.
  • Win32 Win32的

If possible, how do I setup such environment. 如果可能,我该如何设置此类环境。 Any hints or links are welcome. 欢迎任何提示或链接。 I've read around about Jenkins, but I can't find any good tutorial for it. 我已经阅读了关于詹金斯的内容,但我找不到任何好的教程。

I also suggest Jenkins for several reasons: 我还建议Jenkins有几个原因:

  • It will run on all of the platforms you listed. 它将在您列出的所有平台上运行。
  • It can be configured to start a build when the repository is updated (hint: configure the Job to "Poll SCM" and you won't have to muck with your SCM tool to get it to tell Jenkins to start building). 它可以配置为在更新存储库时启动构建(提示:将作业配置为“轮询SCM”,您不必使用SCM工具来让它告诉Jenkins开始构建)。
  • It provides good support (mostly through plugins) for Unit Testing. 它为单元测试提供了很好的支持(主要是通过插件)。 [You're project is doing unit testing, right?] [你的项目正在进行单元测试,对吧?]
  • The price is right 价格合适

A bigger issue is going to have is that AFAIK, Qt doesn't really do cross-compiling for other platforms well. 一个更大的问题是,AFAIK,Qt并没有真正对其他平台进行交叉编译。 Using Jenkins (and the appropriate plugins), you should be able to solve this. 使用Jenkins(以及相应的插件),您应该能够解决这个问题。

One method that comes quickly to mind is to have an instance of Jenkins on each platform. 快速想到的一种方法是在每个平台上都有一个Jenkins实例。 Each instance is responsible for building the version for its own platform. 每个实例都负责为自己的平台构建版本。 At the end of the build, the created artifacts are all put into a common, shared location. 在构建结束时,创建的工件都被放入一个共同的共享位置。

Two solutions coming to my mind: 我想到了两个解决方案:

BuildBot BuildBot

BuildBot is a highly customizable continuous integration system written in Python. BuildBot是一个用Python编写的高度可定制的持续集成系统。 The master component offers a nice web-based GUI to monitor and trigger builds; 主组件提供了一个很好的基于Web的GUI来监视和触发构建; slave components are put on the target machines (usually virtual machines but they could be the Mac laptop of one of the developers). slave组件放在目标机器上(通常是虚拟机,但它们可能是其中一个开发人员的Mac笔记本电脑)。 Docs are good enough to build up a basic system, customization could be a little tricky (at least it was for me). Docs足以构建一个基本系统,定制可能有点棘手(至少对我而言)。 Using commit/push hooks provided by VC systems you can easily activate the master and trigger builds across the slaves. 使用VC系统提供的提交/推送挂钩,您可以轻松激活主服务器并跨从服务器触发构建。 It also supports incremental builds (a must if your project is big). 它还支持增量构建(如果您的项目很大,则必须支持)。

CDash CDASH

Developed by the authors of CMake, CDash is a web application collecting builds coming from across the network, not exactly what you asked for but I think it's worth a try. CDake的作者开发, CDash是一个网络应用程序,收集来自整个网络的构建,不完全是你要求的,但我认为值得一试。 Very powerful if you have a team of developers who could continuosly submit build result on their machines to the server (and if you use CMake it's almost transparent). 非常强大,如果你有一个开发人员团队可以在他们的机器上连续提交构建结果到服务器(如果你使用CMake它几乎是透明的)。 You cannot trigger builds from the server as Buildbot does, but you could setup a bunch of VM with a cron which checks for changes and in case performs the build and sends results to CDash 你不能像Buildbot那样从服务器触发构建,但你可以设置一堆带有cron的VM来检查更改,以防执行构建并将结果发送到CDash

Jenkins supports this feature via plugins for all major source control systems. Jenkins通过所有主要源控制系统的插件支持此功能。 If you seriously considering using Jenkins (and I would highly recommend it), consider buying John Ferguson Smart's Jenkins: The Definitive Guide . 如果你认真考虑使用Jenkins(我强烈推荐它),可以考虑购买John Ferguson Smart的Jenkins:The Definitive Guide

Sure it's possible. 当然有可能。 Most of the version control systems are able to execute custom script on server side. 大多数版本控制系统都能够在服务器端执行自定义脚本。 Some of them (git, for example), has hooks to achieve the same locally. 他们中的一些(例如git)具有在本地实现相同的钩子。 Have a look at git's post-commit hook . 看看git的post-commit钩子

All you need is to create a script that will trigger cross-platform builds. 您所需要的只是创建一个触发跨平台构建的脚本。

Most version control systems allow post-commit hooks to allow you to kick off events like builds. 大多数版本控制系统允许使用提交后挂钩来启动构建等事件。 Alternatively build systems can be configured to regularly poll a source control repository and manage their own build scheduling (this is how we use Jenkins). 或者,可以将构建系统配置为定期轮询源控制存储库并管理它们自己的构建调度(这是我们使用Jenkins的方式)。

Something to bear in mind is how long it will take to do a complete build across platforms and the typical number of check-ins in that interval. 需要记住的是跨平台进行完整构建需要多长时间以及该间隔内的典型签入次数。 You might find batching check-ins a better way of doing continuous integration builds if you have an fair sized team or limited build server resources. 如果您拥有合理规模的团队或有限的构建服务器资源,您可能会发现批处理签入是进行持续集成构建的更好方法。 Otherwise your build system could quickly end up trying to play catch up. 否则你的构建系统很快就会试图追赶。

As for whether it is possible to build on all target platforms, that depends on your tool chain. 至于是否可以在所有目标平台上构建,这取决于您的工具链。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM