Skip to content

Commit

Permalink
protozero: extract textproto -> proto logic from config_utils
Browse files Browse the repository at this point in the history
The code is written to be totally generic, just the top layer is tied to
TraceConfig. Separate the code out into a new subfolder of protozero (to
make it possible to depend on it from anywhere in Perfetto) and allow
its use in the upcoming work on metrics v2

Change-Id: Id07548be536aab68779187ccdbc3cc6ec1ab3a6b
  • Loading branch information
LalitMaganti committed Jan 20, 2025
1 parent 3b5f76b commit ca7396a
Show file tree
Hide file tree
Showing 10 changed files with 930 additions and 779 deletions.
10 changes: 10 additions & 0 deletions Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,7 @@ cc_binary {
":perfetto_src_perfetto_cmd_protos_cpp_gen",
":perfetto_src_perfetto_cmd_trigger_producer",
":perfetto_src_protozero_protozero",
":perfetto_src_protozero_text_to_proto_text_to_proto",
":perfetto_src_trace_config_utils_txt_to_pb",
":perfetto_src_tracing_common",
":perfetto_src_tracing_core_core",
Expand Down Expand Up @@ -12240,6 +12241,14 @@ genrule {
],
}

// GN: //src/protozero/text_to_proto:text_to_proto
filegroup {
name: "perfetto_src_protozero_text_to_proto_text_to_proto",
srcs: [
"src/protozero/text_to_proto/text_to_proto.cc",
],
}

// GN: //src/protozero:unittests
filegroup {
name: "perfetto_src_protozero_unittests",
Expand Down Expand Up @@ -15742,6 +15751,7 @@ cc_test {
":perfetto_src_protozero_testing_messages_subpackage_lite_gen",
":perfetto_src_protozero_testing_messages_subpackage_zero_gen",
":perfetto_src_protozero_testing_messages_zero_gen",
":perfetto_src_protozero_text_to_proto_text_to_proto",
":perfetto_src_protozero_unittests",
":perfetto_src_shared_lib_intern_map",
":perfetto_src_shared_lib_unittests",
Expand Down
11 changes: 11 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ perfetto_cc_binary(
":src_protozero_filtering_filter_util",
":src_protozero_filtering_message_filter",
":src_protozero_filtering_string_filter",
":src_protozero_text_to_proto_text_to_proto",
":src_trace_config_utils_txt_to_pb",
"src/tools/proto_filter/proto_filter.cc",
],
Expand Down Expand Up @@ -1545,6 +1546,15 @@ perfetto_filegroup(
],
)

# GN target: //src/protozero/text_to_proto:text_to_proto
perfetto_filegroup(
name = "src_protozero_text_to_proto_text_to_proto",
srcs = [
"src/protozero/text_to_proto/text_to_proto.cc",
"src/protozero/text_to_proto/text_to_proto.h",
],
)

# GN target: //src/protozero:proto_ring_buffer
perfetto_filegroup(
name = "src_protozero_proto_ring_buffer",
Expand Down Expand Up @@ -6652,6 +6662,7 @@ perfetto_cc_binary(
":src_perfetto_cmd_bugreport_path",
":src_perfetto_cmd_perfetto_cmd",
":src_perfetto_cmd_trigger_producer",
":src_protozero_text_to_proto_text_to_proto",
":src_trace_config_utils_txt_to_pb",
":src_tracing_common",
":src_tracing_core_core",
Expand Down
26 changes: 26 additions & 0 deletions src/protozero/text_to_proto/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (C) 2025 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

source_set("text_to_proto") {
sources = [
"text_to_proto.cc",
"text_to_proto.h",
]
deps = [
"..:protozero",
"../../../gn:default_deps",
"../../../protos/perfetto/common:cpp",
"../../base",
]
}
Loading

0 comments on commit ca7396a

Please sign in to comment.