Client API: use only system backend in the android tree
This change makes the client library backends selectable with GN.
This is achieved by splitting out the client_api_base target and
pairing it with either the real backends or with fallback versions
that return nullptr nad print an error.
This is to avoid linking the in-process backend (which in turn pulls
all the consumer and service code) on Android.
Saves 214KB of binary size in Android.
Bug: 148198993
Change-Id: I6b6f5ad0095e9e4ba2e1dd6c3fe5330a2568b0ad
diff --git a/BUILD b/BUILD
index be3b241..bbad73c 100644
--- a/BUILD
+++ b/BUILD
@@ -1230,16 +1230,14 @@
],
)
-# GN target: //src/tracing:client_api
+# GN target: //src/tracing:client_api_base
filegroup(
- name = "src_tracing_client_api",
+ name = "src_tracing_client_api_base",
srcs = [
"src/tracing/data_source.cc",
"src/tracing/debug_annotation.cc",
"src/tracing/event_context.cc",
- "src/tracing/internal/in_process_tracing_backend.cc",
"src/tracing/internal/in_process_tracing_backend.h",
- "src/tracing/internal/system_tracing_backend.cc",
"src/tracing/internal/system_tracing_backend.h",
"src/tracing/internal/tracing_muxer_impl.cc",
"src/tracing/internal/tracing_muxer_impl.h",
@@ -1260,6 +1258,14 @@
],
)
+# GN target: //src/tracing:in_process_backend
+filegroup(
+ name = "src_tracing_in_process_backend",
+ srcs = [
+ "src/tracing/internal/in_process_tracing_backend.cc",
+ ],
+)
+
# GN target: //src/tracing:platform_posix
filegroup(
name = "src_tracing_platform_posix",
@@ -1268,6 +1274,14 @@
],
)
+# GN target: //src/tracing:system_process_backend
+filegroup(
+ name = "src_tracing_system_process_backend",
+ srcs = [
+ "src/tracing/internal/system_tracing_backend.cc",
+ ],
+)
+
# GN target: //tools/trace_to_text:common
filegroup(
name = "tools_trace_to_text_common",
@@ -2474,15 +2488,17 @@
":src_ipc_common",
":src_ipc_host",
":src_protozero_protozero",
- ":src_tracing_client_api",
+ ":src_tracing_client_api_base",
":src_tracing_common",
":src_tracing_core_core",
":src_tracing_core_service",
+ ":src_tracing_in_process_backend",
":src_tracing_ipc_common",
":src_tracing_ipc_consumer_consumer",
":src_tracing_ipc_producer_producer",
":src_tracing_ipc_service_service",
":src_tracing_platform_posix",
+ ":src_tracing_system_process_backend",
],
hdrs = [
":include_perfetto_base_base",