| # Copyright (C) 2017 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. |
| |
| import("../../../gn/perfetto.gni") |
| import("../../../gn/proto_library.gni") |
| |
| # Trace protos are split logically into two groups: |
| # 1. Full set of protos: :zero (for writers) and :lite (for readers). |
| # 2. Minimal set: :minimal_zero, :minimal_lite. These are mainly for chrome, to |
| # avoid bloating binary size by pulling unnecessary protos. |
| # |
| # In practice, however, we need to split them in disjoint targets (minimal and |
| # non-minimal) and then use a group() target for the full protos. This is |
| # because build systems don't like two targets having genrules for the same |
| # .proto files. |
| |
| # By default add new protos here. |
| proto_sources_non_minimal = [ |
| "trace_packet_defaults.proto", |
| "test_event.proto", |
| "test_extensions.proto", |
| "trace_packet.proto", |
| "trace.proto", |
| "extension_descriptor.proto", |
| "memory_graph.proto", |
| "ui_state.proto", |
| ] |
| |
| proto_sources_minimal = [ |
| "clock_snapshot.proto", |
| "trace_uuid.proto", |
| "trigger.proto", |
| "system_info.proto", |
| ] |
| |
| # Most targets should either depend on :zero (writers) / :lite (readers) |
| # or ":minimal_zero" / :minimal_lite (mostly for chrome). |
| |
| # The full set of protozero-generated sources. |
| group("zero") { |
| public_deps = [ |
| ":minimal_zero", |
| ":non_minimal_zero", |
| ] |
| } |
| |
| # The full set of libprotobuf-generated sources. |
| group("lite") { |
| public_deps = [ |
| ":minimal_lite", |
| ":non_minimal_lite", |
| ] |
| } |
| |
| # This is only for tests because bloats binary size. |
| group("cpp") { |
| testonly = true |
| public_deps = [ |
| ":minimal_cpp", |
| ":non_minimal_cpp", |
| ] |
| } |
| |
| # This is only for Bazel build generation. |
| group("source_set") { |
| testonly = true |
| public_deps = [ |
| ":minimal_source_set", |
| ":non_minimal_source_set", |
| ] |
| } |
| |
| perfetto_proto_library("non_minimal_@TYPE@") { |
| proto_generators = [ |
| "cpp", |
| "lite", |
| "zero", |
| "source_set", |
| ] |
| deps = [ |
| ":minimal_@TYPE@", |
| "../config:@TYPE@", |
| "android:@TYPE@", |
| "chrome:@TYPE@", |
| "etw:@TYPE@", |
| "filesystem:@TYPE@", |
| "ftrace:@TYPE@", |
| "gpu:@TYPE@", |
| "interned_data:@TYPE@", |
| "perfetto:@TYPE@", |
| "power:@TYPE@", |
| "profiling:@TYPE@", |
| "ps:@TYPE@", |
| "statsd:@TYPE@", |
| "sys_stats:@TYPE@", |
| "system_info:@TYPE@", |
| "track_event:@TYPE@", |
| "translation:@TYPE@", |
| ] |
| sources = proto_sources_non_minimal |
| public_deps = [ "track_event:@TYPE@" ] |
| } |
| |
| perfetto_proto_library("minimal_@TYPE@") { |
| deps = [ "../config:@TYPE@" ] |
| sources = proto_sources_minimal |
| } |
| |
| perfetto_proto_library("descriptor") { |
| proto_generators = [ "descriptor" ] |
| generate_descriptor = "trace.descriptor" |
| sources = [ "trace.proto" ] |
| deps = [ ":non_minimal_source_set" ] |
| } |
| |
| # This target exports perfetto trace protos allowing both host and device |
| # targets to implement custom parsers based on our protos. |
| static_library("perfetto_trace_protos") { |
| complete_static_lib = true |
| deps = [ ":lite" ] |
| } |
| |
| perfetto_proto_library("test_extensions_descriptor") { |
| proto_generators = [ "descriptor" ] |
| generate_descriptor = "test_extensions.descriptor" |
| sources = [ "test_extensions.proto" ] |
| deps = [ "track_event:source_set" ] |
| } |
| |
| # This target are not used in the tree and is built only to guarantee that the |
| # autogenerated merged proto has a valid syntax. |
| perfetto_proto_library("merged_trace_@TYPE@") { |
| proto_generators = [ "lite" ] |
| sources = [ "perfetto_trace.proto" ] |
| } |