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