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

Make uniffi_build optional in uniffi_macros #2019

Merged
merged 2 commits into from
Mar 11, 2024
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
2 changes: 1 addition & 1 deletion fixtures/uitests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ name = "uniffi_uitests"

[dependencies]
uniffi = { workspace = true }
uniffi_macros = {path = "../../uniffi_macros"}
uniffi_macros = { path = "../../uniffi_macros", features = ["trybuild"] }
thiserror = "1.0"

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion uniffi_bindgen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ goblin = "0.8"
heck = "0.4"
once_cell = "1.12"
paste = "1.0"
serde = "1"
serde = { version = "1", features = ["derive"] }
toml = "0.5"
uniffi_meta = { path = "../uniffi_meta", version = "=0.26.1" }
uniffi_testing = { path = "../uniffi_testing", version = "=0.26.1" }
Expand Down
6 changes: 4 additions & 2 deletions uniffi_macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ fs-err = "2.7.0"
once_cell = "1.10.0"
proc-macro2 = "1.0"
quote = "1.0"
serde = "1.0.136"
serde = { version = "1.0.136", features = ["derive"] }
syn = { version = "2.0", features = ["full", "visit-mut"] }
toml = "0.5.9"
uniffi_build = { path = "../uniffi_build", version = "=0.26.1" }
uniffi_build = { path = "../uniffi_build", version = "=0.26.1", optional = true }
uniffi_meta = { path = "../uniffi_meta", version = "=0.26.1" }

[features]
default = []
# Enable the generate_and_include_scaffolding! macro
trybuild = [ "dep:uniffi_build" ]
# Enable extra features that require a nightly compiler:
# * Add the full module path of exported items to FFI metadata instead of just the crate name.
# This may be used by language backends to generate nested module structures in the future.
Expand Down
2 changes: 2 additions & 0 deletions uniffi_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

//! Macros for `uniffi`.
#[cfg(feature = "trybuild")]
use camino::Utf8Path;
use proc_macro::TokenStream;
use quote::quote;
Expand Down Expand Up @@ -343,6 +344,7 @@ pub fn use_udl_object(tokens: TokenStream) -> TokenStream {
/// uniffi_macros::generate_and_include_scaffolding!("path/to/my/interface.udl");
/// ```
#[proc_macro]
#[cfg(feature = "trybuild")]
pub fn generate_and_include_scaffolding(udl_file: TokenStream) -> TokenStream {
let udl_file = syn::parse_macro_input!(udl_file as LitStr);
let udl_file_string = udl_file.value();
Expand Down