Skip to content

Commit

Permalink
chore: separate prost Cargo.toml workspace and crate declaration
Browse files Browse the repository at this point in the history
Removes the need to always specify append `--workspace` in the common
cargo commands.

`rust-analyser` seems to get confused and locks the workspace longer
than needed under the previous structure. (Lots of `Blocking waiting
for file lock on build directory` waiting.) Unable to find an issue
mentioning this.

Goals it to then make repo to more easily managed. Examples:

* Consolidate crate package metadata, dependency versions and clippy
lints in the workspace `Cargo.toml`

* Placing all crates in a `crates/` for automatic workspace member
inclucion.
  • Loading branch information
gibbz00 committed Apr 21, 2024
1 parent 0381b93 commit e20c115
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 57 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ jobs:
uses: ./.github/actions/setup-ninja
- uses: Swatinem/rust-cache@v2
- name: test
run: cargo test --workspace --all-targets
run: cargo test --all-targets
- name: test no-default-features
run: cargo test -p prost-build -p prost-derive -p prost-types --all-targets --no-default-features
# Run doc tests separately: https://github.com/rust-lang/cargo/issues/6669
- name: test doc
run: cargo test --workspace --doc
run: cargo test --doc
- name: test doc no-default-features
run: cargo test -p prost-build -p prost-derive -p prost-types --doc --no-default-features

Expand All @@ -91,7 +91,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-minimal-versions
- run: cargo minimal-versions --no-private check --workspace --all-features
- run: cargo minimal-versions --no-private check --all-features

kani:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -128,7 +128,7 @@ jobs:
with:
crate: cargo-no-std-check
- name: prost cargo-no-std-check
run: cargo no-std-check --manifest-path Cargo.toml --no-default-features
run: cargo no-std-check --manifest-path prost/Cargo.toml --no-default-features
- name: prost-types cargo-no-std-check
run: cargo no-std-check --manifest-path prost-types/Cargo.toml --no-default-features
# prost-build depends on prost with --no-default-features, but when
Expand Down
46 changes: 2 additions & 44 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
[package]
name = "prost"
version = "0.12.4"
authors = [
"Dan Burkert <[email protected]>",
"Lucio Franco <[email protected]>",
"Casper Meijn <[email protected]>",
"Tokio Contributors <[email protected]>",
]
license = "Apache-2.0"
repository = "https://github.com/tokio-rs/prost"
documentation = "https://docs.rs/prost"
readme = "README.md"
description = "A Protocol Buffers implementation for the Rust Language."
keywords = ["protobuf", "serialization"]
categories = ["encoding"]
edition = "2021"
rust-version = "1.70"

[workspace]
members = [
"conformance",
"prost",
"prost-build",
"prost-derive",
"prost-types",
Expand All @@ -38,31 +20,7 @@ exclude = [
"afl",
]

[lib]
# https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
bench = false

[features]
default = ["derive", "std"]
derive = ["dep:prost-derive"]
prost-derive = ["derive"] # deprecated, please use derive feature instead
no-recursion-limit = []
std = []

[dependencies]
bytes = { version = "1", default-features = false }
prost-derive = { version = "0.12.4", path = "prost-derive", optional = true }

[dev-dependencies]
criterion = { version = "0.4", default-features = false }
env_logger = { version = "0.10", default-features = false }
log = "0.4"
proptest = "1"
rand = "0.8"
resolver = "2"

[profile.bench]
debug = true

[[bench]]
name = "varint"
harness = false
2 changes: 1 addition & 1 deletion conformance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ edition = "2018"
[dependencies]
bytes = "1"
env_logger = { version = "0.10", default-features = false }
prost = { path = ".." }
prost = { path = "../prost" }
protobuf = { path = "../protobuf" }
tests = { path = "../tests" }
2 changes: 1 addition & 1 deletion prost-build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ itertools = { version = ">=0.10, <=0.12", default-features = false, features = [
log = "0.4.4"
multimap = { version = ">=0.8, <=0.10", default-features = false }
petgraph = { version = "0.6", default-features = false }
prost = { version = "0.12.4", path = "..", default-features = false }
prost = { version = "0.12.4", path = "../prost", default-features = false }
prost-types = { version = "0.12.4", path = "../prost-types", default-features = false }
tempfile = "3"
once_cell = "1.17.1"
Expand Down
2 changes: 1 addition & 1 deletion prost-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ default = ["std"]
std = ["prost/std"]

[dependencies]
prost = { version = "0.12.4", path = "..", default-features = false, features = ["prost-derive"] }
prost = { version = "0.12.4", path = "../prost", default-features = false, features = ["prost-derive"] }

[dev-dependencies]
proptest = "1"
44 changes: 44 additions & 0 deletions prost/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "prost"
version = "0.12.4"
authors = [
"Dan Burkert <[email protected]>",
"Lucio Franco <[email protected]>",
"Casper Meijn <[email protected]>",
"Tokio Contributors <[email protected]>",
]
license = "Apache-2.0"
repository = "https://github.com/tokio-rs/prost"
documentation = "https://docs.rs/prost"
readme = "../README.md"
description = "A Protocol Buffers implementation for the Rust Language."
keywords = ["protobuf", "serialization"]
categories = ["encoding"]
edition = "2021"
rust-version = "1.70"

[lib]
# https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
bench = false

[features]
default = ["derive", "std"]
derive = ["dep:prost-derive"]
prost-derive = ["derive"] # deprecated, please use derive feature instead
no-recursion-limit = []
std = []

[dependencies]
bytes = { version = "1", default-features = false }
prost-derive = { version = "0.12.4", path = "../prost-derive", optional = true }

[dev-dependencies]
criterion = { version = "0.4", default-features = false }
env_logger = { version = "0.10", default-features = false }
log = "0.4"
proptest = "1"
rand = "0.8"

[[bench]]
name = "varint"
harness = false
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/lib.rs → prost/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![doc(html_root_url = "https://docs.rs/prost/0.12.2")]
#![cfg_attr(not(feature = "std"), no_std)]
#![doc = include_str!("../README.md")]
#![doc = include_str!("../../README.md")]

// Re-export the alloc crate for use within derived code.
#[doc(hidden)]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion protobuf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publish = false
edition = "2018"

[dependencies]
prost = { path = ".." }
prost = { path = "../prost" }
prost-types = { path = "../prost-types" }

[build-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion tests-2015/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ std = []
anyhow = "1.0.1"
bytes = "1"
cfg-if = "1"
prost = { path = ".." }
prost = { path = "../prost" }
prost-types = { path = "../prost-types" }
protobuf = { path = "../protobuf" }

Expand Down
2 changes: 1 addition & 1 deletion tests-no-std/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ path = "../tests/src/lib.rs"
anyhow = { version = "1.0.45", default-features = false }
bytes = { version = "1", default-features = false }
cfg-if = "1"
prost = { path = "..", default-features = false, features = ["derive"] }
prost = { path = "../prost", default-features = false, features = ["derive"] }
prost-types = { path = "../prost-types", default-features = false }
protobuf = { path = "../protobuf" }

Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ std = []
anyhow = "1.0.1"
# bytes = "1"
cfg-if = "1"
prost = { path = ".." }
prost = { path = "../prost" }
prost-types = { path = "../prost-types" }
protobuf = { path = "../protobuf" }

Expand Down
2 changes: 1 addition & 1 deletion tests/single-include/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish = false
license = "MIT"

[dependencies]
prost = { path = "../.." }
prost = { path = "../../prost" }

[build-dependencies]
prost-build = { path = "../../prost-build" }

0 comments on commit e20c115

Please sign in to comment.