Skip to content

Commit

Permalink
rust: Attempt to fix build on docs.rs
Browse files Browse the repository at this point in the history
Copy over the pattern we have in ostree to add a feature that
disables our build script (which pulls in a requirement on the
libcomposefs C library, which doesn't exist in the docs.rs build env)
when we detect we're being built on docs.rs.

Signed-off-by: Colin Walters <[email protected]>
  • Loading branch information
cgwalters committed Aug 20, 2024
1 parent cf6368c commit ad8357c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
- name: Rust (default features)
run: cargo test
- name: Rust (all features)
run: cargo test --all-features
run: cargo test -F v1_0_4
clang-format:
runs-on: ubuntu-24.04
steps:
Expand Down
4 changes: 4 additions & 0 deletions rust/composefs-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ build = "build.rs"
license = "MIT OR Apache-2.0"
readme = "README.md"

[package.metadata.docs.rs]
features = ["dox"]

[package.metadata.system-deps.composefs]
name = "composefs"
version = "1"

[features]
dox = []
# Depend on 1.0.4 APIs
v1_0_4 = []

Expand Down
1 change: 1 addition & 0 deletions rust/composefs-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
fn main() {
#[cfg(not(feature = "dox"))]
if let Err(s) = system_deps::Config::new().probe() {
println!("cargo:warning={s}");
std::process::exit(1);
Expand Down
1 change: 1 addition & 0 deletions rust/composefs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ name = "composefs"
path = "src/lib.rs"

[features]
dox = ["composefs-sys/dox"]
# Depend on 1.0.4 APIs
v1_0_4 = ["composefs-sys/v1_0_4"]

Expand Down

0 comments on commit ad8357c

Please sign in to comment.