Skip to content

fix(demo-ios): reference GutenbergKit as a local Swift package#559

Open
dcalhoun wants to merge 2 commits into
trunkfrom
fix/demo-ios-workspace-package-resolution
Open

fix(demo-ios): reference GutenbergKit as a local Swift package#559
dcalhoun wants to merge 2 commits into
trunkfrom
fix/demo-ios-workspace-package-resolution

Conversation

@dcalhoun

@dcalhoun dcalhoun commented Jul 21, 2026

Copy link
Copy Markdown
Member

What?

Stops the iOS demo app from rewriting the library's root Package.resolved every time the project is opened in Xcode.

Why?

Opening ios/Demo-iOS/Gutenberg.xcodeproj added a wordpress-rs pin to the repo-root Package.resolved; resolving the Swift package on its own removed it again. The result was a recurring diff that had to be discarded by hand.

The root cause is in the demo project: it referenced the repo root as a plain folder (PBXFileReference with path = ../..) rather than as a package. Xcode treats a folder-referenced local package as an editable root package, so it wrote the demo app's merged dependency graph — including wordpress-rs, which is a demo-app dependency and not a GutenbergKit library dependency — into the library's own lockfile.

How?

Declare the root as an XCLocalSwiftPackageReference and drop the folder reference. The demo app's graph now resolves into a demo-scoped lockfile under project.xcworkspace/xcshareddata/swiftpm/, leaving the library's Package.resolved untouched.

That demo lockfile is committed so the demo app and its E2E tests resolve reproducibly. It pins SwiftSoup 2.13.6 while the root pins 2.8.8 — expected, since these are now independent graphs and both satisfy from: "2.7.5".

Testing Instructions

  1. Open ios/Demo-iOS/Gutenberg.xcodeproj in Xcode and let packages resolve.
  2. Run git status — the root Package.resolved should be unmodified.
  3. Confirm the demo app builds and runs.

To see the previous behavior, repeat step 1 on trunk: the root Package.resolved gains a wordpress-rs pin.

Verified locally with DerivedData and the demo lockfile deleted beforehand, so the result is not a warm-cache artifact:

  • Pre-fix, resolving added 9 lines to the root Package.resolved.
  • Post-fix, a cold resolve leaves it untouched.
  • xcodebuild build -scheme Gutenberg succeeds, and the built app contains GutenbergKit_GutenbergKitResources.bundle, confirming the local package links.

dcalhoun and others added 2 commits July 21, 2026 15:53
The demo project wired the repo root in as a plain folder reference
(`PBXFileReference` with `path = ../..`) rather than a package
reference. Xcode treats a folder-referenced local package as an
editable root package, so it wrote the demo app's merged dependency
graph — including `wordpress-rs` — into the library's own
`Package.resolved` at the repo root.

That produced a recurring, unwanted diff: opening the demo app in
Xcode added a `wordpress-rs` pin to the root lockfile, and resolving
the Swift package on its own removed it again.

Declare the root as an `XCLocalSwiftPackageReference` instead. The
demo app's graph now resolves into a demo-scoped lockfile under
`project.xcworkspace/xcshareddata/swiftpm/`, leaving the library's
`Package.resolved` untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Pins the demo app's dependency graph (SVGView, SwiftSoup,
wordpress-rs) so the app and its E2E tests resolve reproducibly.

This lockfile is scoped to the demo app and is separate from the
library's root `Package.resolved`, which consumers resolve
independently.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the [Type] Bug An existing feature does not function as intended label Jul 21, 2026
@wpmobilebot

Copy link
Copy Markdown

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/559")

Built from 3ce66a9

"location" : "https://github.com/scinfu/SwiftSoup.git",
"state" : {
"revision" : "ead56133a693d0184d8c2db1a6d6394410cacfd6",
"version" : "2.13.6"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The below is referenced in the PR description. I don't believe this is an issue, but let me know if you do.

That demo lockfile is committed so the demo app and its E2E tests resolve reproducibly. It pins SwiftSoup 2.13.6 while the root pins 2.8.8 — expected, since these are now independent graphs and both satisfy from: "2.7.5".

@dcalhoun
dcalhoun marked this pull request as ready for review July 21, 2026 20:22
@dcalhoun
dcalhoun requested a review from crazytonyli July 21, 2026 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants