Skip to content

Commit

Permalink
Merge branch 'master' into taplo_linting
Browse files Browse the repository at this point in the history
  • Loading branch information
caspermeijn authored Apr 26, 2024
2 parents 2bdb26d + 1fc736e commit 329ee7a
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 120 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,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 @@ -103,7 +103,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 @@ -140,7 +140,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.
3 changes: 1 addition & 2 deletions 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 All @@ -26,7 +26,6 @@ libz-sys = { version = "1.1, < 1.1.7", optional = true }

[dev-dependencies]
criterion = { version = "0.4", default-features = false }
cfg-if = "1"

[lib]
# https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
Expand Down
24 changes: 2 additions & 22 deletions protobuf/benches/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,10 @@ use std::fs::File;
use std::io::Read;
use std::path::Path;

use cfg_if::cfg_if;
use criterion::{criterion_group, criterion_main, Criterion};
use prost::Message;

use protobuf::benchmarks::{
dataset, google_message3::GoogleMessage3, google_message4::GoogleMessage4, proto2, proto3,
BenchmarkDataset,
};
use protobuf::benchmarks::{dataset, proto2, proto3, BenchmarkDataset};

fn load_dataset(dataset: &Path) -> Result<BenchmarkDataset, Box<dyn Error>> {
let mut f = File::open(dataset)?;
Expand Down Expand Up @@ -83,9 +79,6 @@ macro_rules! dataset {
dataset!(google_message1_proto2, proto2::GoogleMessage1);
dataset!(google_message1_proto3, proto3::GoogleMessage1);
dataset!(google_message2, proto2::GoogleMessage2);
dataset!(google_message3_1, GoogleMessage3);
dataset!(google_message3_5, GoogleMessage3);
dataset!(google_message4, GoogleMessage4);

criterion_group!(
dataset,
Expand All @@ -94,17 +87,4 @@ criterion_group!(
google_message2,
);

criterion_group! {
name = slow;
config = Criterion::default().sample_size(10);
targets = google_message3_1, google_message3_5, google_message4
}

cfg_if! {
if #[cfg(debug_assertions)] {
// Disable 'slow' benchmarks for unoptimized test builds.
criterion_main!(dataset);
} else {
criterion_main!(dataset, slow);
}
}
criterion_main!(dataset);
13 changes: 0 additions & 13 deletions protobuf/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@ static DATASET_PROTOS: &[&str] = &[
"google_message1/proto2/benchmark_message1_proto2.proto",
"google_message1/proto3/benchmark_message1_proto3.proto",
"google_message2/benchmark_message2.proto",
"google_message3/benchmark_message3.proto",
"google_message3/benchmark_message3_1.proto",
"google_message3/benchmark_message3_2.proto",
"google_message3/benchmark_message3_3.proto",
"google_message3/benchmark_message3_4.proto",
"google_message3/benchmark_message3_5.proto",
"google_message3/benchmark_message3_6.proto",
"google_message3/benchmark_message3_7.proto",
"google_message3/benchmark_message3_8.proto",
"google_message4/benchmark_message4.proto",
"google_message4/benchmark_message4_1.proto",
"google_message4/benchmark_message4_2.proto",
"google_message4/benchmark_message4_3.proto",
];

fn main() -> Result<()> {
Expand Down
27 changes: 0 additions & 27 deletions protobuf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,8 @@ pub mod benchmarks {
"/share/dataset.google_message2.pb"
))
}

pub fn google_message3_1() -> &'static Path {
Path::new(concat!(
env!("PROTOBUF"),
"/share/dataset.google_message3_1.pb"
))
}

pub fn google_message3_5() -> &'static Path {
Path::new(concat!(
env!("PROTOBUF"),
"/share/dataset.google_message3_5.pb"
))
}

pub fn google_message4() -> &'static Path {
Path::new(concat!(
env!("PROTOBUF"),
"/share/dataset.google_message4.pb"
))
}
}

pub mod google_message3 {
include!(concat!(env!("OUT_DIR"), "/benchmarks.google_message3.rs"));
}
pub mod google_message4 {
include!(concat!(env!("OUT_DIR"), "/benchmarks.google_message4.rs"));
}
pub mod proto2 {
include!(concat!(env!("OUT_DIR"), "/benchmarks.proto2.rs"));
}
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 329ee7a

Please sign in to comment.