Skip to content

Commit 2c6d472

Browse files
committed
Regenerate documentation
1 parent 6cb92b2 commit 2c6d472

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

docs/crate_universe.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ bazel run //3rdparty:crates_vendor -- --repin
462462
```
463463

464464
Under the hood, `--repin` will trigger a [cargo update](https://doc.rust-lang.org/cargo/commands/cargo-update.html)
465-
call against the generated workspace. The following table describes how to controll particular values passed to the
465+
call against the generated workspace. The following table describes how to control particular values passed to the
466466
`cargo update` command.
467467

468468
| Value | Cargo command |

docs/symbols.bzl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ load(
2828
_crates_vendor = "crates_vendor",
2929
)
3030
load(
31-
"@rules_rust//proto:proto.bzl",
31+
"@rules_rust//proto:defs.bzl",
3232
_rust_grpc_library = "rust_grpc_library",
33+
_rust_prost_library = "rust_prost_library",
3334
_rust_proto_library = "rust_proto_library",
35+
_rust_tonic_library = "rust_tonic_library",
3436
)
3537
load(
3638
"@rules_rust//proto:repositories.bzl",
@@ -124,6 +126,8 @@ rust_doc_test = _rust_doc_test
124126

125127
rust_proto_library = _rust_proto_library
126128
rust_grpc_library = _rust_grpc_library
129+
rust_prost_library = _rust_prost_library
130+
rust_tonic_library = _rust_tonic_library
127131

128132
rust_bindgen = _rust_bindgen
129133
rust_bindgen_dependencies = _rust_bindgen_dependencies

proto/BUILD.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@ bzl_library(
4848
srcs = glob(["**/*.bzl"]),
4949
deps = [
5050
"//proto/3rdparty:bzl_lib",
51+
"//proto/prost:bzl_lib",
5152
],
5253
)

proto/prost/private/prost.bzl

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Rules for building protos in Rust with Prost and Tonic."""
22

3-
load("@rules_proto//proto:defs.bzl", "ProtoInfo")
3+
load("@rules_proto//proto:defs.bzl", "ProtoInfo", "proto_common")
44
load("//rust:defs.bzl", "rust_common")
55

66
# buildifier: disable=bzl-visibility
@@ -10,13 +10,6 @@ load("//rust/private:providers.bzl", "DepVariantInfo")
1010
load("//rust/private:rustc.bzl", "rustc_compile_action")
1111
load(":providers.bzl", "ProstProtoInfo", "TonicProtoInfo")
1212

13-
# This follows the exact same convention as the new upstream protobuf rules.
14-
# https://github.com/protocolbuffers/protobuf/blob/v23.3/rust/aspects.bzl#L15
15-
# The interface here hasn't changed in quite a while and since there's now
16-
# additional reliance on it there it seems unlikely that it will break and if
17-
# it does there should be a clear migration example for Starlark code there.
18-
proto_common = proto_common_do_not_use
19-
2013
PROST_EXTENSION = ".rs"
2114
TONIC_EXTENSION = ".tonic.rs"
2215

proto/prost/private/protoc_wrapper.rs

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,15 @@ fn find_generated_rust_files(out_dir: &Path) -> ProtocResult<BTreeSet<PathBuf>>
2525
for f in find_generated_rust_files(&path)? {
2626
all_rs_files.insert(f);
2727
}
28-
} else {
29-
if let Some(ext) = path.extension() {
30-
if ext == "rs" {
31-
all_rs_files.insert(path);
32-
}
33-
} else if let Some(name) = path.file_name() {
34-
if name == "_" {
35-
let rs_name = path.parent().expect("Failed to get parent").join("_.rs");
36-
fs::rename(&path, &rs_name).map_err(from_error)?;
37-
all_rs_files.insert(rs_name);
38-
}
28+
} else if let Some(ext) = path.extension() {
29+
if ext == "rs" {
30+
all_rs_files.insert(path);
31+
}
32+
} else if let Some(name) = path.file_name() {
33+
if name == "_" {
34+
let rs_name = path.parent().expect("Failed to get parent").join("_.rs");
35+
fs::rename(&path, &rs_name).map_err(from_error)?;
36+
all_rs_files.insert(rs_name);
3937
}
4038
}
4139
}
@@ -224,11 +222,11 @@ fn compute_proto_package_info(
224222
crate_name: &str,
225223
protoc: &Path,
226224
includes: &BTreeSet<String>,
227-
proto_paths: &Vec<String>,
225+
proto_paths: &[String],
228226
) -> ProtocResult<BTreeSet<String>> {
229227
let mut extern_paths = BTreeSet::new();
230228
for proto_file in proto_files.iter() {
231-
let output = process::Command::new(&protoc)
229+
let output = process::Command::new(protoc)
232230
.args(includes.iter().map(|include| format!("-I{}", include)))
233231
.arg("--print_free_field_numbers")
234232
.args(
@@ -259,16 +257,16 @@ fn compute_proto_package_info(
259257
}
260258

261259
let (absolute, _) = text
262-
.split_once(" ")
260+
.split_once(' ')
263261
.ok_or_else(|| format!("Failed to split line: {}", text))?;
264262

265263
let mut package = "";
266264
let mut symbol_name = absolute;
267-
if let Some((package_, symbol_name_)) = absolute.rsplit_once(".") {
265+
if let Some((package_, symbol_name_)) = absolute.rsplit_once('.') {
268266
package = package_;
269267
symbol_name = symbol_name_;
270268
}
271-
let symbol = format!("{}::{}", package.replace(".", "::"), symbol_name);
269+
let symbol = format!("{}::{}", package.replace('.', "::"), symbol_name);
272270
let extern_path = format!(".{}={}::{}", absolute, crate_name, symbol.trim_matches(':'));
273271
if !extern_paths.insert(extern_path.clone()) {
274272
panic!("Duplicate extern: {}", extern_path);
@@ -335,23 +333,27 @@ impl Args {
335333
// for the process runner and arguments for protoc and potentially spawn
336334
// additional arguments needed by prost.
337335
for arg in env::args().skip(1) {
338-
if !arg.starts_with("-") {
336+
if !arg.starts_with('-') {
339337
proto_files.insert(PathBuf::from(arg));
340338
continue;
341339
}
342340

343341
if arg.starts_with("-I") {
344-
includes.insert(arg[2..].to_string());
342+
includes.insert(
343+
arg.strip_prefix("-I")
344+
.expect("Failed to strip -I")
345+
.to_string(),
346+
);
345347
continue;
346348
}
347349

348-
if !arg.contains("=") {
350+
if !arg.contains('=') {
349351
extra_args.push(arg);
350352
continue;
351353
}
352354

353355
let part = arg
354-
.split_once("=")
356+
.split_once('=')
355357
.ok_or_else(|| format!("Failed to parse argument `{arg}`",))?;
356358
match part {
357359
("--protoc", value) => {
@@ -369,7 +371,7 @@ impl Args {
369371
}
370372
("--package_info_output", value) => {
371373
let (key, value) = value
372-
.split_once("=")
374+
.split_once('=')
373375
.map(|(a, b)| (a.to_string(), PathBuf::from(b)))
374376
.expect("Failed to parse package info output");
375377
crate_name = Some(key);
@@ -539,7 +541,7 @@ fn main() -> ProtocResult<()> {
539541
// Write outputs
540542
fs::write(&out_librs, generate_lib_rs(&rust_files, is_tonic)?).map_err(from_error)?;
541543
fs::write(
542-
&package_info_file,
544+
package_info_file,
543545
package_info.into_iter().collect::<Vec<_>>().join("\n"),
544546
)
545547
.map_err(from_error)?;

proto/repositories.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ def rust_proto_dependencies():
2323
maybe(
2424
http_archive,
2525
name = "rules_proto",
26-
sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
27-
strip_prefix = "rules_proto-4.0.0",
26+
sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd",
27+
strip_prefix = "rules_proto-5.3.0-21.7",
2828
urls = [
29-
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
30-
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
29+
"https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
30+
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz",
3131
],
3232
)
3333

0 commit comments

Comments
 (0)