Skip to content

Extract GutenbergKitResources target#376

Open
mokagio wants to merge 5 commits intotrunkfrom
resources-target-clean
Open

Extract GutenbergKitResources target#376
mokagio wants to merge 5 commits intotrunkfrom
resources-target-clean

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 in place)
  • 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 mokagio requested review from dcalhoun and jkmassel March 17, 2026 04:12
They'll be introduced later on.

Co-authored-by: Gio Lodi <giovanni.lodi42@gmail.com>
mokagio and others added 3 commits March 17, 2026 15:20
We'll stop tracking them once the XCFramework is in place.
Avoids a redundant JS build + translation fetch by
downloading the `dist.tar.gz` artifact already produced
by the `build-react` step.

---

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

Co-Authored-By: Claude Code Opus 4.6 <noreply@anthropic.com>
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