Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
feat(waku-relay): generate waku relay rpc types from waku-proto repo …
Browse files Browse the repository at this point in the history
…definitions (#70)
  • Loading branch information
LNSD authored May 18, 2023
1 parent 32a91ca commit f12392f
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
13 changes: 13 additions & 0 deletions waku-relay/buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: v1
plugins:
- remote: buf.build/prost/plugins/prost:v0.2.1-1
out: proto/
opt:
- bytes=.
- compile_well_known_types
- name: prost-crate
out: .
opt:
- include_file=proto/mod.rs
- no_features
strategy: all
24 changes: 24 additions & 0 deletions waku-relay/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
use std::env;
use std::error::Error;
use std::process::{exit, Command};

fn main() -> Result<(), Box<dyn Error>> {
let out_dir = env::var_os("OUT_DIR").unwrap();

let status = Command::new("buf")
.arg("generate")
.arg("https://github.com/LNSD/waku-proto.git#branch=rust-waku")
.arg("--path")
.arg("waku/relay")
.arg("--output")
.arg(out_dir)
.current_dir(env!("CARGO_MANIFEST_DIR"))
.status()
.unwrap();

if !status.success() {
exit(status.code().unwrap_or(-1))
}

Ok(())
}
1 change: 1 addition & 0 deletions waku-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ pub mod error;
mod event;
mod message_id;
pub mod proto;
pub mod rpc;
3 changes: 3 additions & 0 deletions waku-relay/src/rpc.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod proto;

pub use proto::*;
1 change: 1 addition & 0 deletions waku-relay/src/rpc/proto.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/proto/mod.rs"));

0 comments on commit f12392f

Please sign in to comment.