Skip to content

Commit

Permalink
Syncnew (#2)
Browse files Browse the repository at this point in the history
* Allow file descriptor be generated without --include_source_info (tokio-rs#786)

* Allow file descriptor be generated without --include_source_info

The file descriptor sets generated by rules_proto in bazel don't have
this by default, so this allows some flexibility for users to reuse
results that are already available to them.  It's fairly trivial
adjustment so it seemed reasonable to me to allow the flexibility.

* revert breaking changes and add default

* release 0.11.5 (tokio-rs#788)

* Add message and enum attributes to prost-build (tokio-rs#784)

closes tokio-rs#783

* chore: Prepare 0.11.6 release (tokio-rs#794)

* chore: Added Kani to CI. (#1) (tokio-rs#798)

* Added Kani documentation. (tokio-rs#799)

* Fix issue with negative nanos in Duration::try_from(), and add tests (tokio-rs#803)

* Fix issue with negative nanos in Duration::try_from(), and add a unit test

* add proptest for negative nanos

* PR comment: remove spurious dbg

* Prevent spurious overflow in check_duration_roundtrip test (tokio-rs#804)

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>

* Clarify `default_package_filename` documentation. (tokio-rs#809)

* Bump msrv to 1.60 (tokio-rs#814)

* chore(types): Remove including generated code (tokio-rs#801)

* chore: Update github action (tokio-rs#815)

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>

* chore: Add cargo-machete to detect unused dependencies (tokio-rs#817)

* chore: Update msrv to 1.60 (tokio-rs#818)

* feat: Added try_normalize to Timestamp (tokio-rs#796)

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>

* Update PropProof docs to note the need to submodule init (tokio-rs#805)

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>

* feat(build): Add direct fds compile support (tokio-rs#819)

This commit adds two new compile functions that allow passing a
`FileDescriptorSet` and it will generate the Rust code. This allows
users to use libraries like `protox` directly and in an ergonomic way.

* release 0.11.7 (tokio-rs#821)

* fix: correct change in visibility of compiler module (tokio-rs#824)

Introduced in tokio-rs#801
Closes tokio-rs#823

* release 0.11.8 (tokio-rs#825)

* Add existing roundtrip test to Kani CI and avoid recursive submoduling (tokio-rs#828)

* Add existing roundtrip test to Kani CI

* Bump up Kani version

* Remove `v` from GA version

* Update to `syn@2` & `prettyplease@0.2` (tokio-rs#833)

* Fix corrupted tests and missing CI testing (tokio-rs#832)

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>

* chore: Update to criterion 0.4 (tokio-rs#835)

* Fix build in directory not named `prost` (tokio-rs#839)

This library will fail to build with the following error when checked
out into a directory not named exactly `prost`:

  error: failed to load manifest for workspace member `/home/alex/src/prost-rs/tests/single-include`

  Caused by:
    failed to load manifest for dependency `prost`

  Caused by:
    failed to read `/home/alex/src/prost/Cargo.toml`

  Caused by:
    No such file or directory (os error 2)

This is because the `single-include` test depends on `prost` with the
path `../../../prost`. This patch fixes the issue by correcting the path
to `../..`.

* prost-build: support boxing fields (tokio-rs#802)

This allows the user to request boxing of specific fields. This is useful for
enum types that might have variants of very different size.

* chore: Update to baptiste0928/cargo-install@v2 (tokio-rs#840)

Co-authored-by: Lucio Franco <luciofranco14@gmail.com>

* Fix typo in bail message (tokio-rs#848)

---------

Co-authored-by: David Freese <freese@google.com>
Co-authored-by: Lucio Franco <luciofranco14@gmail.com>
Co-authored-by: damel_lp <dlambertpowell@gmail.com>
Co-authored-by: Yoshiki Takashima <ytakashi@andrew.cmu.edu>
Co-authored-by: Daniel Schwartz-Narbonne <danielsn@users.noreply.github.com>
Co-authored-by: Gilad Naaman <gilad@naaman.io>
Co-authored-by: tottoto <tottotodev@gmail.com>
Co-authored-by: Oliver Browne <109075559+oliverbrowneprima@users.noreply.github.com>
Co-authored-by: Marcus Griep <marcus@griep.us>
Co-authored-by: Adrian Palacios <73246657+adpaco-aws@users.noreply.github.com>
Co-authored-by: Donough Liu <liudingming@bytedance.com>
Co-authored-by: Alex O'Brien <3541@3541.website>
Co-authored-by: Thomas Orozco <thomas@orozco.fr>
Co-authored-by: Brendon Daugherty <brendon1097@gmail.com>
  • Loading branch information
15 people committed Jun 8, 2023
1 parent 47bf91e commit b41ff14
Show file tree
Hide file tree
Showing 23 changed files with 800 additions and 171 deletions.
92 changes: 72 additions & 20 deletions .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,8 @@ jobs:
with:
submodules: recursive
- name: install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
default: true
profile: minimal
components: rustfmt
- name: Install Protoc
uses: arduino/setup-protoc@v1
Expand All @@ -25,10 +22,7 @@ jobs:
- name: build b_tests
run: cargo build --package b_tests
- name: rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
run: cargo fmt --all --check
# Disabled because downstream crates don't check this as well
# minversions:
# runs-on: ubuntu-latest
Expand Down Expand Up @@ -63,13 +57,29 @@ jobs:
# args: --workspace --all-targets
# toolchain: stable

machete:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: install toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-machete
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-machete
- name: Check unused dependencies
run: cargo machete

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
toolchain:
- stable
- 1.56.1
- "1.60"
os:
- ubuntu-latest
- macos-latest
Expand All @@ -80,29 +90,55 @@ jobs:
with:
submodules: recursive
- name: install toolchain
uses: actions-rs/toolchain@v1
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
default: true
profile: minimal
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: install ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- uses: Swatinem/rust-cache@v1
- uses: Swatinem/rust-cache@v2
- name: test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets
run: cargo test --workspace --all-targets
- name: test no-default-features
uses: actions-rs/cargo@v1
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
- name: test doc
run: cargo test -p prost-build -p prost-derive -p prost-types --doc --no-default-features

kani:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: Verify with Kani
uses: model-checking/kani-github-action@0.23
with:
command: test
args: --no-default-features
enable-propproof: true
args: |
--tests -p prost-types --default-unwind 3 \
--harness "tests::check_timestamp_roundtrip_via_system_time" \
--harness "tests::check_duration_roundtrip_nanos"
# --default-unwind N roughly corresponds to how much effort
# Kani will spend trying to prove correctness of the
# program. Higher the number, more programs can be proven
# correct. However, Kani will require more time and memory. If
# Kani fails with "Failed Checks: unwinding assertion," this
# number may need to be raised for Kani to succeed.

no-std:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: install toolchain
uses: dtolnay/rust-toolchain@nightly
# no-std:
# runs-on: ubuntu-latest
# steps:
Expand All @@ -120,6 +156,22 @@ jobs:
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v2
- name: install cargo-no-std-check
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-no-std-check
- name: prost cargo-no-std-check
run: cargo no-std-check --manifest-path 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
# prost-build is built through the workspace, prost typically has default
# features enabled due to vagaries in Cargo workspace feature resolution.
# This additional check ensures that prost-build does not rely on any of
# prost's default features to compile.
- name: prost-build check
run: cargo check --manifest-path prost-build/Cargo.toml
# - uses: Swatinem/rust-cache@v1
# - name: install cargo-no-std-check
# uses: actions-rs/cargo@v1
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prost"
version = "0.11.3"
version = "0.11.8"
authors = [
"Dan Burkert <dan@danburkert.com>",
"Lucio Franco <luciofranco14@gmail.com",
Expand All @@ -14,7 +14,7 @@ description = "A Protocol Buffers implementation for the Rust Language."
keywords = ["protobuf", "serialization"]
categories = ["encoding"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.60"

[workspace]
members = [
Expand Down Expand Up @@ -49,11 +49,11 @@ std = []

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

[dev-dependencies]
criterion = "0.3"
criterion = { version = "0.4", default-features = false }
env_logger = { version = "0.8", default-features = false }
log = "0.4"
proptest = "1"
Expand Down
69 changes: 69 additions & 0 deletions KANI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Kani
This document describes how to **locally** install and use Kani, along
with its experimental PropProof feature. Because of instability in
Kani internals, the GitHub action is the recommended option if you are
running in CI.

Kani is a software verification tool that complements testing by
proving the absence of certain classes of bugs like unwrap exceptions,
overflows, and assertion failures. See the [Kani
book](https://model-checking.github.io/kani/) for a full list of
capabilities and limitations.

## Installing Kani and PropProof
- The install instructions for Kani can be [found
here](https://model-checking.github.io/kani/install-guide.html). Once
Kani is installed, you can run with `cargo kani` for projects or
`kani` for individual Rust files.
- **[UNSTABLE]** To use PropProof, first download the source code
from the Kani repository.
```bash
git clone https://github.com/model-checking/kani.git --branch features/proptest propproof
cd propproof; git submodule update --init
```

Then, use `.cargo/config.toml` enable it in the local directory you
want to run Kani in. This will override the `proptest` import in
your repo.

```bash
cd $YOUR_REPO_LOCAL_PATH
mkdir '.cargo'
echo "paths =[\"$PATH_TO_PROPPROOF\"]" > .cargo/config.toml
```

**Please Note**:
- `features/proptest` branch under Kani is likely not the final
location for this code. If these instructions stop working, please
consult the Kani documentation and file an issue on [the Kani
repo](https://github.com/model-checking/kani.git).
- The cargo config file will force cargo to always use PropProof. To
use `proptest`, delete the file.

## Running Kani
After installing Kani and PropProof, `cargo kani --tests` should
automatically run `proptest!` harnesses inside your crate. Use
`--harness` to run a specific harness, and `-p` for a specific
sub-crate.

If Kani returns with an error, you can use the concrete playback
feature using `--enable-unstable --concrete-playback print` and paste
in the code to your repository. Running this harness with `cargo test`
will replay the input found by Kani that produced this crash. Please
note that this feature is unstable and using `--concrete-playback
inplace` to automatically inject a replay harness is not supported
when using PropProof.

## Debugging CI Failure
```yaml
- name: Verify with Kani
uses: model-checking/kani-github-action@v0.xx
with:
enable-propproof: true
args: |
$KANI_ARGUMENTS
```

The above GitHub CI workflow is equivalent to `cargo kani
$KANI_ARGUMENTS` with PropProof installed. To replicate issues
locally, run `cargo kani` with the same arguments.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ First, add `prost` and its public dependencies to your `Cargo.toml`:

```ignore
[dependencies]
prost = "0.10"
prost = "0.11"
# Only necessary if using Protobuf well-known types:
prost-types = "0.10"
prost-types = "0.11"
```

The recommended way to add `.proto` compilation to a Cargo project is to use the
Expand All @@ -44,7 +44,7 @@ start-to-finish example.

### MSRV

`prost` follows the `tokio-rs` projects MSRV model and supports 1.56+. For more
`prost` follows the `tokio-rs` projects MSRV model and supports 1.60. For more
information on the tokio msrv policy you can check it out [here][tokio msrv]

[tokio msrv]: https://github.com/tokio-rs/tokio/#supported-rust-versions
Expand Down
1 change: 0 additions & 1 deletion conformance/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ edition = "2018"
[dependencies]
bytes = "1"
env_logger = { version = "0.8", default-features = false }
log = "0.4"
prost = { path = ".." }
protobuf = { path = "../protobuf" }
tests = { path = "../tests" }
13 changes: 6 additions & 7 deletions prost-build/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "prost-build"
version = "0.11.4"
version = "0.11.8"
authors = [
"Dan Burkert <dan@danburkert.com>",
"Lucio Franco <luciofranco14@gmail.com>",
Expand All @@ -12,7 +12,7 @@ documentation = "https://docs.rs/prost-build"
readme = "README.md"
description = "A Protocol Buffers implementation for the Rust Language."
edition = "2021"
rust-version = "1.56"
rust-version = "1.60"

[features]
default = ["format"]
Expand All @@ -27,20 +27,19 @@ itertools = { version = "0.10", default-features = false, features = ["use_alloc
log = "0.4"
multimap = { version = "0.8", default-features = false }
petgraph = { version = "0.6", default-features = false }
prost = { version = "0.11.0", path = "..", default-features = false }
prost-types = { version = "0.11.0", path = "../prost-types", default-features = false }
prost = { version = "0.11.8", path = "..", default-features = false }
prost-types = { version = "0.11.8", path = "../prost-types", default-features = false }
tempfile = "3"
lazy_static = "1.4.0"
regex = { version = "1.5.5", default-features = false, features = ["std", "unicode-bool"] }
which = "4"

prettyplease = { version = "0.1", optional = true }
syn = { version = "1", features = ["full"], optional = true }
prettyplease = { version = "0.2", optional = true }
syn = { version = "2", features = ["full"], optional = true }

# These two must be kept in sync, used for `cleanup-markdown` feature.
pulldown-cmark = { version = "0.9.1", optional = true, default-features = false }
pulldown-cmark-to-cmark = { version = "10.0.1", optional = true }

[dev-dependencies]
env_logger = { version = "0.8", default-features = false }

2 changes: 1 addition & 1 deletion prost-build/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use pulldown_cmark::{CodeBlockKind, Event, Options, Parser, Tag};
use regex::Regex;

/// Comments on a Protobuf item.
#[derive(Debug, Clone)]
#[derive(Debug, Default, Clone)]
pub struct Comments {
/// Leading detached blocks of comments.
pub leading_detached: Vec<Vec<String>>,
Expand Down

0 comments on commit b41ff14

Please sign in to comment.