From 2919bd3f770e05ea34f9c0fa0a7c96b53325d366 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Sat, 26 Feb 2022 03:04:19 +0100 Subject: [PATCH 1/3] fix(ffi): don't build C libraries by default Remove unconditional building of FFI libraries: now that nightly supports --crate-type, it can be opted into. This fixes cargo's pipelining both for dependencies and for dependent crates, resulting in faster from-scratch builds. --- Cargo.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f2ee5efe3e..e87137f595 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,9 +19,6 @@ include = [ #"build.rs", ] -[lib] -crate-type = ["lib", "staticlib", "cdylib"] - [dependencies] bytes = "1" futures-core = { version = "0.3", default-features = false } From e6d6e5c72bd7ff299e0f1ccc4832d27c07bb3ace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Sat, 26 Feb 2022 03:08:12 +0100 Subject: [PATCH 2/3] chore(ci): test FFI on CI using nightly Now that FFI is opt-in using cargo's --crate-type, nightly needs to be used on CI: this flag is still unstable and requires a nightly to enable -Z unstable options. --- .github/workflows/CI.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f17db9e638..6df6dfee79 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -157,7 +157,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: nightly override: true - name: Install cbindgen @@ -171,8 +171,8 @@ jobs: env: RUSTFLAGS: --cfg hyper_unstable_ffi with: - command: build - args: --features client,http1,http2,ffi + command: rustc + args: --features client,http1,http2,ffi -Z unstable-options --crate-type cdylib - name: Make Examples run: cd capi/examples && make client From 5b6f5a82076b2593356c8ed3b9d55e73ee2fe57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Sat, 26 Feb 2022 03:16:58 +0100 Subject: [PATCH 3/3] docs(ffi): document nightly requirement for FFI Update the command to use `--crate-type`. --- capi/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/capi/README.md b/capi/README.md index 9d6f9f6d14..c4e881362a 100644 --- a/capi/README.md +++ b/capi/README.md @@ -10,8 +10,8 @@ Because of that, it's only accessible if `--cfg hyper_unstable_ffi` is passed to ## Building -The C API is part of the Rust library, but isn't compiled by default. Using `cargo`, it can be compiled with the following command: +The C API is part of the Rust library, but isn't compiled by default. Using a nightly release of `cargo`, starting with `nightly-2022-03-02`, it can be compiled with the following command: ``` -RUSTFLAGS="--cfg hyper_unstable_ffi" cargo build --features client,http1,http2,ffi +RUSTFLAGS="--cfg hyper_unstable_ffi" cargo +nightly rustc --features client,http1,http2,ffi -Z unstable-options --crate-type cdylib ```