Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,7 @@ steps:
source "/Users/builder/.cargo/env"

echo "--- :package: Installing Rust Toolchains"
rustup target add x86_64-apple-ios
rustup target add aarch64-apple-ios
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-ios-sim

rustup toolchain install nightly
rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
make setup-rust

echo "--- :swift: Building xcframework"
make xcframework
Expand Down
30 changes: 20 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ docker_opts_shared := --rm -v "$(PWD)":$(docker_container_repo_dir) -w $(docker
rust_docker_run := docker run -v $(PWD):/$(docker_container_repo_dir) -w $(docker_container_repo_dir) -it -e CARGO_HOME=/app/.cargo $(rust_docker_container)
docker_build_and_run := docker build -t foo . && docker run $(docker_opts_shared) -it foo

# Required for supporting tvOS and watchOS. We can update the nightly toolchain version if needed.
# The project doesn't compile with the nightly toolchain built on 2024-03-28 and onward.
rust_nightly_toolchain := nightly-2024-03-27

uname := $(shell uname | tr A-Z a-z)
ifeq ($(uname), linux)
dylib_ext := so
Expand Down Expand Up @@ -78,7 +82,7 @@ xcframework-libraries:
$(MAKE) $*-combine-libraries

%-xcframework-library-with-nightly:
cargo +nightly build --target $* --package wp_api --release -Zbuild-std
cargo +$(rust_nightly_toolchain) build --target $* --package wp_api --release -Zbuild-std
$(MAKE) $*-combine-libraries

# Xcode doesn't properly support multiple XCFrameworks being used by the same target, so we need
Expand Down Expand Up @@ -127,15 +131,7 @@ else

# Generate the xcframework
#
# Requires the following runtimes:
# rustup target add x86_64-apple-ios
# rustup target add aarch64-apple-ios
# rustup target add aarch64-apple-darwin
# rustup target add x86_64-apple-darwin
# rustup target add aarch64-apple-ios-sim
#
# rustup toolchain install nightly
# rustup component add rust-src --toolchain nightly-aarch64-apple-darwin
# Run `make setup-rust` to install required rust toolchain.
xcframework: bindings xcframework-combined-libraries xcframework-headers

rm -rf target/libwordpressFFI.xcframework
Expand Down Expand Up @@ -228,3 +224,17 @@ build-in-docker:
dev-server:
mkdir -p .wordpress
docker-compose up

setup-rust:
RUST_TOOLCHAIN=stable $(MAKE) setup-rust-toolchain
RUST_TOOLCHAIN=$(rust_nightly_toolchain) $(MAKE) setup-rust-toolchain

setup-rust-toolchain:
rustup toolchain install $(RUST_TOOLCHAIN)
rustup component add rust-src --toolchain $(RUST_TOOLCHAIN)
rustup target add --toolchain $(RUST_TOOLCHAIN) \
x86_64-apple-ios \
aarch64-apple-ios \
aarch64-apple-darwin \
x86_64-apple-darwin \
aarch64-apple-ios-sim