Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix capi build #210

Open
wants to merge 5 commits into
base: v5
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[workspace]
members = ["biscuit-auth", "biscuit-quote", "biscuit-parser"]
members = ["biscuit-auth", "biscuit-quote", "biscuit-parser", "biscuit-capi"]
33 changes: 12 additions & 21 deletions biscuit-auth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ documentation = "https://docs.rs/biscuit-auth"
homepage = "https://github.com/biscuit-auth/biscuit"
repository = "https://github.com/biscuit-auth/biscuit-rust"

include = [
"Cargo.toml",
"cbindgen.toml",
"build.rs",
"examples/*.rs",
"LICENSE",
"README.md",
"src/*.rs",
"src/*/*.rs",
"tests/*.rs"
]

[features]
default = ["regex-full", "datalog-macro"]
regex-full = [ "regex/perf", "regex/unicode"]
# used by cargo-c to signal the compilation of C bindings
capi = ["inline-c"]
wasm = ["wasm-bindgen", "getrandom/wasm-bindgen"]
# used by biscuit-wasm to serialize errors to JSON
serde-error = ["serde", "biscuit-parser/serde-error"]
Expand All @@ -38,7 +48,6 @@ hex = "0.4"
zeroize = { version = "1", default-features = false }
thiserror = "1"
rand = { version = "0.8" }
inline-c = { version = "0.1", optional = true }
wasm-bindgen = { version = "0.2", optional = true }
base64 = "0.13.0"
ed25519-dalek = { version = "2.0.0", features = ["rand_core", "zeroize"] }
Expand All @@ -50,7 +59,6 @@ biscuit-parser = { version = "0.1.2", path = "../biscuit-parser" }
biscuit-quote = { version = "0.2.2", optional = true, path = "../biscuit-quote" }
chrono = { version = "0.4.26", optional = true, default-features = false, features = ["serde"] }


[dev-dependencies]
bencher = "0.1.5"
rand = "0.8"
Expand All @@ -63,23 +71,6 @@ serde_json = "1.0.67"
#[build-dependencies]
#prost-build = "0.10"

[package.metadata.capi.library]
# Used as the library name and defaults to the crate name. This might get
# prefixed with `lib` depending on the target platform.
name = "biscuit_auth"

include = [
"Cargo.toml",
"cbindgen.toml",
"build.rs",
"examples/*.rs",
"LICENSE",
"README.md",
"src/*.rs",
"src/*/*.rs",
"tests/*.rs"
]

[[example]]
name = "testcases"
required-features = ["serde-error"]
Expand Down
6 changes: 0 additions & 6 deletions biscuit-auth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,6 @@ pub use token::Biscuit;
pub use token::RootKeyProvider;
pub use token::{ThirdPartyBlock, ThirdPartyRequest};

#[cfg(cargo_c)]
mod capi;

#[cfg(cargo_c)]
pub use capi::*;

#[cfg(bwk)]
mod bwk;
#[cfg(bwk)]
Expand Down
1 change: 1 addition & 0 deletions biscuit-auth/tests/macros.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg(not(feature = "capi"))]
use biscuit_auth::builder;
use biscuit_quote::{
authorizer, authorizer_merge, biscuit, biscuit_merge, block, block_merge, check, fact, policy,
Expand Down
1 change: 1 addition & 0 deletions biscuit-auth/tests/rights.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(unused_must_use)]
#![cfg(not(feature = "capi"))]
use biscuit::builder::*;
use biscuit::datalog::SymbolTable;
use biscuit::KeyPair;
Expand Down
19 changes: 19 additions & 0 deletions biscuit-capi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[package]
name = "biscuit-capi"
version = "0.1.0"
edition = "2021"

[features]
# used by cargo-c to signal the compilation of C bindings
capi = ["inline-c"]

[package.metadata.capi.library]
# Used as the library name and defaults to the crate name. This might get
# prefixed with `lib` depending on the target platform.
name = "biscuit_auth"

[dependencies]
biscuit-auth = { version = "4.1.1", path = "../biscuit-auth" }
inline-c = { version = "0.1", optional = true }
rand = { version = "0.8" }

Loading
Loading