File tree Expand file tree Collapse file tree 4 files changed +52
-15
lines changed Expand file tree Collapse file tree 4 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+
30+ # Remove huge files that we can rebuild quickly.
31+ # This brings the cache size from 49GB down to 33GB.
32+ find " ." -type f -name " libwp_api.*" -exec rm -v {} +
33+ find " ." -type f -name " libwordpress.a" -exec rm -v {} +
34+
35+ # if [ "$HAS_CACHE" = false ]; then
36+ echo " Building Cache"
37+ # Use Apple Archiver because it's way faster
38+ aa archive -D target -o wprs-build-cache.aar
39+ stat wprs-build-cache.aar
40+ save_cache ./wprs-build-cache.aar " ${BUILD_CACHE_KEY} " --force
41+ rm wprs-build-cache.aar
42+ # fi
43+
44+ zip -r target/libwordpressFFI.xcframework.zip target/libwordpressFFI.xcframework
Original file line number Diff line number Diff line change @@ -60,24 +60,14 @@ 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/wp_api.swift
7867 - native/swift/Sources/wordpress-api-wrapper/wp_localization.swift
7968 - native/swift/Sources/wordpress-api-wrapper/wp_com.swift
8069 - native/swift/Sources/wordpress-api-wrapper/jetpack.swift
70+ plugins : [$CI_TOOLKIT]
8171 agents :
8272 queue : mac
8373 - 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 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