Crates.io | exonum-build |
lib.rs | exonum-build |
version | 1.0.1 |
source | src |
created_at | 2018-12-14 10:07:39.663156 |
updated_at | 2020-04-14 09:57:13.700732 |
description | Helper functions for writing build.rs for exonum services. |
homepage | https://exonum.com/ |
repository | https://github.com/exonum/exonum |
max_upload_size | |
id | 101870 |
size | 30,220 |
This crate simplifies writing build scripts for Exonum and Exonum services.
Since Protobuf is the Exonum default serialization format, build scripts are mostly used to compile Protobuf files and generate corresponding code. Generated code is used later by the Exonum core and services.
There are several predefined sets of protobuf sources available for use. Currently presented sets:
Hash
, PublicKey
and Signature
.Consult the crate docs for more details.
Sample build.rs
using exonum-build
:
use exonum_build::ProtobufGenerator;
fn main() {
ProtobufGenerator::with_mod_name("protobuf_mod.rs")
.with_input_dir("src/proto")
.with_crypto()
.generate();
}
Include exonum-build
as a dependency in your Cargo.toml
:
[build-dependencies]
exonum-build = "1.0.0"
The code generator used by the crate does not
support hierarchies, instead using a flat structure for the generated Rust modules.
This means that compile errors can occur
if the generator input (accounting for includes!) contains several Protobuf files
with the same base name (e.g., foo/bar.proto
and other/bar.proto
).
exonum-build
is licensed under the Apache License (Version 2.0).
See LICENSE for details.