Replace protobuf crate with prost! (#1390)

* Replace protobuf crate with prost!

* Add copyright headers to build.rs files.

* kad: Fix error when mapping connection types.

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more mapping mistakes.

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Toralf Wittner
2020-01-15 12:02:02 +01:00
committed by Pierre Krieger
parent 9d2df148cd
commit 680c467f7e
52 changed files with 600 additions and 5836 deletions

View File

@@ -1,5 +0,0 @@
FROM rust:1.38
RUN apt-get update && apt-get install -y protobuf-compiler
RUN cargo install --version 2.8.1 protobuf-codegen

View File

@@ -1,35 +0,0 @@
#!/usr/bin/env bash
# exit immediately when a command fails
set -e
# only exit with zero if all commands of the pipeline exit successfully
set -o pipefail
# error on unset variables
set -u
# print each command before executing it
set -x
# The source .proto file.
SOURCE_PROTO_FILE=$1
DEST_FOLDER=$(dirname "$SOURCE_PROTO_FILE")
# The .rs file generated via protoc.
TMP_GEN_RUST_FILE=${SOURCE_PROTO_FILE/proto/rs}
# The above with `_proto` injected.
FINAL_GEN_RUST_FILE=${TMP_GEN_RUST_FILE/.rs/_proto.rs}
sudo docker build -t rust-libp2p-protobuf-builder $(dirname "$0")
sudo docker run --rm \
-v `pwd`:/usr/code:z \
-u="$(id -u):$(id -g)" \
-w /usr/code \
rust-libp2p-protobuf-builder \
/bin/bash -c " \
protoc --rust_out $DEST_FOLDER $SOURCE_PROTO_FILE"
mv $TMP_GEN_RUST_FILE $FINAL_GEN_RUST_FILE