-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'github/feature/improve_proto_build'
- Loading branch information
Showing
14 changed files
with
351 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "gen-protos" | ||
description = "Generate Protocol Buffers definitions for nekoton-proto crate" | ||
version = "0.13.0" | ||
authors = [ | ||
"Alexey Pashinov <pashinov93@gmail.com>", | ||
"Vladimir Petrzhikovskiy <v.petrzhikovskiy@dexpa.io>", | ||
"Ivan Kalinin <i.kalinin@dexpa.io>" | ||
] | ||
rust-version = "1.62.0" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
prost-build = "0.11" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use std::io::Result; | ||
use std::path::Path; | ||
|
||
fn main() -> Result<()> { | ||
let input = ["rpc.proto"]; | ||
|
||
let root = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap(); | ||
let protos_dir = root.join("nekoton-proto").join("src").join("protos"); | ||
|
||
prost_build::Config::new() | ||
.out_dir(&protos_dir) | ||
.include_file("mod.rs") | ||
// For old protoc versions. 3.12.4 needs this, but 3.21.12 doesn't. | ||
.protoc_arg("--experimental_allow_proto3_optional") | ||
// Replace Vec<u8> to Bytes | ||
.bytes(["."]) | ||
// Add EQ macro | ||
.type_attribute("rpc.Response.GetTimings", "#[derive(Eq)]") | ||
.compile_protos( | ||
&input | ||
.into_iter() | ||
.map(|x| protos_dir.join(x)) | ||
.collect::<Vec<_>>(), | ||
&[protos_dir], | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
pub mod rpc { | ||
include!(concat!(env!("OUT_DIR"), "/rpc.rs")); | ||
} | ||
|
||
pub mod models; | ||
pub mod protos; | ||
pub mod utils; | ||
|
||
pub use prost; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
pub mod rpc { | ||
include!("rpc.rs"); | ||
} |
File renamed without changes.
Oops, something went wrong.