mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-08-07 15:43:20 +00:00
chore: gate embed p2p transport on cargo feature (#157)
* chore: gate logos-delivery transport on cargo feature, not env-dependent cfg * chore: fix clippy
This commit is contained in:
parent
098612ba8b
commit
943ba2973f
@ -4,23 +4,22 @@ use std::process::Command;
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("cargo:rerun-if-env-changed=LOGOS_DELIVERY_LIB_DIR");
|
println!("cargo:rerun-if-env-changed=LOGOS_DELIVERY_LIB_DIR");
|
||||||
println!("cargo::rustc-check-cfg=cfg(logos_delivery)");
|
|
||||||
|
|
||||||
if std::env::var_os("CARGO_FEATURE_EMBEDDED_P2P_DELIVERY").is_none() {
|
if std::env::var_os("CARGO_FEATURE_EMBEDDED_P2P_DELIVERY").is_none() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(lib_dir) = locate_lib_dir() else {
|
let Some(lib_dir) = locate_lib_dir() else {
|
||||||
// Feature is on but the native library is unavailable (e.g. `cargo
|
println!(
|
||||||
// check` on a machine without nix). Skip the cfg so the FFI module is
|
"cargo:warning=embedded_p2p_delivery feature is enabled but \
|
||||||
// not compiled — this keeps `cargo check` working without producing
|
liblogosdelivery could not be located; `cargo check`/`clippy` will \
|
||||||
// unresolved symbols at link time. `EmbeddedP2pDeliveryService` is
|
pass, but building or testing will fail at link. Enter the dev shell \
|
||||||
// simply absent until the library can be found.
|
with `nix develop` or set LOGOS_DELIVERY_LIB_DIR to the directory \
|
||||||
|
containing the library."
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
println!("cargo:rustc-cfg=logos_delivery");
|
|
||||||
|
|
||||||
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR not set");
|
let out_dir = std::env::var("OUT_DIR").expect("OUT_DIR not set");
|
||||||
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap_or_default();
|
||||||
|
|
||||||
|
|||||||
@ -2,8 +2,8 @@ mod local_broadcaster;
|
|||||||
|
|
||||||
pub use local_broadcaster::LocalBroadcaster;
|
pub use local_broadcaster::LocalBroadcaster;
|
||||||
|
|
||||||
#[cfg(logos_delivery)]
|
#[cfg(feature = "embedded_p2p_delivery")]
|
||||||
pub mod embedded_p2p_delivery;
|
pub mod embedded_p2p_delivery;
|
||||||
|
|
||||||
#[cfg(logos_delivery)]
|
#[cfg(feature = "embedded_p2p_delivery")]
|
||||||
pub use embedded_p2p_delivery::{EmbeddedP2pDeliveryService, P2pConfig};
|
pub use embedded_p2p_delivery::{EmbeddedP2pDeliveryService, P2pConfig};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user