OGeek|极客世界-中国程序员成长平台

标题: ios - 获取 Xcode 构建时间 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:14
标题: ios - 获取 Xcode 构建时间

如果您启用defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES,我想提取显示在Xcode 上方小框中的Xcode 项目的总体构建时间。

enter image description here

我在 .xcactivitylog 文件中找不到任何信息。

我还尝试了通过最顶部的构建阶段脚本来节省时间的方法,但包括一些 pod,这也需要在每个 pod 中作为构建阶段脚本..

Xcode 是否将此信息保存在某处?



Best Answer-推荐答案


这种情况可以使用构建前后运行的脚本来解决。您可以在 Xcode -> Preferences -> Behaviors 中设置它们 Xcode -> Preferences -> Behaviors

一开始你可以分配:

#!/bin/sh
echo `date +%s` > test.txt

最后

#!/bin/sh
startTime=$(head -n 1 test.txt)
currentTime=`date +%s` 
diff="$(($currentTime - $startTime))"
# do whatever you need with compilation time

关于ios - 获取 Xcode 构建时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45032002/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4