You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add cross-platform Swift package tests for macOS (#25344)
* Add cross-platform Package.swift for macOS testing
Defines a subset of modules that build and test on macOS without
Xcode, enabling `swift test` from the repo root. Modules can be
incrementally added here as they become cross-platform.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add WordPressKitObjCUtils, WordPressKitModels, and WordPressKitObjC to cross-platform package
Replace unnecessary UIKit imports with Foundation in Obj-C headers
that only use Foundation types. Remove stale UIKit import from
FeatureFlagRemote.swift.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Split WordPressShared into cross-platform and UIKit-only modules
Create WordPressSharedObjCUI and WordPressSharedUI for UIKit-dependent
code, keeping WordPressSharedObjC and WordPressShared cross-platform.
Update all import statements across the codebase accordingly.
* Decouple WordPressKit from UIKit
Introduce DeviceInformation struct to replace direct UIDevice usage in
NotificationSettingsServiceRemote. Use ProcessInfo for OS version in
SessionDetails. Guard UIKit-only code with #if canImport(UIKit) in
HTTPAuthenticationAlertController, UIDevice+Extensions,
NSMutableParagraphStyle+extensions, GravatarServiceRemote (upload),
PluginDirectoryEntry (HTML text extraction), and
SiteDesignServiceRemote (screen scale).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add WordPressShared and WordPressKit to cross-platform package
Add WordPressSharedObjC, WordPressShared, WordPressKit, and
WordPressSharedTests to the root Package.swift for macOS testing.
Fix cross-platform build issues: remove unused MobileCoreServices
import from URL+Helpers, guard String.accessibilityLabel usage in
Double+Stats with #if canImport(UIKit), and remove unused
WordPressSharedObjC import from String+RemovingMatches.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add Buildkite job to run cross-platform Swift package tests
Runs `swift test` from the repository root to verify that cross-platform
modules build and pass tests on macOS without Xcode.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Reconcile cross-platform module split with trunk
Rebasing onto trunk surfaced drift in the module graph the split targets.
The app builds unchanged; these adapt the split + cross-platform package to
302 commits of trunk evolution.
Module graph:
- Root Package.swift: drop the removed WordPressKitObjCUtils target/deps
(folded into WordPressSharedObjC on trunk); align WordPressShared deps
with trunk (BuildSettingsKit/Logging/SwiftSoup, no Reachability pod);
bump wordpress-rs to 0.6.0 to match the WordPressAPI surface trunk's
WordPressCore now uses; exclude JetpackStatsWidgetsCore's iOS-only
AppIntents (SelectSiteIntent/SiteEntity) and its test from the macOS build.
- Modules/Package.swift: graft WordPressSharedUI/WordPressSharedObjCUI
targets and wire them into consumers that gained WordPressSharedUI usage
(AztecExtensions, FormattableContentKit, JetpackStats, WordPressReader,
JetpackSocial, WordPressData, App/Keystone, Share/Draft extensions, tests).
Imports:
- Add `import WordPressSharedUI` to trunk-added callers of WPUserAgent
(WordPressData Blog, JetpackSocial) and the reachability alert helpers
(Jetpack Restore/Backup options).
- Add explicit `@import WordPressSharedObjC` to WordPressKitObjC files using
`wp_map:` — the ObjC-side transitive re-export through WordPressShared no
longer resolves once it also re-exports WordPressSharedObjCUI.
- Replace a stray `#import <UIKit/UIKit.h>` with Foundation in
NSString+WPKitNumericValueHack.h (Foundation-only header) so WordPressKitObjC
builds on macOS.
- Make the keychain logger label nil-safe: `Bundle.main.bundleIdentifier`
is nil in the SPM test runner and crashed the cross-platform test suite.
Verified: `swift build` + `swift test` (macOS cross-platform package, all
tests pass) and the full WordPress iOS app + Share/Draft/NotificationService
extensions build.
* Reference the Modules package instead of re-declaring cross-platform targets
The cross-platform Package.swift re-declared 14 targets that already live in
Modules/Package.swift, differing only in their macOS-stripped dependency lists
— a standing source of drift. Depend on the Modules package and reference its
products instead, so each target is defined once.
This requires Modules to be macOS-aware:
- Add a .macOS(.v14) floor, which satisfies the highest dependency floors
(GutenbergKit 14, WordPressAPI 13, Gravatar 12) and clears platform-floor
validation for the whole graph.
- Gate the WordPressShared -> WordPressSharedObjCUI edge to non-macOS platforms;
it is UIKit-only.
- Wrap JetpackStatsWidgetsCore's iOS-only AppIntents in #if os(iOS).
The root manifest drops from 149 to 51 lines and now inherits Modules'
dependency changes automatically. Trade-off: `swift test` resolves the full
Modules dependency graph (40 packages) rather than a curated 5.
Verified: swift build + swift test on macOS (77 tests) and the WordPress iOS
app build.
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
0 commit comments