diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d4b303ce..70bf4b339 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ add_custom_command( PREFIX=${CMAKE_INSTALL_PREFIX} LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR} INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR} - ${CARGO} build --release --no-default-features + ${CARGO} build --release --no-default-features --features jsonrpc # Build in `deltachat-ffi` directory instead of using # `--package deltachat_ffi` to avoid feature resolver version diff --git a/deltachat-ffi/Cargo.toml b/deltachat-ffi/Cargo.toml index 390a23745..877187d48 100644 --- a/deltachat-ffi/Cargo.toml +++ b/deltachat-ffi/Cargo.toml @@ -16,7 +16,7 @@ crate-type = ["cdylib", "staticlib"] [dependencies] deltachat = { path = "../", default-features = false } -deltachat-jsonrpc = { path = "../deltachat-jsonrpc" } +deltachat-jsonrpc = { path = "../deltachat-jsonrpc", optional = true } libc = "0.2" human-panic = "1" num-traits = "0.2" @@ -27,7 +27,8 @@ thiserror = "1" rand = "0.7" [features] -default = ["vendored"] +default = ["vendored", "jsonrpc"] vendored = ["deltachat/vendored"] nightly = ["deltachat/nightly"] +jsonrpc = ["deltachat-jsonrpc"] diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index c258a588f..cd1f04983 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -4426,14 +4426,18 @@ pub unsafe extern "C" fn dc_accounts_get_next_event( .unwrap_or_else(ptr::null_mut) } +#[cfg(feature = "jsonrpc")] use deltachat_jsonrpc::api::CommandApi; +#[cfg(feature = "jsonrpc")] use deltachat_jsonrpc::yerpc::{MessageHandle, RpcHandle}; +#[cfg(feature = "jsonrpc")] pub struct dc_json_api_instance_t { receiver: async_std::channel::Receiver, handle: MessageHandle, } +#[cfg(feature = "jsonrpc")] #[no_mangle] pub unsafe extern "C" fn dc_get_json_api( account_manager: *mut dc_accounts_t, @@ -4454,6 +4458,7 @@ pub unsafe extern "C" fn dc_get_json_api( Box::into_raw(Box::new(instance)) } +#[cfg(feature = "jsonrpc")] #[no_mangle] pub unsafe extern "C" fn dc_json_api_unref(json_api_instance: *mut dc_json_api_instance_t) { if json_api_instance.is_null() { @@ -4464,6 +4469,7 @@ pub unsafe extern "C" fn dc_json_api_unref(json_api_instance: *mut dc_json_api_i Box::from_raw(json_api_instance); } +#[cfg(feature = "jsonrpc")] #[no_mangle] pub unsafe extern "C" fn dc_json_request( json_api_instance: *mut dc_json_api_instance_t, @@ -4482,6 +4488,7 @@ pub unsafe extern "C" fn dc_json_request( }); } +#[cfg(feature = "jsonrpc")] #[no_mangle] pub unsafe extern "C" fn dc_get_next_json_response( json_api_instance: *mut dc_json_api_instance_t, diff --git a/node/scripts/rebuild-core.js b/node/scripts/rebuild-core.js index 80dedcce5..9ff794773 100644 --- a/node/scripts/rebuild-core.js +++ b/node/scripts/rebuild-core.js @@ -9,7 +9,7 @@ const buildArgs = [ 'build', '--release', '--features', - 'vendored', + 'vendored,jsonrpc', '-p', 'deltachat_ffi' ]