Skip to content

Commit 22d1926

Browse files
authored
rust-sdk: fix codegen for cross-crate proto extensions (#5646)
1 parent d121dc8 commit 22d1926

6 files changed

Lines changed: 36 additions & 4 deletions

File tree

contrib/rust-sdk/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

contrib/rust-sdk/perfetto-protos-gpu/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2024"
33
name = "perfetto-sdk-protos-gpu"
4-
version = "0.3.7"
4+
version = "0.3.8"
55
authors = ["David Reveman <reveman@meta.com>"]
66
description = "Extra protobuf bindings for GPU events"
77
readme = "README.md"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright (C) 2025 Rivos Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Autogenerated by the ProtoZero Rust compiler plugin.
16+
// Invoked by contrib/rust-sdk/tools/gen_rust_protos
17+
// DO NOT EDIT.
18+
19+
use crate::pb_msg;
20+
use crate::pb_msg_ext;
21+
use crate::protos::trace::gpu::gpu_render_stage_event::*;
22+
use perfetto_sdk::protos::trace::interned_data::interned_data::*;
23+
24+
pb_msg_ext!(InternedData {
25+
compute_kernels: InternedComputeKernel, msg, 1000,
26+
compute_arg_names: InternedComputeArgName, msg, 1001,
27+
});

contrib/rust-sdk/perfetto-protos-gpu/src/protos/trace/gpu/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@
1919
#[path = "gpu_counter_event.pz.rs"]
2020
pub mod gpu_counter_event;
2121

22+
/// `gpu_interned_data` protos.
23+
#[path = "gpu_interned_data.pz.rs"]
24+
pub mod gpu_interned_data;
25+
2226
/// `gpu_log` protos.
2327
#[path = "gpu_log.pz.rs"]
2428
pub mod gpu_log;

contrib/rust-sdk/tools/gen_rust_protos

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ SOURCE_FILES = [
8080
"protos/perfetto/config/gpu/gpu_renderstages_config.proto",
8181
"protos/perfetto/config/gpu/vulkan_memory_config.proto",
8282
"protos/perfetto/trace/gpu/gpu_counter_event.proto",
83+
"protos/perfetto/trace/gpu/gpu_interned_data.proto",
8384
"protos/perfetto/trace/gpu/gpu_log.proto",
8485
"protos/perfetto/trace/gpu/gpu_render_stage_event.proto",
8586
"protos/perfetto/trace/gpu/gpu_track_event.proto",
@@ -263,7 +264,7 @@ def main():
263264
path_strip_prefix=sources["path_strip_prefix"],
264265
path_add_prefix=sources["path_add_prefix"],
265266
external_crate=sources.get("external_crate"),
266-
local_files=all_files,
267+
local_files=sources["files"],
267268
)
268269

269270
tmpfilename = os.path.join(tmpdirname, transform_extension(source))

src/protozero/protoc_plugin/protozero_rust_plugin.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ class GeneratorJob {
376376
if (!enums_.empty()) {
377377
stub_rs_->Print("use crate::pb_enum;\n");
378378
}
379-
if (!messages_.empty()) {
379+
if (!messages_.empty() || !extensions_.empty()) {
380380
stub_rs_->Print("use crate::pb_msg;\n");
381381
}
382382
if (!extensions_.empty()) {

0 commit comments

Comments
 (0)