• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// These targets are appended to the autogenerated Android.bp by tools/gen_android_bp.
2
3java_library_host {
4    name: "perfetto_config-full",
5    proto: {
6        type: "full",
7    },
8    srcs: [
9        "protos/perfetto/config/perfetto_config.proto",
10    ],
11}
12
13java_library {
14    name: "perfetto_config-lite",
15    proto: {
16        type: "lite",
17    },
18    srcs: [
19        "protos/perfetto/config/perfetto_config.proto",
20    ],
21}
22
23java_library_host {
24    name: "trace_summary-full",
25    proto: {
26        type: "full",
27        canonical_path_from_root: false,
28    },
29    static_libs: [
30        "libprotobuf-java-full",
31    ],
32    srcs: [
33        ":perfetto_trace_summary_filegroup_proto",
34    ],
35    // b/267831518: Pin tradefed and dependencies to Java 11.
36    java_version: "11",
37}
38
39java_library_host {
40    name: "perfetto_trace-full",
41    proto: {
42        type: "full",
43    },
44    srcs: [
45        "protos/perfetto/trace/perfetto_trace.proto",
46    ],
47    // b/267831518: Pin tradefed and dependencies to Java 11.
48    java_version: "11",
49}
50
51java_library_host {
52    name: "perfetto_metrics-full",
53    proto: {
54        type: "full",
55    },
56    srcs: [
57        "protos/perfetto/metrics/perfetto_merged_metrics.proto",
58    ],
59    // b/267831518: Pin tradefed and dependencies to Java 11.
60    java_version: "11",
61}
62
63// This sample target shows how to use the perfetto client API from within the
64// Android tree.
65cc_binary {
66    name: "libperfetto_client_example",
67    srcs: [
68        "test/client_api_example.cc",
69    ],
70    static_libs: [
71        "libperfetto_client_experimental",
72        "perfetto_trace_protos",
73    ],
74    shared_libs: [
75        "libprotobuf-cpp-lite",
76        "liblog",
77    ],
78    cflags: [
79        "-DGOOGLE_PROTOBUF_NO_RTTI",
80        "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
81    ],
82    defaults: [
83        "perfetto_defaults",
84    ],
85}
86
87cc_library_static {
88    name: "libstatslog_perfetto",
89    generated_sources: ["statslog_perfetto.cpp"],
90    generated_headers: ["statslog_perfetto.h"],
91    cflags: [
92        "-Wall",
93        "-Werror",
94    ],
95    export_generated_headers: ["statslog_perfetto.h"],
96    shared_libs: [
97        "libcutils",
98        "liblog",
99        "libstatssocket",
100        "libutils",
101    ],
102}
103
104genrule {
105    name: "statslog_perfetto.h",
106    tools: ["stats-log-api-gen"],
107    cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_perfetto.h --module perfetto --namespace perfetto,android_internal",
108    out: [
109        "statslog_perfetto.h",
110    ],
111}
112
113genrule {
114    name: "statslog_perfetto.cpp",
115    tools: ["stats-log-api-gen"],
116    cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_perfetto.cpp --module perfetto --namespace perfetto,android_internal --importHeader statslog_perfetto.h",
117    out: [
118        "statslog_perfetto.cpp",
119    ],
120}
121
122package {
123    default_applicable_licenses: ["external_perfetto_license"],
124}
125
126python_library {
127    name: "perfetto-trace-processor-python",
128    srcs: [
129        ":perfetto-trace-processor-python-srcs",
130        ":perfetto-trace-uri-resolver-python-srcs",
131    ],
132    data: [
133        ":perfetto-trace-processor-python-data",
134    ],
135    libs: [
136        "libprotobuf-python",
137    ],
138    host_supported: true,
139}
140
141filegroup {
142    name: "perfetto-trace-uri-resolver-python-srcs",
143    srcs: ["python/perfetto/trace_uri_resolver/*.py"],
144    path: "python",
145}
146
147filegroup {
148    name: "perfetto-trace-processor-python-srcs",
149    srcs: [
150        "python/perfetto/common/*.py",
151        "python/perfetto/trace_processor/*.py",
152    ],
153    path: "python",
154}
155
156filegroup {
157    name: "perfetto-trace-processor-python-data",
158    srcs: ["python/perfetto/trace_processor/*.descriptor*"],
159    path: "python",
160}
161
162// Added automatically by a large-scale-change that took the approach of
163// 'apply every license found to every target'. While this makes sure we respect
164// every license restriction, it may not be entirely correct.
165//
166// e.g. GPL in an MIT project might only apply to the contrib/ directory.
167//
168// Please consider splitting the single license below into multiple licenses,
169// taking care not to lose any license_kind information, and overriding the
170// default license using the 'licenses: [...]' property on targets as needed.
171//
172// For unused files, consider creating a 'fileGroup' with "//visibility:private"
173// to attach the license to, and including a comment whether the files may be
174// used in the current project.
175// See: http://go/android-license-faq
176license {
177    name: "external_perfetto_license",
178    visibility: [":__subpackages__"],
179    license_kinds: [
180        "SPDX-license-identifier-Apache-2.0",
181        "SPDX-license-identifier-BSD",
182        "SPDX-license-identifier-CC-BY",
183    ],
184    license_text: [
185        "LICENSE",
186    ],
187}
188
189gensrcs {
190    name: "perfetto_trace_javastream_protos",
191    srcs: [
192        ":perfetto_winscope_filegroup_proto",
193    ],
194    tools: [
195        "aprotoc",
196        "protoc-gen-javastream",
197        "soong_zip",
198    ],
199    cmd: "mkdir -p $(genDir)/$(in) " +
200        "&& $(location aprotoc) " +
201        "--plugin=$(location protoc-gen-javastream) " +
202        "--javastream_opt=include_filter:perfetto.protos.TracePacket,perfetto.protos.ShellTransition,perfetto.protos.ShellHandlerMappings,perfetto.protos.ProtoLogMessage,perfetto.protos.ProtoLogViewerConfig,perfetto.protos.ShellHandlerMapping,perfetto.protos.ShellHandlerMappings,perfetto.protos.ProtoLogGroup,perfetto.protos.ProtoLogConfig,perfetto.protos.DataSourceConfig,perfetto.protos.InternedString,perfetto.protos.InternedData,perfetto.protos.ProtoLogLevel,perfetto.protos.TestEvent,perfetto.protos.TestEvent.TestPayload,perfetto.protos.TestConfig,perfetto.protos.TestConfig.DummyFields,perfetto.protos.WinscopeExtensionsImpl,perfetto.protos.InputMethodClientsTraceProto,perfetto.protos.InputMethodManagerServiceTraceProto,perfetto.protos.InputMethodServiceTraceProto,perfetto.protos.ViewCapture,perfetto.protos.WindowManagerConfig,perfetto.protos.WindowManagerTraceEntry " +
203        "--javastream_out=$(genDir)/$(in) " +
204        "-Iexternal/protobuf/src " +
205        "-Iexternal/perfetto " +
206        "-I . $(in) " +
207        "&& $(location soong_zip) " +
208        "-jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
209    data: [
210        ":libprotobuf-internal-protos",
211    ],
212    output_extension: "srcjar",
213}
214
215java_library {
216    name: "perfetto_winscope-lite",
217    proto: {
218        type: "lite",
219        include_dirs: ["external/protobuf/src"],
220        canonical_path_from_root: false,
221    },
222    srcs: [
223        ":libprotobuf-internal-descriptor-proto",
224        ":perfetto_winscope_filegroup_proto",
225    ],
226    static_libs: [
227        "libprotobuf-java-lite",
228    ],
229    sdk_version: "current",
230}
231
232java_library {
233    name: "perfetto_config_java_protos_system_server_current",
234    srcs: [
235        ":perfetto_config_filegroup_proto",
236    ],
237    static_libs: [
238        "libprotobuf-java-lite",
239    ],
240    proto: {
241        type: "lite",
242        canonical_path_from_root: false,
243    },
244    sdk_version: "system_server_current",
245    min_sdk_version: "35",
246    apex_available: [
247        "com.android.profiling",
248    ],
249}
250
251prebuilt_etc {
252    name: "perfetto_persistent_cfg.pbtxt",
253    filename: "persistent_cfg.pbtxt",
254    sub_dir: "perfetto",
255    src: "persistent_cfg.pbtxt",
256}
257
258phony {
259    name: "perfetto-extras",
260    required: [
261        "libperfetto_android_internal",
262        "traced_perf",
263        "trigger_perfetto",
264    ],
265}
266
267filegroup {
268    name: "heap_profile",
269    srcs: [
270        "tools/heap_profile",
271    ],
272}
273
274aconfig_declarations {
275    name: "perfetto_flags-aconfig",
276    package: "perfetto.flags",
277    container: "system",
278    srcs: ["perfetto_flags.aconfig"],
279}
280
281cc_aconfig_library {
282    name: "perfetto_flags_c_lib",
283    aconfig_declarations: "perfetto_flags-aconfig",
284}
285