Skip to content

Commit

Permalink
Remove direct protox_parse dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Nov 10, 2023
1 parent 97d57d2 commit 72a3a10
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
1 change: 0 additions & 1 deletion node/Cargo.lock

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

1 change: 0 additions & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ prost = "0.12.0"
prost-build = "0.12.0"
prost-reflect = { version = "0.12.0", features = ["serde"] }
protox = "0.5.0"
protox-parse = "0.5.0"
prettyplease = "0.2.6"
pretty_assertions = "1.4.0"
quick-protobuf = "0.8.1"
Expand Down
1 change: 0 additions & 1 deletion node/libs/protobuf_build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ prettyplease.workspace = true
proc-macro2.workspace = true
prost-build.workspace = true
protox.workspace = true
protox-parse.workspace = true
quote.workspace = true
syn.workspace = true
18 changes: 10 additions & 8 deletions node/libs/protobuf_build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
#![allow(clippy::print_stdout)]
pub use self::syntax::*;
use anyhow::Context as _;
use protox::prost_reflect::{self, prost::Message as _, prost_types};
use protox::{
file::File,
prost_reflect::{self, prost::Message as _, prost_types},
};
use std::{
collections::{HashMap, HashSet},
env, fs,
Expand Down Expand Up @@ -245,15 +248,14 @@ impl Config {
return Ok(());
};

let file_raw = fs::read_to_string(path).context("fs::read()")?;
let source = fs::read_to_string(path).context("fs::read()")?;
let path = ProtoPath::from_input_path(path, &self.input_root, &self.proto_root)
.context("ProtoPath::from_input_path()")?;
pool_raw
.file
.push(protox_parse::parse(&path.to_string(), &file_raw).map_err(
// rewrapping the error, so that source location is included in the error message.
|err| anyhow::anyhow!("{err:?}"),
)?);
let compiled = File::from_source(&path.to_string(), &source).map_err(
// rewrapping the error, so that source location is included in the error message.
|err| anyhow::anyhow!("{err:?}"),
)?;
pool_raw.file.push(compiled.into());
proto_paths.push(path);
Ok(())
})?;
Expand Down

0 comments on commit 72a3a10

Please sign in to comment.