| # 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 (minmal 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", |
| "trace_packet.proto", |
| "trace.proto", |
| ] |
| |
| proto_sources_minimal = [ |
| "clock_snapshot.proto", |
| "trigger.proto", |
| "system_info.proto", |
| ] |
| |
| # Used only for packet_stream_validator.cc (in the service). |
| proto_sources_trusted = [ "trusted_packet.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", |
| ] |
| } |
| |
| perfetto_proto_library("non_minimal_@TYPE@") { |
| visibility = [ |
| ":lite", |
| ":zero", |
| ] |
| deps = [ |
| ":minimal_@TYPE@", |
| "../config:@TYPE@", |
| "android:@TYPE@", |
| "chrome:@TYPE@", |
| "filesystem:@TYPE@", |
| "ftrace:@TYPE@", |
| "gpu:@TYPE@", |
| "interned_data:@TYPE@", |
| "perfetto:@TYPE@", |
| "power:@TYPE@", |
| "profiling:@TYPE@", |
| "ps:@TYPE@", |
| "sys_stats:@TYPE@", |
| "track_event:@TYPE@", |
| ] |
| sources = proto_sources_non_minimal |
| } |
| |
| perfetto_proto_library("minimal_@TYPE@") { |
| deps = [ |
| "../config:@TYPE@", |
| ] |
| sources = proto_sources_minimal |
| } |
| |
| # Used by the traced service for packet sanitization. |
| perfetto_proto_library("trusted_@TYPE@") { |
| proto_generators = [ "lite" ] |
| deps = [ |
| ":minimal_@TYPE@", |
| "../common:@TYPE@", |
| "../config:@TYPE@", |
| ] |
| sources = proto_sources_trusted |
| } |
| |
| # This target is 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") { |
| proto_generators = [ "lite" ] |
| sources = [ |
| "perfetto_trace.proto", |
| ] |
| } |
| |
| if (perfetto_build_standalone) { |
| perfetto_proto_library("descriptor") { |
| proto_generators = [ "descriptor" ] |
| generate_descriptor = "trace.descriptor" |
| sources = [ |
| "trace.proto", |
| ] |
| } |
| } |
| |
| # 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", |
| ] |
| } |