aboutsummaryrefslogtreecommitdiff
path: root/protos/perfetto/trace/BUILD.gn
blob: b644aaf5003713dc077d185f185bb20dbda53947 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# 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",
]

# 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",
  ]
}

perfetto_proto_library("non_minimal_@TYPE@") {
  proto_generators = [
    "cpp",
    "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@",
    "system_info:@TYPE@",
    "track_event:@TYPE@",
  ]
  sources = proto_sources_non_minimal
}

perfetto_proto_library("minimal_@TYPE@") {
  deps = [ "../config:@TYPE@" ]
  sources = proto_sources_minimal
}

# 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" ]
}