diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6bc8230e..895e8ac3 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,5 +38,9 @@ jobs: toolchain: ${{ matrix.toolchain }} override: true profile: minimal - - name: Test on Rust ${{ matrix.toolchain }} + - name: Test on Rust ${{ matrix.toolchain }} (only Windows) + if: matrix.os == 'windows-latest' + run: cargo test --verbose --no-default-features + - name: Test on Rust ${{ matrix.toolchain }} (non Windows) + if: matrix.os == 'windows-latest' run: cargo test --verbose --color always -- --nocapture diff --git a/Cargo.toml b/Cargo.toml index 7e2f41b3..86f23001 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,10 +12,16 @@ exclude = [".github/", ".cirrus.yml", "tests/", "test_data/", "contrib/", "pypr [[bin]] name = "revaultd" path = "src/bin/daemon.rs" +required-features = ["jsonrpc_server"] [[bin]] name = "revault-cli" path = "src/bin/cli.rs" +required-features = ["jsonrpc_server"] + +[features] +default = ["jsonrpc_server"] +jsonrpc_server = ["jsonrpc-core", "jsonrpc-derive", "mio"] [dependencies] revault_tx = { git = "https://github.com/revault/revault_tx", features = ["use-serde"] } @@ -54,6 +60,6 @@ rusqlite = { version = "0.26.3", features = ["bundled", "unlock_notify"] } libc = "0.2.80" # For the JSONRPC server -jsonrpc-core = "15.1" -jsonrpc-derive = "15.1" -mio = { version = "0.7", features = ["default", "os-poll", "os-util", "uds"] } +jsonrpc-core = { version = "15.1", optional = true } +jsonrpc-derive = { version = "15.1", optional = true } +mio = { version = "0.7", features = ["default", "os-poll", "os-util", "uds"], optional = true } diff --git a/src/lib.rs b/src/lib.rs index 3d880b54..f152b501 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ pub mod commands; mod communication; pub mod config; mod database; -#[cfg(not(windows))] +#[cfg(all(not(windows), feature = "jsonrpc_server"))] mod jsonrpc; mod revaultd; mod sigfetcher; @@ -146,8 +146,8 @@ impl DaemonControl { self.sigfetcher_conn.shutdown(); } - // TODO: make it optional at compile time /// Start and bind the server to the configured UNIX socket + #[cfg(all(not(windows), feature = "jsonrpc_server"))] pub fn rpc_server_setup(&self) -> Result { let socket_file = self.revaultd.read().unwrap().rpc_socket_file(); jsonrpc::server::rpcserver_setup(socket_file) @@ -260,8 +260,8 @@ impl DaemonHandle { .expect("Joining sigfetcher thread"); } - // TODO: make it optional at compilation time /// Start the JSONRPC server and listen for commands until we are stopped + #[cfg(all(not(windows), feature = "jsonrpc_server"))] pub fn rpc_server(&self) -> Result<(), io::Error> { log::info!("Starting JSONRPC server");