Skip to content

Commit db82e02

Browse files
authored
feat: migrate to quick-protobuf
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.
1 parent 4910160 commit db82e02

File tree

141 files changed

+3652
-1266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

141 files changed

+3652
-1266
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,30 @@ jobs:
293293
echo "PR title is too long (greater than 72 characters)"
294294
exit 1
295295
fi
296+
297+
check-proto-files:
298+
name: Check for changes in proto files
299+
runs-on: ubuntu-latest
300+
steps:
301+
- uses: actions/checkout@v3
302+
303+
- uses: Swatinem/rust-cache@359a70e43a0bb8a13953b04a90f76428b4959bb6 # v2.2.0
304+
305+
- run: cargo install --version 0.10.0 pb-rs --locked
306+
307+
- name: Glob match
308+
uses: tj-actions/glob@v16
309+
id: glob
310+
with:
311+
files: |
312+
**/generated/*.proto
313+
314+
- name: Generate proto files
315+
run: pb-rs --dont_use_cow ${{ steps.glob.outputs.paths }}
316+
317+
- name: Ensure generated files are unmodified # https://stackoverflow.com/a/5737794
318+
run: |
319+
git_status=$(git status --porcelain)
320+
321+
echo $git_status
322+
test -z "$git_status"

Cargo.lock

Lines changed: 29 additions & 130 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ members = [
146146
"misc/multistream-select",
147147
"misc/rw-stream-sink",
148148
"misc/keygen",
149-
"misc/prost-codec",
149+
"misc/quick-protobuf-codec",
150150
"misc/quickcheck-ext",
151151
"muxers/mplex",
152152
"muxers/yamux",

core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

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

7+
[PR 3312]: https://github.com/libp2p/rust-libp2p/pull/3312
68
[PR 3221]: https://github.com/libp2p/rust-libp2p/pull/3221
79

810
# 0.38.0

core/Cargo.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ multistream-select = { version = "0.12.1", path = "../misc/multistream-select" }
2727
p256 = { version = "0.12.0", default-features = false, features = ["ecdsa", "std"], optional = true }
2828
parking_lot = "0.12.0"
2929
pin-project = "1.0.0"
30-
prost = "0.11"
30+
quick-protobuf = "0.8"
3131
once_cell = "1.17.1"
3232
rand = "0.8"
3333
rw-stream-sink = { version = "0.3.0", path = "../misc/rw-stream-sink" }
@@ -54,9 +54,6 @@ quickcheck = { package = "quickcheck-ext", path = "../misc/quickcheck-ext" }
5454
rmp-serde = "1.0"
5555
serde_json = "1.0"
5656

57-
[build-dependencies]
58-
prost-build = "0.11"
59-
6057
[features]
6158
secp256k1 = [ "libsecp256k1" ]
6259
ecdsa = [ "p256" ]

0 commit comments

Comments
 (0)