File tree Expand file tree Collapse file tree 5 files changed +52
-15
lines changed Expand file tree Collapse file tree 5 files changed +52
-15
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash -eu
2+
3+ echo " --- :rust: Installing Rust"
4+ curl --proto ' =https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -v -y
5+
6+ source " /Users/builder/.cargo/env"
7+
8+ CACHE_DATE=$( date +%V-%y)
9+
10+ echo " --- :package: Installing Rust Toolchains"
11+ make setup-rust
12+
13+ BUILD_CACHE_KEY=" wprs-xcframework-cache-${CACHE_DATE} "
14+ HAS_CACHE=false
15+
16+ echo " --- :swift: Building xcframework"
17+ echo " Using cache key: $BUILD_CACHE_KEY "
18+ restore_cache " ${BUILD_CACHE_KEY} "
19+
20+ # Use Apple Archiver because it's way faster
21+ if [[ -f " wprs-build-cache" ]]; then
22+ HAS_CACHE=true
23+
24+ echo " Extracting from build cache"
25+ aa extract -i wprs-build-cache.aar
26+ fi
27+
28+ make xcframework
29+ zip -r target/libwordpressFFI.xcframework.zip target/libwordpressFFI.xcframework
30+
31+ # Remove huge files that we can rebuild quickly.
32+ # This brings the cache size from 49GB down to 33GB.
33+ find " ." -type f -name " libwp_api.*" -exec rm -v {} +
34+ find " ." -type f -name " libwordpress.a" -exec rm -v {} +
35+
36+ # if [ "$HAS_CACHE" = false ]; then
37+ echo " Building Cache"
38+ # Use Apple Archiver because it's way faster
39+ aa archive -D target -o wprs-build-cache.aar
40+ stat wprs-build-cache.aar
41+ save_cache ./wprs-build-cache.aar " ${BUILD_CACHE_KEY} " --force
42+ rm wprs-build-cache.aar
43+ # fi
Original file line number Diff line number Diff line change @@ -60,21 +60,11 @@ steps:
6060 steps :
6161 - label : " :swift: :darwin: Build xcframework"
6262 key : " xcframework"
63- command : |
64- echo "--- :rust: Installing Rust"
65- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -v -y
66-
67- source "/Users/builder/.cargo/env"
68-
69- echo "--- :package: Installing Rust Toolchains"
70- make setup-rust
71-
72- echo "--- :swift: Building xcframework"
73- make xcframework
74- zip -r target/libwordpressFFI.xcframework.zip target/libwordpressFFI.xcframework
63+ command : " .buildkite/commands/build-xcframework.sh"
7564 artifact_paths :
7665 - target/libwordpressFFI.xcframework.zip
7766 - native/swift/Sources/wordpress-api-wrapper/*.swift
67+ plugins : [$CI_TOOLKIT]
7868 agents :
7969 queue : mac
8070 - label : " :swift: Build Docs"
Original file line number Diff line number Diff line change @@ -21,8 +21,9 @@ make setup-rust
2121echo " --- :rubygems: Setting up Gems"
2222install_gems
2323
24- echo " --- :rust: Building XCFramework"
25- make xcframework-package
24+ echo " --- :rust: Preparing XCFramework"
25+ .buildkite/download-xcframework.sh
26+ make xcframework-package-only
2627make xcframework-package-checksum
2728
2829release_version=" $1 "
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ wp_com_test_credentials.json
5555/vendor
5656/wp_rs_web /assets
5757/wp_rs_web /node_modules
58+ wprs-build-cache.aar
5859
5960# Cargo config
6061! .cargo /config.toml
Original file line number Diff line number Diff line change 130130xcframework : xcframework-all
131131endif
132132
133- xcframework-package : xcframework-all
133+ xcframework-package : xcframework-all xcframework-package-only
134+
135+ xcframework-package-only :
134136 rm -rf libwordpressFFI.xcframework.zip
135137 ditto -c -k --sequesterRsrc --keepParent target/libwordpressFFI.xcframework/ libwordpressFFI.xcframework.zip
136138
You can’t perform that action at this time.
0 commit comments