Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow conditional compilation of agent protocols #196

Merged
merged 3 commits into from
Jan 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions Cargo.lock

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

26 changes: 15 additions & 11 deletions agent/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "agent"
version = "0.1.6"
version = "0.1.7"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>", "<bfjelds@microsoft.com>"]
edition = "2018"

Expand All @@ -22,11 +22,10 @@ hyper = "0.11"
kube = { version = "0.23.0", features = ["openapi"] }
k8s-openapi = { version = "0.6.0", features = ["v1_16"] }
log = "0.4"
mime = "0.3"
mockall = "0.6.0"
opcua-client = "0.7.0"
pest = "2.0"
pest_derive = "2.0"
opcua-client = { version = "0.7.0", optional = true }
pest = { version = "2.0", optional = true }
pest_derive = { version = "2.0", optional = true }
prost = "0.6"
rand = "0.7"
regex = "1"
Expand All @@ -35,19 +34,24 @@ serde_json = "1.0.45"
serde_yaml = "0.8.11"
serde_derive = "1.0.104"
akri-shared = { path = "../shared" }
sxd-document = "0.3.0"
sxd-xpath = "0.4.0"
tempfile = "3.1.0"
Copy link
Contributor Author

@jiayihu jiayihu Jan 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these deps and mime which didn't seem to be used anywhere

tokio = { version = "0.2", features = ["full"] }
tokio-core = "0.1"
tonic = "0.1"
tower = "0.3"
udev = "0.4"
udev = { version = "0.4", optional = true }
url = "2.1.0"
uuid = { version = "0.8.1", features = ["v4"] }
xml-rs = "0.8.0"
yaserde = "0.3.13"
yaserde_derive = "0.3.13"
xml-rs = { version = "0.8.0", optional = true }
yaserde = { version = "0.3.13", optional = true }
yaserde_derive = { version = "0.3.13", optional = true }

[build-dependencies]
tonic-build = "0.1.1"

[features]
default = ["onvif-feat", "opcua-feat", "udev-feat"]

onvif-feat = ["xml-rs", "yaserde", "yaserde_derive"]
opcua-feat = ["opcua-client"]
udev-feat = ["pest", "pest_derive", "udev"]
5 changes: 5 additions & 0 deletions agent/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#[macro_use]
extern crate log;

#[cfg(feature = "onvif-feat")]
#[macro_use]
extern crate yaserde_derive;

#[macro_use]
extern crate serde_derive;

#[cfg(feature = "udev-feat")]
extern crate pest;
#[cfg(feature = "udev-feat")]
#[macro_use]
extern crate pest_derive;

Expand Down
9 changes: 9 additions & 0 deletions agent/src/protocols/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ pub trait DiscoveryHandler {
}

pub mod debug_echo;
#[cfg(feature = "onvif-feat")]
mod onvif;
#[cfg(feature = "opcua-feat")]
mod opcua;
#[cfg(feature = "udev-feat")]
mod udev;

pub fn get_discovery_handler(
Expand All @@ -80,13 +83,19 @@ fn inner_get_discovery_handler(
query: &impl EnvVarQuery,
) -> Result<Box<dyn DiscoveryHandler + Sync + Send>, Error> {
match discovery_handler_config {
#[cfg(feature = "onvif-feat")]
ProtocolHandler::onvif(onvif) => Ok(Box::new(onvif::OnvifDiscoveryHandler::new(&onvif))),
#[cfg(feature = "udev-feat")]
ProtocolHandler::udev(udev) => Ok(Box::new(udev::UdevDiscoveryHandler::new(&udev))),
#[cfg(feature = "opcua-feat")]
ProtocolHandler::opcua(opcua) => Ok(Box::new(opcua::OpcuaDiscoveryHandler::new(&opcua))),
ProtocolHandler::debugEcho(dbg) => match query.get_env_var("ENABLE_DEBUG_ECHO") {
Ok(_) => Ok(Box::new(debug_echo::DebugEchoDiscoveryHandler::new(dbg))),
_ => Err(failure::format_err!("No protocol configured")),
},
config => {
panic!("No handler found for configuration {:?}", config);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion controller/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "controller"
version = "0.1.6"
version = "0.1.7"
authors = ["<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
4 changes: 2 additions & 2 deletions deployment/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.6
version: 0.1.7

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: 0.1.6
appVersion: 0.1.7
2 changes: 1 addition & 1 deletion samples/brokers/udev-video-broker/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "udev-video-broker"
version = "0.1.6"
version = "0.1.7"
authors = ["Kate Goldenring <kate.goldenring@microsoft.com>", "<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion shared/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "akri-shared"
version = "0.1.6"
version = "0.1.7"
authors = ["<bfjelds@microsoft.com>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.6
0.1.7