Skip to content

Remove unused wordpress-rs dependency from the stats widget - #25966

Open
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/stats-widget-drop-wordpress-rs
Open

Remove unused wordpress-rs dependency from the stats widget#25966
jkmassel wants to merge 1 commit into
trunkfrom
jkmassel/stats-widget-drop-wordpress-rs

Conversation

@jkmassel

@jkmassel jkmassel commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Removes a stray dependency that linked the entire wordpress-rs static library into the stats widget, which never used it.

Summary

  • XcodeTarget_StatsWidget (the SPM product backing JetpackStatsWidgets.appex) declared .product(name: "WordPressAPI", package: "wordpress-rs"), but nothing in the widget references it.
  • wordpress-rs ships as a static library (libwp_mobile.a), so it was copied into the widget binary as dead code — duplicating what the main app already carries.
  • Dropping the one line removes ~26.6 MB of loaded code from the widget (arm64/Release).

Root Cause

The widget target imports only JetpackStatsWidgetsCore, WidgetKit, and Foundation. JetpackStatsWidgetsCore depends solely on BuildSettingsKit, and none of the widget's other declared dependencies (WordPressKit, WordPressShared, WordPressUI, TracksMini) pull in wordpress-rs. The WordPressAPI product was the sole path linking it in, and it was unreferenced — grepping the widget target and its core module for any WordPressAPI / uniffi / wp_api symbol returns nothing.

Dead code stripping doesn't cover this: DEAD_CODE_STRIPPING is already on for Release, but linking the WordPressAPI Swift module pins its metadata → the uniffi FFI thunks → the Rust archive, so the linker retains the whole thing even though the widget's own code never calls it. The fix is to not link it. The main app is wordpress-rs's only genuine consumer and is unchanged.

Impact

Measured on the arm64 device slice, Release configuration, JetpackStatsWidgets.appex:

Metric Before After Delta
__TEXT (code) 32.96 MB 7.98 MB −25.0 MB
__DATA_CONST + __DATA 2.60 MB 1.00 MB −1.6 MB
Loaded code total 35.57 MB 8.98 MB −26.6 MB
wordpress-rs / uniffi / WordPressAPI symbols 146,506 0

Figures are uncompressed — the App Store download delta will be smaller after compression, but the on-device install footprint drops by the full amount.

Test Plan

  • JetpackStatsWidgets builds and links in Release (arm64) with the dependency removed
  • Confirmed zero wordpress-rs / uniffi / WordPressAPI symbols remain in the widget binary
  • Stats widgets still render and refresh on device (Small / Medium / Large)

`XcodeTarget_StatsWidget` linked `WordPressAPI` (and its static `wordpress-rs`
xcframework), but neither the widget target nor `JetpackStatsWidgetsCore`
references any of its symbols — the static library was duplicated into
`JetpackStatsWidgets.appex` as dead weight.

Removing the dependency drops ~26.6 MB of loaded code (`__TEXT` 33.0 -> 8.0 MB)
from the widget binary (arm64/Release) with no functional change; the widget
still builds and links cleanly.
@dangermattic

dangermattic commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator
1 Warning
⚠️ Modules/Package.swift was changed without updating its corresponding Package.resolved.

If the change includes adding, removing, or editing a dependency please resolve the Swift packages as appropriate to your project setup (e.g. in Xcode or by running swift package resolve).

If the change to the Package.swift did not modify dependencies, ignoring this warning should be safe, but we recommend double checking and running the package resolution just in case.
.

Generated by 🚫 Danger

@jkmassel jkmassel added Widgets Anything related to Home Screen widgets Performance labels Sep 1, 2026
@jkmassel jkmassel self-assigned this Sep 1, 2026
@jkmassel jkmassel added this to the 27.3 milestone Sep 1, 2026
@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack
ConfigurationRelease-Alpha
Build Number34119
VersionPR #25966
Bundle IDcom.jetpack.alpha
Commita75aee3
Installation URL7tp6tspav35fo
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@wpmobilebot

Copy link
Copy Markdown
Contributor
App Icon📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress
ConfigurationRelease-Alpha
Build Number34119
VersionPR #25966
Bundle IDorg.wordpress.alpha
Commita75aee3
Installation URL7c9ak3frbvts8
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jkmassel
jkmassel requested a review from crazytonyli September 1, 2026 20:13
@jkmassel
jkmassel added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Performance Widgets Anything related to Home Screen widgets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants