Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

protobuf fetch script #402

Merged
merged 4 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions codegen/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,22 @@ repository = "https://github.com/fussybeaver/bollard"
edition = "2021"

[features]
default = ["fetch"]
build = ["tonic-build"]
fetch = ["ureq"]

[[bin]]
name = "gen"
required-features = ["build"]

[[bin]]
name = "fetch"
required-features = ["fetch"]

[dependencies]
tonic = { version = "0.11" }
prost = { version = "0.12" }
prost-types = "0.12"
tonic-build = { version = "0.11", optional = true }
ureq = { version = "2.9.6", optional = true}

15 changes: 14 additions & 1 deletion codegen/proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,22 @@ The generated files are part of the project to maintain consistency across
generated assets in the Bollard project, and to avoid a build dependency on the
external `protoc` binary.

## Fetch

To fetch the protobuf files needed in the Bollard project, this step will fetch
remote files and replace import statements with local equivalents, so that they
can be parsed by prost.

```
cargo run --bin fetch --features fetch
```

## Generate

To generate the output use the following:
You will need a protoc compiler for this step. On unix there is usually a
package `protobuf-compiler` or equivalent.

To generate the rust output from the protobuf files use the following:

```
cargo run --bin gen --features build
Expand Down
2 changes: 1 addition & 1 deletion codegen/proto/resources/fsutil/types/stat.proto
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ message Stat {
int64 devmajor = 8;
int64 devminor = 9;
map<string, bytes> xattrs = 10;
}
}
Loading