xref: /aosp_15_r20/external/perfetto/src/traced/service/BUILD.gn (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1# Copyright (C) 2017 The Android Open Source Project
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
15import("../../../gn/test.gni")
16
17# The unprivileged trace daemon that listens for Producer and Consumer
18# connections, handles the coordination of the tracing sessions and owns the
19# log buffers.
20executable("traced") {
21  deps = [
22    # Both traced and traced_probes depend on "libprefetto" instead of directly
23    # on lib. This is to reduce binary size on android builds. All the code is
24    # built into libperfetto and the executables are just tiny shells that call
25    # into the xxx_main() defined in the library.
26    "../../../:libperfetto",
27    "../../../gn:default_deps",
28    "../../../include/perfetto/ext/traced",
29  ]
30  sources = [ "main.cc" ]
31  assert_no_deps = [ "../../../gn:protobuf_lite" ]
32}
33
34# Contains all the implementation but not the main() entry point. This target
35# is shared both by the executable and tests.
36source_set("service") {
37  public_deps = [
38    "../../../include/perfetto/ext/traced",
39    "../../../include/perfetto/tracing",
40  ]
41  deps = [
42    ":builtin_producer",
43    "../../../gn:default_deps",
44    "../../base",
45    "../../base:version",
46    "../../tracing/core",
47    "../../tracing/ipc/service",
48    "../../tracing/service:service",
49  ]
50  if (enable_perfetto_zlib) {
51    deps += [ "../../tracing/service:zlib_compressor" ]
52  }
53
54  sources = [ "service.cc" ]
55}
56
57source_set("builtin_producer") {
58  public_deps = [
59    "../../../include/perfetto/ext/traced",
60    "../../../include/perfetto/tracing",
61  ]
62  deps = [
63    "../../../gn:default_deps",
64    "../../../protos/perfetto/config/android:zero",
65    "../../base",
66    "../../tracing/core",
67    "../../tracing/service:service",
68  ]
69
70  sources = [
71    "builtin_producer.cc",
72    "builtin_producer.h",
73  ]
74}
75
76perfetto_unittest_source_set("unittests") {
77  testonly = true
78  deps = [
79    ":builtin_producer",
80    "../../../gn:default_deps",
81    "../../../gn:gtest_and_gmock",
82    "../../../protos/perfetto/config/android:cpp",
83    "../../base",
84    "../../base:test_support",
85    "../../tracing/core",
86  ]
87  sources = [ "builtin_producer_unittest.cc" ]
88}
89