Debug an iOS application against different builds of Glean
At times it may be necessary to debug against a local build of Glean or another git fork or branch in order to test new features or specific versions of Glean.
Glean is shipped as a Swift Package (as glean-swift). To replace it in consuming application you need to locally build an XCFramework and replace the Swift package with it. The following steps guide you through this process.
Build the XCFramework
In your local Glean checkout run:
make build-xcframework
This will create the XCFramework in build/archives/Glean.xcframework
Add the Glean XCFramework to the consuming application
- Open the project in Xcode.
- Remove the
glean-swift
package dependency in the project's settings. - Clear out any build artifacts. Select the
Product
menu, thenClean Build Folder
. - Right-click in the file tree and select "Add files".
- Select the directory generated in your local Glean checkout,
build/archives/Glean.xcframework
. - In the project settings, select your target.
- In the General section of that target, look for the "Frameworks, Libraries, and Embedded Content" section.
- Click the
+
(plus) symbol and add theGlean.xcframework
. - Run a full build. Select the
Product
menu, thenBuild
.
The application is now built with the locally built Glean XCFramework.
After making changes to Glean you will have to rebuild the XCFramework, then clean out build artifacts in the consuming application and rebuild the project.