Skip to content

Commit

Permalink
feat: migrate to quick-protobuf
Browse files Browse the repository at this point in the history
Instead of relying on `protoc` and buildscripts, we generate the bindings using `pb-rs` and version them within our codebase. This makes for a better IDE integration, a faster build and an easier use of `rust-libp2p` because we don't force the `protoc` dependency onto them.

Resolves #3024.

Pull-Request: #3312.
  • Loading branch information
kckeiks authored Mar 2, 2023
1 parent 4910160 commit db82e02
Show file tree
Hide file tree
Showing 141 changed files with 3,652 additions and 1,266 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,30 @@ jobs:
echo "PR title is too long (greater than 72 characters)"
exit 1
fi
check-proto-files:

This comment has been minimized.

Copy link
@hanabi1224

hanabi1224 Mar 3, 2023

Contributor

Should protobuf-compilers installation steps be removed as well?

This comment has been minimized.

Copy link
@thomaseizinger

thomaseizinger Mar 3, 2023

Contributor

Eventually yes. We need to do a release first that does not depend on protoc being installed because our semver-lint tool cargo semver-checks needs to build a latest release as well to diff the rustdoc and that still requires protoc.

This comment has been minimized.

Copy link
@thomaseizinger

thomaseizinger Mar 3, 2023

Contributor

I opened an issue: #3539

name: Check for changes in proto files
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0

- run: cargo install --version 0.10.0 pb-rs --locked

- name: Glob match
uses: tj-actions/glob@v16
id: glob
with:
files: |
**/generated/*.proto
- name: Generate proto files
run: pb-rs --dont_use_cow ${{ steps.glob.outputs.paths }}

- name: Ensure generated files are unmodified # https://stackoverflow.com/a/5737794
run: |
git_status=$(git status --porcelain)
echo $git_status
test -z "$git_status"
159 changes: 29 additions & 130 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
Expand Up @@ -146,7 +146,7 @@ members = [
"misc/multistream-select",
"misc/rw-stream-sink",
"misc/keygen",
"misc/prost-codec",
"misc/quick-protobuf-codec",
"misc/quickcheck-ext",
"muxers/mplex",
"muxers/yamux",
Expand Down
2 changes: 2 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

- Move `ConnectionId` to `libp2p-swarm`. See [PR 3221].
- Move `PendingPoint` to `libp2p-swarm` and make it crate-private. See [PR 3221].
- Migrate from `prost` to `quick-protobuf`. This removes `protoc` dependency. See [PR 3312].

[PR 3312]: https://github.com/libp2p/rust-libp2p/pull/3312
[PR 3221]: https://github.com/libp2p/rust-libp2p/pull/3221

# 0.38.0
Expand Down
5 changes: 1 addition & 4 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ multistream-select = { version = "0.12.1", path = "../misc/multistream-select" }
p256 = { version = "0.12.0", default-features = false, features = ["ecdsa", "std"], optional = true }
parking_lot = "0.12.0"
pin-project = "1.0.0"
prost = "0.11"
quick-protobuf = "0.8"
once_cell = "1.17.1"
rand = "0.8"
rw-stream-sink = { version = "0.3.0", path = "../misc/rw-stream-sink" }
Expand All @@ -54,9 +54,6 @@ quickcheck = { package = "quickcheck-ext", path = "../misc/quickcheck-ext" }
rmp-serde = "1.0"
serde_json = "1.0"

[build-dependencies]
prost-build = "0.11"

[features]
secp256k1 = [ "libsecp256k1" ]
ecdsa = [ "p256" ]
Expand Down
Loading

0 comments on commit db82e02

Please sign in to comment.