alias xcbuild=$(xcode-select -p)/../SharedFrameworks/XCBuild.framework/Versions/A/Support/xcbuild
# THIS DOESNT WORK YET: xcbuild openIDEConsole # … then switch to Xcode ➡️
xcbuild showSpecs
xcbuild build <foo.pif> [—target <target>]
# Some minimal additional logging (this is safe to leave on).
defaults write com.apple.dt.XCBuild EnableDebugActivityLogs -bool YES
# Enable build debugging mode (safe to leave on, but slows down the build system & litters DerivedData/<project>/Build/Intermediates.noindex), generally should only be enabled when trying to capture a trace for incremental build debugging purposes.
defaults write com.apple.dt.XCBuild EnableBuildDebugging -bool YES
# You can also use:
env EnableBuildDebugging=YES xcodebuild -UseNewBuildSystem=1 ...
# Use `xcbuild` to dump a headermap.
xcbuild headermap --dump <path>
open with Internal > XCBuild Console
writePIF <workspace name> <path>
# … you can use this with the `xcbuild build …` command (above) to build via the service directly
showStatistics
clearAllCaches
setConfig EnableBuildDebugging true
# … then save DerivedData & build log; same as above dwrite, but not persisted
@ddunbar, to be able to get incremental builds on our CI builds, I cache
Intermediates.noindex
folder, andmtime
s of all related source files and.xcconfig
files (Xcode understandably seems to rebuild target if corresponding.xcconfig
file changes.During next build, after a fresh checkout (where source files will surely have a later
mtime
than pre-built object files because git does not keepmtime
as information), I modifymtime
values of not changed source files to time when cached built was performed.Actually, I'm using https://github.com/iboB/mtime_cache to perform all these steps, and it works pretty good with legacy build system. Once I reset
mtime
values forc,cc,h,pch,cpp,hpp,m,mm,xcconfig
extensions, I get a very fast build. It still builds some parts of the files from scratch (e.g. source files under test targets) for some reason that I don't know yet, but in general it does a pretty good job.However, I couldn't make the exact setting work under new build system. I assume new build system might be using more information to detect if a file should be rebuilt, and I'm not caching that info. Currently what I restore is basically just
mtime
values for not changed files, and it seems to be working good in general for legacy build system.If you could guide me what should be added additionally, or how to debug an incremental build, it would be really appreciated! I tried to read a generated trace file after
EnableBuildDebugging=1
, but it's toooo much verbose, and probably being used by another internal script to provide a visualization of debug summary. It includes nodes in the graph and their attributes, along with tons of other information :)