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:

  1. Enable the New Build System (In Xcode it’s under File, Workspace Settings)
  2. Build your project
  3. Open the Derived Data directory on your machine and find the build.db file 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.
  4. Follow the instructions here to install llbuild UI. You’ll need to have Python (and probably some dependencies) installed on your system.
  5. 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
  6. Visit http://127.0.0.1:5000/ in your browser. You should see something like this:
  7. Click on Database Browser, which will show you the database configuration screen:
  8. Paste the path from step 2 above into the field and click “Set Path”
  9. 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.