Finding Dependency Cycles in iOS Builds with llbuild UI
Did you know the swift-llbuild project contains a debugging tool called
llbuild-ui that can find dependency cycles in your iOS build? To try it:
- Enable the New Build System (In Xcode it’s under File, Workspace Settings)
- Build your project
- Open the Derived Data directory on your machine and find the
build.dbfile generated by the build system. This will be in a path similar to
/Users/<yourUsername>/Library/Developer/Xcode/DerivedData/iOS-<someIdentifier>/Build/Intermediates.noindex/XCBuildData/build.db. Take note of this path as you will need it later.
- Follow the instructions here to install llbuild UI. You’ll need to have Python (and probably some dependencies) installed on your system.
Start llbuild UI by running the command shown on the Github page linked in step 4 above in terminal.
FLASK_APP=llbuildui.app venv/bin/python -m flask run
http://127.0.0.1:5000/in your browser. You should see something like this:
Click on Database Browser, which will show you the database configuration screen:
Paste the path from step 2 above into the field and click “Set Path”
Wait until the page refreshes then change the address in your browser’s address bar to
http://127.0.0.1:5000/db/diagnostics. Any cycles found in your build should be shown on screen.