Xcode build step · Open source
Dependi
Licence acknowledgements for the Swift packages your app really links, written into Settings every time you archive. Despite the name, it's not dependency injection. It's about the licences of your dependencies.The build step
Stop keeping the list by hand
Before
A licences list you update yourself, and hope it still matches what the app ships with after the last package bump.After
Archive as usual. The app's Settings gets an Acknowledgements pane with one page per package, built from what the app target actually links.How it works
From resolved packages to a Settings pane
Read what Xcode resolved
It starts from the packages Xcode resolved for your project.Follow what's linked
Direct, transitive and local packages, plus anything linked by embedded frameworks and extensions.Pick the licence files
Each package's licence files, checked before they're used.Write the panes
One pane per package, under an Acknowledgements pane in the app's Settings.bundle.
When it runs
Archives, not every build
Debug builds skip it. Archives always run it, and so does any build configuration you list. The runner script pins a Dependi version, builds it once and caches it in.dependi/bin.Setup
Three steps
- Clone Dependi at the version you want.
- Run the setup wizard against your project:
swift run -c release dependi init --project <path to your app> - Add the Run Script phase the wizard prints, and turn the user script sandbox off for the target that runs it.
What it checks
It's fussy on purpose
- A linked remote package with no licence file is skipped and named in the build log. Set
requireLicensesin.dependi.jsonto make that a failure. - Local packages are followed to the remote packages they use.
- Manual entries cover code that doesn't come from a package.
- The list sorts the same way every time, whatever the locale or input order.
- Licence files must be regular files inside their package, under 1 MB and valid text.
- Every checkout must match the revision
Package.resolvedpins. - Packages that are resolved but not linked fail the build, unless you allow them.
- It only writes inside the built product, and only ever removes files it made.
Command line
Four commands
| Command | Meaning |
|---|---|
dependi generate | Writes the acknowledgements. Xcode runs this one. |
dependi init --project <path> [--dry-run] | Sets Dependi up in a project. |
dependi --version | Prints the version. |
dependi help | Prints the usage. |
Why a Run Script
Why not a package plugin?
Dependi runs as a command line tool in a Run Script phase, not as a Swift package plugin. A plugin doesn't get the full dependency graph, it's sandboxed away from the package checkouts, and it can't reliably put files where the app bundle needs them.Platforms
Where it works
- iOS
- iPadOS
- Mac Catalyst
- visionOS
- macOS apps
- CocoaPods
- Carthage
How it's built
Tested by breaking it
The code lives in rings, and a test checks that each module only depends on rings further in. Every rule Dependi enforces has an entry in a mutation register. The register breaks the code on purpose and needs a named test to fail each time. Built and tested with Xcode 27.2 (Swift 6.4) on macOS 27. Other Xcode versions aren't tested yet.- Swift 6.4
- Command line tool
- Xcode Run Script
- Settings.bundle
- iOS · iPadOS · Mac Catalyst · visionOS
- No third-party dependencies
- Apache-2.0