Skip to content

Commit

Permalink
Make server feature optional
Browse files Browse the repository at this point in the history
  • Loading branch information
nilclass committed Feb 13, 2024
1 parent 00b59af commit aaabb1e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
23 changes: 23 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ license = "MIT"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
actix-cors = "0.6.5"
actix-web = "4.4.0"
actix-cors = { version = "0.6.5", optional = true }
actix-web = { version = "4.4.0", optional = true }
anyhow = "1.0.76"
clap = { version = "4.4.11", features = ["derive"] }
comfy-table = "7.1.0"
Expand All @@ -23,13 +23,17 @@ shadow-rs = "0.25.0"
time = "0.3.31"
zip = { version = "0.6.6", optional = true }
mime_guess = "2.0.4"
rusb = "0.9.3"

[build-dependencies]
shadow-rs = "0.25.0"
anyhow = "1.0.76"

[features]
default = []
default = ["server"]

# Enable web server
server = ["actix-cors", "actix-web"]

# Embed jumperlab, and serve it
jumperlab = ["zip"]
jumperlab = ["server", "zip"]
1 change: 1 addition & 0 deletions src/device_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl DeviceManager {
}
}

#[allow(unused)]
pub fn set_log_path(&mut self, log_path: String) {
self.log_path = log_path;
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
pub mod device;
pub mod device_manager;
pub mod parser;
#[cfg(feature = "server")]
pub mod server;
pub mod types;
pub mod validate;
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ shadow!(build);
mod device;
mod device_manager;
mod parser;
#[cfg(feature = "server")]
mod server;
mod types;
mod validate;
Expand Down Expand Up @@ -89,6 +90,7 @@ enum Command {
color: String,
},

#[cfg(feature = "server")]
/// Start HTTP server
#[command()]
Server {
Expand Down Expand Up @@ -237,6 +239,7 @@ fn main() -> anyhow::Result<()> {
return Ok(());
}

#[cfg(feature = "server")]
if let Command::Server { listen } = args.command {
server::start(device_manager, Some(&listen)).expect("Start server");
return Ok(());
Expand Down

0 comments on commit aaabb1e

Please sign in to comment.