Skip to content

Commit

Permalink
Merge pull request #92 from lumeohq/dmitry/add-feature-gates
Browse files Browse the repository at this point in the history
Improve build times
  • Loading branch information
DmitrySamoylov authored Aug 11, 2022
2 parents a82a275 + a9bb700 commit 3b26bc8
Show file tree
Hide file tree
Showing 93 changed files with 848 additions and 155 deletions.
41 changes: 41 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,45 @@
members = [
"onvif",
"schema",
"transport",
"validate",
"xsd_rs/common",
"xsd_rs/metadatastream",
"xsd_rs/onvif_xsd",
"xsd_rs/radiometry",
"xsd_rs/rules",
"xsd_rs/soap_envelope",
"xsd_rs/types",
"xsd_rs/xmlmime",
"xsd_rs/xop",
"wsdl_rs/accesscontrol",
"wsdl_rs/accessrules",
"wsdl_rs/actionengine",
"wsdl_rs/advancedsecurity",
"wsdl_rs/analytics",
"wsdl_rs/authenticationbehavior",
"wsdl_rs/b_2",
"wsdl_rs/bf_2",
"wsdl_rs/credential",
"wsdl_rs/deviceio",
"wsdl_rs/devicemgmt",
"wsdl_rs/display",
"wsdl_rs/doorcontrol",
"wsdl_rs/event",
"wsdl_rs/imaging",
"wsdl_rs/media",
"wsdl_rs/media2",
"wsdl_rs/provisioning",
"wsdl_rs/ptz",
"wsdl_rs/receiver",
"wsdl_rs/recording",
"wsdl_rs/replay",
"wsdl_rs/schedule",
"wsdl_rs/search",
"wsdl_rs/t_1",
"wsdl_rs/thermal",
"wsdl_rs/uplink",
"wsdl_rs/ws_addr",
"wsdl_rs/ws_discovery",
"wsdl_rs/xml_xsd",
]
2 changes: 1 addition & 1 deletion onvif/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ futures-core = "0.3.8"
futures-util = "0.3.8"
num-bigint = "0.4.2"
reqwest = { version = "0.11.0", default-features = false }
schema = { version = "0.1.0", path = "../schema" }
schema = { version = "0.1.0", path = "../schema", default-features = false, features = ["analytics", "devicemgmt", "event", "media", "ptz"] }
sha1 = "0.6.0"
thiserror = "1.0"
tokio = { version = "1.0.1", features = ["time"] }
Expand Down
4 changes: 2 additions & 2 deletions onvif/examples/camera.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::schema::transport;
use onvif::{schema, soap};
use onvif::soap;
use schema::{self, transport};
use structopt::StructOpt;
use tracing::debug;
use url::Url;
Expand Down
6 changes: 2 additions & 4 deletions onvif/src/discovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@ use crate::soap;
use async_stream::stream;
use futures_core::stream::Stream;
use futures_util::{future::ready, stream::FuturesUnordered, StreamExt};
use schema::{
transport::Error as TransportError,
ws_discovery::{probe, probe_matches},
};
use schema::transport::Error as TransportError;
use schema::ws_discovery::{probe, probe_matches};
use std::{
future::Future,
iter,
Expand Down
1 change: 0 additions & 1 deletion onvif/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ extern crate yaserde_derive;

pub mod discovery;
pub mod soap;
pub use schema;

mod utils;
52 changes: 48 additions & 4 deletions schema/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,63 @@ edition = "2018"
license = "MIT"

[dependencies]
async-trait = "0.1.42"
bigdecimal = "0.3.0"
chrono = "0.4.19"
num-bigint = "0.4.2"
percent-encoding = "2.1.0"
thiserror = "1.0.23"
transport = { path = "../transport" }
url = "2.2.1"
validate = { path = "../validate" }
xml-rs = "0.8.3"
xsd-macro-utils = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
xsd-types = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
yaserde = "0.7.1"
yaserde_derive = "0.7.1"

# xsd
common = { path = "../xsd_rs/common" }
metadatastream = { path = "../xsd_rs/metadatastream", optional = true }
onvif = { package = "onvif-xsd", path = "../xsd_rs/onvif_xsd" }
radiometry = { path = "../xsd_rs/radiometry", optional = true }
rules = { path = "../xsd_rs/rules", optional = true }
soap_envelope = { path = "../xsd_rs/soap_envelope" }
types = { path = "../xsd_rs/types" }
xmlmime = { path = "../xsd_rs/xmlmime" }
xop = { path = "../xsd_rs/xop" }

# wsdl
accesscontrol = { path = "../wsdl_rs/accesscontrol" , optional = true}
accessrules = { path = "../wsdl_rs/accessrules" , optional = true}
actionengine = { path = "../wsdl_rs/actionengine" , optional = true}
advancedsecurity = { path = "../wsdl_rs/advancedsecurity" , optional = true}
analytics = { path = "../wsdl_rs/analytics" , optional = true}
authenticationbehavior = { path = "../wsdl_rs/authenticationbehavior" , optional = true}
b_2 = { path = "../wsdl_rs/b_2" }
bf_2 = { path = "../wsdl_rs/bf_2" , optional = true}
credential = { path = "../wsdl_rs/credential" , optional = true}
deviceio = { path = "../wsdl_rs/deviceio" , optional = true}
devicemgmt = { path = "../wsdl_rs/devicemgmt" , optional = true}
display = { path = "../wsdl_rs/display" , optional = true}
doorcontrol = { path = "../wsdl_rs/doorcontrol" , optional = true}
event = { path = "../wsdl_rs/event" , optional = true}
imaging = { path = "../wsdl_rs/imaging" , optional = true}
media = { path = "../wsdl_rs/media" , optional = true}
media2 = { path = "../wsdl_rs/media2" , optional = true}
provisioning = { path = "../wsdl_rs/provisioning" , optional = true}
ptz = { path = "../wsdl_rs/ptz" , optional = true}
receiver = { path = "../wsdl_rs/receiver" , optional = true}
recording = { path = "../wsdl_rs/recording" , optional = true}
replay = { path = "../wsdl_rs/replay" , optional = true}
schedule = { path = "../wsdl_rs/schedule" , optional = true}
search = { path = "../wsdl_rs/search" , optional = true}
t_1 = { path = "../wsdl_rs/t_1" }
thermal = { path = "../wsdl_rs/thermal" , optional = true}
uplink = { path = "../wsdl_rs/uplink" , optional = true}
ws_addr = { path = "../wsdl_rs/ws_addr" }
ws_discovery = { path = "../wsdl_rs/ws_discovery" }
xml_xsd = { path = "../wsdl_rs/xml_xsd" }

[dev-dependencies]
assert_approx_eq = "1.1.0"
async-trait = "0.1.42"
tokio = { version = "1.0.1", features = ["full"] }
yaserde = "0.7.1"
yaserde_derive = "0.7.1"
114 changes: 68 additions & 46 deletions schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,78 @@
// This issue is being tracked at <https://github.com/lumeohq/xsd-parser-rs/issues/123>.
#![allow(clippy::upper_case_acronyms)]

#[macro_use]
extern crate yaserde_derive;

pub mod transport;
pub mod validate;
pub use transport;

// xsd:
pub mod common;
#[allow(clippy::large_enum_variant)]
pub mod metadatastream;
pub mod onvif;
pub mod radiometry;
pub mod rules;
pub mod soap_envelope;
pub mod types;
pub mod xmlmime;
pub mod xop;
pub use common;
#[cfg(feature = "metadatastream")]
pub use metadatastream;
pub use onvif;
#[cfg(feature = "radiometry")]
pub use radiometry;
#[cfg(feature = "rules")]
pub use rules;
pub use soap_envelope;
pub use types;
pub use xmlmime;
pub use xop;

// wsdl:
pub mod accesscontrol;
pub mod accessrules;
pub mod actionengine;
pub mod advancedsecurity;
pub mod analytics;
pub mod authenticationbehavior;
pub mod b_2;
pub mod bf_2;
pub mod credential;
pub mod deviceio;
pub mod devicemgmt;
pub mod display;
pub mod doorcontrol;
pub mod event;
pub mod imaging;
pub mod media;
pub mod media2;
pub mod provisioning;
pub mod ptz;
pub mod receiver;
pub mod recording;
pub mod replay;
pub mod schedule;
pub mod search;
pub mod t_1;
pub mod thermal;
pub mod uplink;
pub mod ws_addr;
pub mod ws_discovery;
pub mod xml_xsd;
#[cfg(feature = "accesscontrol")]
pub use accesscontrol;
#[cfg(feature = "accessrules")]
pub use accessrules;
#[cfg(feature = "actionengine")]
pub use actionengine;
#[cfg(feature = "advancedsecurity")]
pub use advancedsecurity;
#[cfg(feature = "analytics")]
pub use analytics;
#[cfg(feature = "authenticationbehavior")]
pub use authenticationbehavior;
pub use b_2;
#[cfg(feature = "bf_2")]
pub use bf_2;
#[cfg(feature = "credential")]
pub use credential;
#[cfg(feature = "deviceio")]
pub use deviceio;
#[cfg(feature = "devicemgmt")]
pub use devicemgmt;
#[cfg(feature = "display")]
pub use display;
#[cfg(feature = "doorcontrol")]
pub use doorcontrol;
#[cfg(feature = "event")]
pub use event;
#[cfg(feature = "imaging")]
pub use imaging;
#[cfg(feature = "media")]
pub use media;
#[cfg(feature = "media2")]
pub use media2;
#[cfg(feature = "provisioning")]
pub use provisioning;
#[cfg(feature = "ptz")]
pub use ptz;
#[cfg(feature = "receiver")]
pub use receiver;
#[cfg(feature = "recording")]
pub use recording;
#[cfg(feature = "replay")]
pub use replay;
#[cfg(feature = "schedule")]
pub use schedule;
#[cfg(feature = "search")]
pub use search;
pub use t_1;
#[cfg(feature = "thermal")]
pub use thermal;
#[cfg(feature = "uplink")]
pub use uplink;
pub use ws_addr;
pub use ws_discovery;
pub use xml_xsd;

#[cfg(test)]
mod tests;
mod utils;
5 changes: 3 additions & 2 deletions schema/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use super::*;

use crate::transport;
use crate::utils::xml_eq::assert_xml_eq;
use assert_approx_eq::assert_approx_eq;
use async_trait::async_trait;
use onvif as tt;
use utils::assert_xml_eq;
use xsd_types::types as xs;

mod utils;

pub struct FakeTransport {
pub response: String,
}
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions schema/src/utils/mod.rs

This file was deleted.

9 changes: 9 additions & 0 deletions transport/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "transport"
version = "0.1.0"
edition = "2021"

[dependencies]
async-trait = "0.1.42"
thiserror = "1.0.23"
yaserde = "0.7.1"
File renamed without changes.
4 changes: 4 additions & 0 deletions validate/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[package]
name = "validate"
version = "0.1.0"
edition = "2021"
File renamed without changes.
14 changes: 14 additions & 0 deletions wsdl_rs/accesscontrol/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "accesscontrol"
version = "0.1.0"
edition = "2021"

[dependencies]
transport = { path = "../../transport" }
types = { path = "../../xsd_rs/types" }
validate = { path = "../../validate" }
xml-rs = "0.8.3"
xsd-macro-utils = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
xsd-types = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
yaserde = "0.7.1"
yaserde_derive = "0.7.1"
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::transport;
use crate::types as pt;
use crate::validate::Validate;
use types as pt;
use validate::Validate;
use yaserde_derive::{YaDeserialize, YaSerialize};

// The service capabilities reflect optional functionality of a service.
// The information is static and does not change during device operation.
Expand Down
14 changes: 14 additions & 0 deletions wsdl_rs/accessrules/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "accessrules"
version = "0.1.0"
edition = "2021"

[dependencies]
transport = { path = "../../transport" }
types = { path = "../../xsd_rs/types" }
validate = { path = "../../validate" }
xml-rs = "0.8.3"
xsd-macro-utils = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
xsd-types = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
yaserde = "0.7.1"
yaserde_derive = "0.7.1"
6 changes: 3 additions & 3 deletions schema/src/accessrules.rs → wsdl_rs/accessrules/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::transport;
use crate::types as pt;
use crate::validate::Validate;
use types as pt;
use validate::Validate;
use yaserde_derive::{YaDeserialize, YaSerialize};

// The service capabilities reflect optional functionality of a service. The
// information is static
Expand Down
16 changes: 16 additions & 0 deletions wsdl_rs/actionengine/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "actionengine"
version = "0.1.0"
edition = "2021"

[dependencies]
b_2 = { path = "../../wsdl_rs/b_2" }
common = { path = "../../xsd_rs/common" }
onvif = { package = "onvif-xsd", path = "../../xsd_rs/onvif_xsd" }
transport = { path = "../../transport" }
validate = { path = "../../validate" }
xml-rs = "0.8.3"
xsd-macro-utils = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
xsd-types = { git = "https://github.com/lumeohq/xsd-parser-rs", rev = "7f3d433" }
yaserde = "0.7.1"
yaserde_derive = "0.7.1"
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::transport;
use crate::validate::Validate;
use crate::{b_2 as wsnt, onvif as tt};
use b_2 as wsnt;
use onvif as tt;
use validate::Validate;
use xsd_types::types as xs;
use yaserde_derive::{YaDeserialize, YaSerialize};

#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
#[yaserde(
Expand Down
Loading

0 comments on commit 3b26bc8

Please sign in to comment.