icon XCBuildAnalyzer

macOS 应用程序,用于检查 Xcode 的构建系统图

描述

XCBuildAnalyzer 是一个独立的 macOS 应用程序,用于渲染 Xcode 构建系统图,并包含一些(有限的)计时数据。分析该图可能有助于理解各个步骤之间的依赖关系,以及构建系统为何使先前的构建结果失效。

该工具依赖于在项目 DerivedData 目录中始终生成的构建清单 json 文件。

Demo

入门指南

轻松检查 Xcode 的构建系统图 medium.com 上的博文

要分析最新的构建系统图,请将项目文件拖放到应用程序区域。根据项目的大小和图中的节点数量,这可能需要一些时间,但通常应在几秒钟内完成。

在左侧窗格中,您将看到按目标名称(如果适用)聚合的图节点。 构建图通常非常庞大,因此为了提高可靠性和性能,建议分析子图。

选择一个节点将在中心视图中渲染包含所有输入和输出节点的视图。

Main graph

如果某个节点有一些出于简洁而跳过的隐藏输入或输出,则该节点的图标 ⤡ 或 ⤢ 允许展开它们。

Expanding nodes

在左侧视图中选择多个节点(使用 ⌘ 或 ⇧)将绘制包含所有节点的可能的子图。

截图

Expanding nodes

在右侧窗格中,您可以检查步骤详细信息,包括输入/输出节点、步骤工具、ENV 变量等。

截图

Expanding nodes

如果在构建清单中找到了构建计时数据,则在最近一次构建中触发的步骤将具有计时数据。查找 🔨 图标以查找最近执行的节点。

截图

Expanding nodes

Expanding nodes

循环

如果在图中发现循环,则受影响的节点会有一个警告标志。 选择它们会绘制完整的循环(带有一些侧节点)

Expanding nodes

截图

Expanding nodes

比较不同构建之间的构建图

默认情况下,XCBuildAnalyzer 会查找 DerivedData 中找到的最新图清单,但如果您想分析或比较特定的构建图,您可以从 DerivedData/ProjectName/Build/Intermediates.noindex/XCBuildData/{build_hash}.xcbuilddata/manifest.json 拖放原始 manifest.json 文件。

注意

请记住,在原始清单模式下,计时数据不可用

要求

支持的格式

安装

从二进制文件运行

在本地构建项目

  1. 通过调用 scripts/dependencies.sh 下载 node.js 依赖项(需要 npm)
  2. 打开 BuildAnalyzer.xcodeproj
  3. [可选] 选择 BuildAnalyzer scheme
  4. 使用 ⌘+R 运行应用程序

作者

贡献者姓名和联系方式

许可

此项目已获得 Apache License 许可

Copyright (c) 2023 Bartosz Polaczyk.

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements.  See the NOTICE file
distributed with this work for additional information
regarding copyright ownership.  The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License.  You may obtain a copy of the License at

https://apache.ac.cn/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied.  See the License for the
specific language governing permissions and limitations
under the License.

鸣谢

此产品包含由 "Marcin Krzyzanowski" 开发的软件 (http://krzyzanowskim.com/)