Cache Gutenberg XCFramework downloads on disk#25352
Conversation
Replace the Ruby download/extract logic in the Rakefile with a bash script that caches the extracted XCFrameworks in ~/Library/Caches. On subsequent runs the script copies from cache instead of re-downloading. curl --progress-bar provides download feedback that was previously missing. Also adds a Makefile with a `dependencies` target for convenience. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract into a temp directory and only move it to the final cache path after the download and extraction succeed. A partial download no longer leaves a corrupt cache directory that would be reused on every subsequent run. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Move GUTENBERG_VERSION into the bash script and default the frameworks directory so neither the Rakefile nor the Makefile need to know about it. One place to update when bumping the version. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
🤖 Build Failure AnalysisThis build has failures. Claude has analyzed them - check the build annotations for details. |
mktemp requires the parent directory to exist. Move the mkdir -p before the mktemp call so it works on fresh CI agents where the Caches directory doesn't exist yet. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 31373 | |
| Version | PR #25352 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 8b12843 | |
| Installation URL | 6eggpdtd3s3t0 |
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 31373 | |
| Version | PR #25352 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 8b12843 | |
| Installation URL | 22uedglfba7b8 |
The archive also contains react-native-bundle-source-map which is needed for Sentry sourcemap uploads. Copy everything from the cache directory instead of only *.xcframework. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
dcalhoun
left a comment
There was a problem hiding this comment.
Script looks good and tested well for me. I also smoke tested the Gutenberg mobile editor. My comments suggestions, nothing more. Merge when ready. 🚀
There was a problem hiding this comment.
We might add a default help target to improve discoverability.
diff --git a/Makefile b/Makefile
index ec8f8b3bec..3539ae12d1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,7 @@
-.PHONY: dependencies
+.PHONY: help dependencies
-dependencies:
+help: ## Show available targets
+ @grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | awk -F ':.*## ' '{printf " %-20s %s\n", $$1, $$2}'
+
+dependencies: ## Download and cache Gutenberg XCFrameworks
./Scripts/download-gutenberg-xcframeworks.sh
| fi | ||
|
|
||
| # Copy cached contents into the project. | ||
| rm -rf "${FRAMEWORKS_DIR}" |
There was a problem hiding this comment.
The likelihood of someone mistakenly passing / as an argument feels quite low, but given the severe repercussions of doing so, it may be worth guarding as Claude suggested. 😅
| rm -rf "${FRAMEWORKS_DIR}" | |
| if [[ -z "${FRAMEWORKS_DIR}" || "${FRAMEWORKS_DIR}" == "/" ]]; then | |
| echo "Error: invalid frameworks directory: '${FRAMEWORKS_DIR}'" >&2 | |
| exit 1 | |
| fi |
| # leave a corrupt cache that persists across runs. | ||
| mkdir -p "$(dirname "${CACHE_DIR}")" | ||
| TEMP_DIR="$(mktemp -d "${CACHE_DIR}.XXXXXX")" | ||
| trap 'rm -rf "${TEMP_DIR}"' EXIT |
| #!/bin/bash | ||
| set -euo pipefail |
There was a problem hiding this comment.
Nitpick: Apps Infra recently started moving toward a more portable shebang
| #!/bin/bash | |
| set -euo pipefail | |
| #!/usr/bin/env bash | |
| set -euo pipefail |
| # Usage: download-gutenberg-xcframeworks.sh [frameworks_dir] | ||
| # frameworks_dir defaults to WordPress/Frameworks | ||
|
|
||
| VERSION="v1.121.0" |
There was a problem hiding this comment.
What do you think of making the version an input with fallback, too?
There was a problem hiding this comment.
Actually... maybe we would be better served by extracting the version in a dedicated file? It's currently duplicated.
➜ g grep v1.121.0
Rakefile:GUTENBERG_VERSION = 'v1.121.0'
fastlane/lanes/localization.rb:GUTENBERG_TAG = 'v1.121.0'
| # frameworks_dir defaults to WordPress/Frameworks | ||
|
|
||
| VERSION="v1.121.0" | ||
| FRAMEWORKS_DIR="${1:-WordPress/Frameworks}" |
There was a problem hiding this comment.
Nitpick.
I love that this is can be changed at call time. Nice UX. But neither rake nor make leverages this capability.
Did you consider exposing it? If not, is there value in having it configurable here?
FWIW, I think this is not an issue and we shouldn't get distracted with exposing the config. But maybe there's a good use case for it that I'm not aware of, so I thought I'd call it out.





Summary
We're not quite done with Gutenberg Mobile yet, and we'll still have Aztec around for the foreseeable future. Using worktrees, it's annoying having to redownload 160MB every time, so I wanted to improve the situation.
This PR moves the logic to Bash to make it pretty much dependency-free, but for folks with
rakemuscle memory everything still works properly.Scripts/download-gutenberg-xcframeworks.sh) that usescurl --progress-barfor visible download feedback~/Library/Caches/WordPress-iOS/Gutenberg/<version>/so subsequent runs justcp -afrom cache instead of re-downloadingMakefilewith adependenciestarget as a lightweight alternative torake dependencies:gutenberg_xcframeworksopen-uri,rubygems/package, andzlibrequires from RakefileTest plan
rm -rf WordPress/Frameworks ~/Library/Caches/WordPress-iOS/Gutenbergthenbundle exec rake dependencies:gutenberg_xcframeworks— should download with progress and complete successfullyrm -rf WordPress/Frameworksthenmake dependencies— should restore frameworks from cache without downloading🤖 Generated with Claude Code