xcode 命令行构建
Once in a while, every developer suffers from a long Xcode build time. This results in lowered productivity and a slowdown of the whole team’s development process. Enhancing build time is crucial — it has a direct impact on time to market of new features.
有时,每个开发人员都需要花费很长的Xcode构建时间。 这导致生产率降低,整个团队的开发过程变慢。 延长构建时间很关键-它直接影响新功能的上市时间。
In this Part 1, we’ll learn how to profile the Xcode build and get its metrics. In the next part, I’ll go through techniques to resolve bottlenecks and speed up the build. It should also be mentioned that we’ll be using a Kickstarter iOS project, that can be found on Github.
在第1部分中,我们将学习如何分析Xcode构建并获取其度量。 在下一部分中,我将介绍一些技术来解决瓶颈并加快构建速度。 还应该提到的是,我们将使用可以在Github上找到的Kickstarter iOS项目。
Let’s get started!
让我们开始吧!
衡量什么 (What to Measure)
First, we need to define what are we trying to measure and optimize. There are two options:
首先,我们需要定义要衡量和优化的内容。 有两种选择:
Clean build: Cleaning and rebuilding a project from scratch. Frequently, a clean build is done on CI to validate a pull request for correctness and run unit tests.
清理构建 :从头开始清理并重建项目。 通常,会在CI上进行干净的构建以验证对正确性的提取请求并运行单元测试。
Incremental build: Rebuilding a project after some source code changes. This build is created by a developer while working on a new feature.
增量构建:在某些源代码更改后重新构建项目。 此版本由开发人员在使用新功能时创建。
In most of cases, clean build time improvements should also speed up the incremental build. The best option would be to generate metrics for both build types and keep track of them. We’ll be measuring builds created with the Debug
configuration, only because it’s the most commonly used and has a higher impact on development.
在大多数情况下,干净构建时间的缩短也应加快增量构建的速度。 最好的选择是生成两种构建类型的指标并对其进行跟踪。 我们将评估使用Debug
配置创建的内部版本,这仅是因为它是最常用的并且对开发有更大的影响。
测量构建时间 (Measuring Your Build Time)
The most efficient way of improving the build time is by taking a data-driven approach, introducing and verifying changes based on the build metrics. Let’s dive into that and take a look at the tools we can use to get insights into a project’s build time.
缩短构建时间的最有效方法是采用数据驱动的方法,根据构建指标引入和验证更改。 让我们深入研究一下,看看可以用来深入了解项目构建时间的工具。
Xcode构建报告 (Xcode build report)
We can get the build time easily via Xcode. Xcode keeps track of all your builds by default and you can examine the times and logs from the Report Navigator.
我们可以通过Xcod