Skip to content

Commit

Permalink
updated to new plugin API
Browse files Browse the repository at this point in the history
  • Loading branch information
milyin committed Jan 16, 2024
1 parent e787900 commit 4def844
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 77 deletions.
54 changes: 29 additions & 25 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,16 @@ regex = "1.7.1"
rustc_version = "0.4"
serde = "1.0.154"
serde_json = "1.0.94"
zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
zenoh = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "simplified_load_plugin", features = [
"unstable",
] }
zenoh-collections = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-core = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main" }
zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", features = [
zenoh-collections = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "simplified_load_plugin" }
zenoh-core = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "simplified_load_plugin" }
zenoh-ext = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "simplified_load_plugin", features = [
"unstable",
] }
zenoh-plugin-rest = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false }
zenoh-plugin-trait = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "main", default-features = false }
zenoh-plugin-rest = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "simplified_load_plugin", default-features = false }
zenoh-plugin-trait = { version = "0.11.0-dev", git = "https://github.com/eclipse-zenoh/zenoh.git", branch = "simplified_load_plugin", default-features = false }

[profile.release]
debug = false
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,6 @@ $ git clone https://github.com/eclipse-zenoh/zenoh-plugin-mqtt.git
$ cd zenoh-plugin-mqtt
```
> :warning: **WARNING** :warning: : On Windows and Linux, don't use `cargo build` command without specifying a package with `-p`. Building both `zenoh-plugin-mqtt` (plugin library) and `zenoh-bridge-mqtt` (standalone executable) together will lead to a `multiple definition of `load_plugin'` error at link time. See [#19](https://github.com/eclipse-zenoh/zenoh-plugin-mqtt/issues/19#issuecomment-1754742678) for explanations.
You can then choose between building the zenoh bridge for MQTT:
- as a plugin library that can be dynamically loaded by the zenoh router (`zenohd`):
```bash
Expand Down
7 changes: 4 additions & 3 deletions zenoh-bridge-mqtt/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// ZettaScale Zenoh Team, <[email protected]>
//
use clap::{App, Arg};
use zenoh_plugin_trait::Plugin;
use std::str::FromStr;
use zenoh::config::{Config, ModeDependentValue};
use zenoh::prelude::*;
Expand All @@ -36,8 +37,8 @@ macro_rules! insert_json5 {

fn parse_args() -> Config {
let app = App::new("zenoh bridge for MQTT")
.version(zenoh_plugin_mqtt::GIT_VERSION)
.long_version(zenoh_plugin_mqtt::LONG_VERSION.as_str())
.version(zenoh_plugin_mqtt::MqttPlugin::PLUGIN_VERSION)
.long_version(zenoh_plugin_mqtt::MqttPlugin::PLUGIN_LONG_VERSION)
//
// zenoh related arguments:
//
Expand Down Expand Up @@ -168,7 +169,7 @@ r#"-w, --generalise-pub=[String]... 'A list of key expression to use for gener
#[async_std::main]
async fn main() {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("z=info")).init();
log::info!("zenoh-bridge-mqtt {}", *zenoh_plugin_mqtt::LONG_VERSION);
log::info!("zenoh-bridge-mqtt {}", zenoh_plugin_mqtt::MqttPlugin::PLUGIN_LONG_VERSION);

let config = parse_args();
let rest_plugin = config.plugin("rest").is_some();
Expand Down
2 changes: 1 addition & 1 deletion zenoh-plugin-mqtt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ crate-type = ["cdylib", "rlib"]

[features]
default = ["no_mangle"]
no_mangle = ["zenoh-plugin-trait/no_mangle"]
no_mangle = []
stats = ["zenoh/stats"]

[dependencies]
Expand Down
Loading

0 comments on commit 4def844

Please sign in to comment.