Skip to content

Extract GutenbergKitResources target#375

Closed
mokagio wants to merge 1 commit intotrunkfrom
resources-target
Closed

Extract GutenbergKitResources target#375
mokagio wants to merge 1 commit intotrunkfrom
resources-target

Conversation

@mokagio
Copy link
Contributor

@mokagio mokagio commented Mar 17, 2026

What?

Extracts Gutenberg build assets (HTML, CSS, JS) into a dedicated GutenbergKitResources SPM target.

This is a subset of #318. I realized the release process needs some tweaking to support atomic version bump + XCFramework build. To avoid #318 staying in flight even longer and to begin testing the setup in the day to day development workflow, I though we should at least merge the introduction of the resources framework without the XCFramework implementation. I wish I thought of this sooner...

Why?

This separation is the architectural prerequisite for distributing pre-built resources as an XCFramework via CDN.
Splitting it out now keeps the diff small and reviewable; the XCFramework build/release automation will follow in a separate PR.

How?

  • Package.swift gains a DependencyMode enum (.local / .release) and the new GutenbergKitResources target + product
  • GutenbergKit depends on GutenbergKitResources, sets packageAccess: false, and drops all package access modifiers → internal
  • EditorViewController and HTMLPreviewManager import GutenbergKitResources instead of using Bundle.module directly
  • Makefile copies dist to the new location via copy-dist-ios / copy-dist-android sub-targets
  • CI test-swift-package step uses make test-swift-package instead of bare swift test (needs dist assets)
  • Tracked build output under ios/Sources/GutenbergKit/Gutenberg/ is deleted (~18 MB); make build regenerates into ios/Sources/GutenbergKitResources/Gutenberg/

Testing Instructions

  1. make build — verify dist is copied to ios/Sources/GutenbergKitResources/Gutenberg/
  2. swift build — compiles without errors
  3. swift test — all 471 unit tests pass
  4. make build-swift-package — xcodebuild succeeds

Accessibility Testing Instructions

N/A — no UI changes.

Screenshots or screencast

N/A — infrastructure change only.


Posted by Claude (Opus 4.6) on behalf of @mokagio with approval.

Gutenberg build assets (HTML, CSS, JS) now live in a dedicated
`GutenbergKitResources` SPM target instead of being bundled
directly inside `GutenbergKit`.

This separation enables a future XCFramework distribution
strategy where consumers can pull pre-built resources from
CDN via `DependencyMode.release`, while developers continue
building from source with `.local`.

Key changes:

- `Package.swift` gains `DependencyMode` enum and the new
  `GutenbergKitResources` target/product
- `GutenbergKit` target sets `packageAccess: false` and
  drops `package` access modifiers (now `internal`)
- `EditorViewController` and `HTMLPreviewManager` import
  `GutenbergKitResources` instead of using `Bundle.module`
- `Makefile` copies dist to the new location via
  `copy-dist-ios` / `copy-dist-android` sub-targets
- CI `test-swift-package` step uses `make` instead of
  bare `swift test` (needs dist assets in place)
- Tracked build output under `ios/Sources/GutenbergKit/Gutenberg/`
  is deleted (~18 MB); `make build` regenerates into
  `ios/Sources/GutenbergKitResources/Gutenberg/`

---

Generated with the help of Claude Code, https://claude.ai/code

Co-Authored-By: Claude Code Opus 4.6 <noreply@anthropic.com>
@mokagio mokagio added the [Type] Build Tooling Issues or PRs related to build tooling label Mar 17, 2026
@mokagio
Copy link
Contributor Author

mokagio commented Mar 17, 2026

Reopening from a clean worktree to avoid a dirty working tree artifact.

@mokagio mokagio closed this Mar 17, 2026
@mokagio
Copy link
Contributor Author

mokagio commented Mar 17, 2026

Reopening from a clean worktree to avoid a dirty working tree artifact.

Claude Code did this because of a prompt from me which was not clear enough. I wanted it to switch to a new worktree to address an unrelated file being deleted during make build somehow.

The "clean" PR for this is #376

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant