mirror of
https://github.com/chatmail/core.git
synced 2026-05-20 23:36:30 +03:00
build!: remove jsonrpc feature flag
It is enabled everywhere by default since some time now. Breaking, because existing build scripts might need to be adjusted.
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -152,7 +152,7 @@ jobs:
|
|||||||
uses: swatinem/rust-cache@v2
|
uses: swatinem/rust-cache@v2
|
||||||
|
|
||||||
- name: Build C library
|
- name: Build C library
|
||||||
run: cargo build -p deltachat_ffi --features jsonrpc
|
run: cargo build -p deltachat_ffi
|
||||||
|
|
||||||
- name: Upload C library
|
- name: Upload C library
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ add_custom_command(
|
|||||||
PREFIX=${CMAKE_INSTALL_PREFIX}
|
PREFIX=${CMAKE_INSTALL_PREFIX}
|
||||||
LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
|
LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
|
||||||
INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR}
|
INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR}
|
||||||
${CARGO} build --target-dir=${CMAKE_BINARY_DIR}/target --release --features jsonrpc
|
${CARGO} build --target-dir=${CMAKE_BINARY_DIR}/target --release
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deltachat-ffi
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/deltachat-ffi
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ crate-type = ["cdylib", "staticlib"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
deltachat = { workspace = true, default-features = false }
|
deltachat = { workspace = true, default-features = false }
|
||||||
deltachat-jsonrpc = { workspace = true, optional = true }
|
deltachat-jsonrpc = { workspace = true }
|
||||||
libc = { workspace = true }
|
libc = { workspace = true }
|
||||||
human-panic = { version = "2", default-features = false }
|
human-panic = { version = "2", default-features = false }
|
||||||
num-traits = { workspace = true }
|
num-traits = { workspace = true }
|
||||||
@@ -30,5 +30,4 @@ yerpc = { workspace = true, features = ["anyhow_expose"] }
|
|||||||
[features]
|
[features]
|
||||||
default = ["vendored"]
|
default = ["vendored"]
|
||||||
vendored = ["deltachat/vendored", "deltachat-jsonrpc/vendored"]
|
vendored = ["deltachat/vendored", "deltachat-jsonrpc/vendored"]
|
||||||
jsonrpc = ["dep:deltachat-jsonrpc"]
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ use deltachat::stock_str::StockMessage;
|
|||||||
use deltachat::webxdc::StatusUpdateSerial;
|
use deltachat::webxdc::StatusUpdateSerial;
|
||||||
use deltachat::*;
|
use deltachat::*;
|
||||||
use deltachat::{accounts::Accounts, log::LogExt};
|
use deltachat::{accounts::Accounts, log::LogExt};
|
||||||
|
use deltachat_jsonrpc::api::CommandApi;
|
||||||
|
use deltachat_jsonrpc::yerpc::{OutReceiver, RpcClient, RpcSession};
|
||||||
use num_traits::{FromPrimitive, ToPrimitive};
|
use num_traits::{FromPrimitive, ToPrimitive};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
@@ -4930,22 +4932,15 @@ pub unsafe extern "C" fn dc_accounts_get_event_emitter(
|
|||||||
Box::into_raw(Box::new(emitter))
|
Box::into_raw(Box::new(emitter))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "jsonrpc")]
|
pub struct dc_jsonrpc_instance_t {
|
||||||
mod jsonrpc {
|
|
||||||
use deltachat_jsonrpc::api::CommandApi;
|
|
||||||
use deltachat_jsonrpc::yerpc::{OutReceiver, RpcClient, RpcSession};
|
|
||||||
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
pub struct dc_jsonrpc_instance_t {
|
|
||||||
receiver: OutReceiver,
|
receiver: OutReceiver,
|
||||||
handle: RpcSession<CommandApi>,
|
handle: RpcSession<CommandApi>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_jsonrpc_init(
|
pub unsafe extern "C" fn dc_jsonrpc_init(
|
||||||
account_manager: *mut dc_accounts_t,
|
account_manager: *mut dc_accounts_t,
|
||||||
) -> *mut dc_jsonrpc_instance_t {
|
) -> *mut dc_jsonrpc_instance_t {
|
||||||
if account_manager.is_null() {
|
if account_manager.is_null() {
|
||||||
eprintln!("ignoring careless call to dc_jsonrpc_init()");
|
eprintln!("ignoring careless call to dc_jsonrpc_init()");
|
||||||
return ptr::null_mut();
|
return ptr::null_mut();
|
||||||
@@ -4962,28 +4957,28 @@ mod jsonrpc {
|
|||||||
let instance = dc_jsonrpc_instance_t { receiver, handle };
|
let instance = dc_jsonrpc_instance_t { receiver, handle };
|
||||||
|
|
||||||
Box::into_raw(Box::new(instance))
|
Box::into_raw(Box::new(instance))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_jsonrpc_unref(jsonrpc_instance: *mut dc_jsonrpc_instance_t) {
|
pub unsafe extern "C" fn dc_jsonrpc_unref(jsonrpc_instance: *mut dc_jsonrpc_instance_t) {
|
||||||
if jsonrpc_instance.is_null() {
|
if jsonrpc_instance.is_null() {
|
||||||
eprintln!("ignoring careless call to dc_jsonrpc_unref()");
|
eprintln!("ignoring careless call to dc_jsonrpc_unref()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
drop(Box::from_raw(jsonrpc_instance));
|
drop(Box::from_raw(jsonrpc_instance));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn spawn_handle_jsonrpc_request(handle: RpcSession<CommandApi>, request: String) {
|
fn spawn_handle_jsonrpc_request(handle: RpcSession<CommandApi>, request: String) {
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
handle.handle_incoming(&request).await;
|
handle.handle_incoming(&request).await;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_jsonrpc_request(
|
pub unsafe extern "C" fn dc_jsonrpc_request(
|
||||||
jsonrpc_instance: *mut dc_jsonrpc_instance_t,
|
jsonrpc_instance: *mut dc_jsonrpc_instance_t,
|
||||||
request: *const libc::c_char,
|
request: *const libc::c_char,
|
||||||
) {
|
) {
|
||||||
if jsonrpc_instance.is_null() || request.is_null() {
|
if jsonrpc_instance.is_null() || request.is_null() {
|
||||||
eprintln!("ignoring careless call to dc_jsonrpc_request()");
|
eprintln!("ignoring careless call to dc_jsonrpc_request()");
|
||||||
return;
|
return;
|
||||||
@@ -4992,12 +4987,12 @@ mod jsonrpc {
|
|||||||
let handle = &(*jsonrpc_instance).handle;
|
let handle = &(*jsonrpc_instance).handle;
|
||||||
let request = to_string_lossy(request);
|
let request = to_string_lossy(request);
|
||||||
spawn_handle_jsonrpc_request(handle.clone(), request);
|
spawn_handle_jsonrpc_request(handle.clone(), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_jsonrpc_next_response(
|
pub unsafe extern "C" fn dc_jsonrpc_next_response(
|
||||||
jsonrpc_instance: *mut dc_jsonrpc_instance_t,
|
jsonrpc_instance: *mut dc_jsonrpc_instance_t,
|
||||||
) -> *mut libc::c_char {
|
) -> *mut libc::c_char {
|
||||||
if jsonrpc_instance.is_null() {
|
if jsonrpc_instance.is_null() {
|
||||||
eprintln!("ignoring careless call to dc_jsonrpc_next_response()");
|
eprintln!("ignoring careless call to dc_jsonrpc_next_response()");
|
||||||
return ptr::null_mut();
|
return ptr::null_mut();
|
||||||
@@ -5006,13 +5001,13 @@ mod jsonrpc {
|
|||||||
block_on(api.receiver.recv())
|
block_on(api.receiver.recv())
|
||||||
.map(|result| serde_json::to_string(&result).unwrap_or_default().strdup())
|
.map(|result| serde_json::to_string(&result).unwrap_or_default().strdup())
|
||||||
.unwrap_or(ptr::null_mut())
|
.unwrap_or(ptr::null_mut())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub unsafe extern "C" fn dc_jsonrpc_blocking_call(
|
pub unsafe extern "C" fn dc_jsonrpc_blocking_call(
|
||||||
jsonrpc_instance: *mut dc_jsonrpc_instance_t,
|
jsonrpc_instance: *mut dc_jsonrpc_instance_t,
|
||||||
input: *const libc::c_char,
|
input: *const libc::c_char,
|
||||||
) -> *mut libc::c_char {
|
) -> *mut libc::c_char {
|
||||||
if jsonrpc_instance.is_null() {
|
if jsonrpc_instance.is_null() {
|
||||||
eprintln!("ignoring careless call to dc_jsonrpc_blocking_call()");
|
eprintln!("ignoring careless call to dc_jsonrpc_blocking_call()");
|
||||||
return ptr::null_mut();
|
return ptr::null_mut();
|
||||||
@@ -5030,5 +5025,4 @@ mod jsonrpc {
|
|||||||
}
|
}
|
||||||
None => ptr::null_mut(),
|
None => ptr::null_mut(),
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ const buildArgs = [
|
|||||||
'build',
|
'build',
|
||||||
'--release',
|
'--release',
|
||||||
'--features',
|
'--features',
|
||||||
'vendored,jsonrpc',
|
'vendored',
|
||||||
'-p',
|
'-p',
|
||||||
'deltachat_ffi'
|
'deltachat_ffi'
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -52,10 +52,7 @@ python3-venv` should give you a usable python installation.
|
|||||||
|
|
||||||
First, build the core library::
|
First, build the core library::
|
||||||
|
|
||||||
cargo build --release -p deltachat_ffi --features jsonrpc
|
cargo build --release -p deltachat_ffi
|
||||||
|
|
||||||
`jsonrpc` feature is required even if not used by the bindings
|
|
||||||
because `deltachat.h` includes JSON-RPC functions unconditionally.
|
|
||||||
|
|
||||||
Create the virtual environment and activate it::
|
Create the virtual environment and activate it::
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ set -euo pipefail
|
|||||||
|
|
||||||
export DCC_RS_TARGET=debug
|
export DCC_RS_TARGET=debug
|
||||||
export DCC_RS_DEV="$PWD"
|
export DCC_RS_DEV="$PWD"
|
||||||
cargo build -p deltachat_ffi --features jsonrpc
|
cargo build -p deltachat_ffi
|
||||||
|
|
||||||
tox -c python -e py --devenv venv
|
tox -c python -e py --devenv venv
|
||||||
venv/bin/pip install --upgrade pip
|
venv/bin/pip install --upgrade pip
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export DCC_RS_DEV=`pwd`
|
|||||||
|
|
||||||
cd python
|
cd python
|
||||||
|
|
||||||
cargo build -p deltachat_ffi --features jsonrpc
|
cargo build -p deltachat_ffi
|
||||||
|
|
||||||
# remove and inhibit writing PYC files
|
# remove and inhibit writing PYC files
|
||||||
rm -rf tests/__pycache__
|
rm -rf tests/__pycache__
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ set -e -x
|
|||||||
|
|
||||||
# compile core lib
|
# compile core lib
|
||||||
|
|
||||||
cargo build --release -p deltachat_ffi --features jsonrpc
|
cargo build --release -p deltachat_ffi
|
||||||
|
|
||||||
# Statically link against libdeltachat.a.
|
# Statically link against libdeltachat.a.
|
||||||
export DCC_RS_DEV="$PWD"
|
export DCC_RS_DEV="$PWD"
|
||||||
|
|||||||
Reference in New Issue
Block a user