Reputation: 1682
I want to extract the overall build time of an Xcode project displayed in the small box above Xcode if you enabled defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
.
I don't find any information in the .xcactivitylog
files.
I also tried the approach to save the time via a build phase script at the very top, but including some pods this would need to be also in every pod as build phase script..
Does Xcode save this information somewhere?
Upvotes: 2
Views: 2947
Reputation: 212
-> Go to terminal -> cd project directory
defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
Upvotes: 1
Reputation: 665
This case could be solved using scripts that runs before and after the build. You can set them up in Xcode -> Preferences -> Behaviors
On start you can assign:
#!/bin/sh
echo `date +%s` > test.txt
and on the end
#!/bin/sh
startTime=$(head -n 1 test.txt)
currentTime=`date +%s`
diff="$(($currentTime - $startTime))"
# do whatever you need with compilation time
Upvotes: 1
Reputation: 8773
What do you need this for? There are alternative solutions (like using Trrminal and xcodebuild), but that depends on what you need this for.
Update: OK, you say you need this to measure build times across developers. In that case, I think the only API you can use is the Accessibility API to actually query Xcode's UI for values.
Upvotes: 0
Reputation: 2341
I use BuildTimeAnalyzer for logging build time of every file and function. It is open source project, and you can check an implementation.
Upvotes: 1