Skip to content

Add Initial Protobuf generation setup and initial protos for v1 api's. #2

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

Merged
merged 12 commits into from
Sep 9, 2024
9 changes: 9 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = [ "cli", "client", "server"]
members = [ "cli", "client", "protos", "server"]

[profile.release]
panic = "abort"
Expand Down
12 changes: 12 additions & 0 deletions protos/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "protos"
version = "0.1.0"
edition = "2021"

build = "build.rs"

[dependencies]
prost = { version = "0.11.6", default-features = false, features = ["std", "prost-derive"] }

[target.'cfg(genproto)'.build-dependencies]
prost-build = { version = "0.11.6" , default-features = false}
20 changes: 20 additions & 0 deletions protos/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#[cfg(genproto)]
extern crate prost_build;

#[cfg(genproto)]
use std::{env, fs, path::Path};

/// To generate updated proto objects, run `RUSTFLAGS="--cfg genproto" cargo build`
fn main() {
#[cfg(genproto)]
generate_protos();
}

#[cfg(genproto)]
fn generate_protos() {
prost_build::compile_protos(&["src/proto/ldk_node_server.proto"], &["src/"])
.expect("protobuf compilation failed");
println!("sss {}", &env::var("OUT_DIR").unwrap());
let from_path = Path::new(&env::var("OUT_DIR").unwrap()).join("ldk_node_server.rs");
fs::copy(from_path, "src/lib.rs").unwrap();
}
416 changes: 416 additions & 0 deletions protos/src/lib.rs

Large diffs are not rendered by default.

Loading