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/Android.bp b/Android.bp
index d29f875..c1ca304 100644
--- a/Android.bp
+++ b/Android.bp
@@ -478,15 +478,18 @@
":perfetto_src_ipc_common",
":perfetto_src_ipc_host",
":perfetto_src_protozero_protozero",
- ":perfetto_src_tracing_client_api",
+ ":perfetto_src_tracing_client_api_base",
+ ":perfetto_src_tracing_client_api_system_backend_only",
":perfetto_src_tracing_common",
":perfetto_src_tracing_core_core",
":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_in_process_backend_fake",
":perfetto_src_tracing_ipc_common",
":perfetto_src_tracing_ipc_consumer_consumer",
":perfetto_src_tracing_ipc_producer_producer",
":perfetto_src_tracing_ipc_service_service",
":perfetto_src_tracing_platform_posix",
+ ":perfetto_src_tracing_system_process_backend",
],
export_include_dirs: [
"include",
@@ -1360,15 +1363,17 @@
":perfetto_src_traced_probes_probes_src",
":perfetto_src_traced_probes_ps_ps",
":perfetto_src_traced_probes_sys_stats_sys_stats",
- ":perfetto_src_tracing_client_api",
+ ":perfetto_src_tracing_client_api_base",
":perfetto_src_tracing_common",
":perfetto_src_tracing_core_core",
":perfetto_src_tracing_core_service",
+ ":perfetto_src_tracing_in_process_backend",
":perfetto_src_tracing_ipc_common",
":perfetto_src_tracing_ipc_consumer_consumer",
":perfetto_src_tracing_ipc_producer_producer",
":perfetto_src_tracing_ipc_service_service",
":perfetto_src_tracing_platform_posix",
+ ":perfetto_src_tracing_system_process_backend",
":perfetto_src_tracing_test_api_test_support",
":perfetto_src_tracing_test_client_api_integrationtests",
":perfetto_test_end_to_end_integrationtests",
@@ -6500,15 +6505,13 @@
],
}
-// GN: //src/tracing:client_api
+// GN: //src/tracing:client_api_base
filegroup {
- name: "perfetto_src_tracing_client_api",
+ name: "perfetto_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/system_tracing_backend.cc",
"src/tracing/internal/tracing_muxer_impl.cc",
"src/tracing/internal/track_event_internal.cc",
"src/tracing/platform.cc",
@@ -6519,6 +6522,11 @@
],
}
+// GN: //src/tracing:client_api_system_backend_only
+filegroup {
+ name: "perfetto_src_tracing_client_api_system_backend_only",
+}
+
// GN: //src/tracing:common
filegroup {
name: "perfetto_src_tracing_common",
@@ -6588,6 +6596,22 @@
],
}
+// GN: //src/tracing:in_process_backend
+filegroup {
+ name: "perfetto_src_tracing_in_process_backend",
+ srcs: [
+ "src/tracing/internal/in_process_tracing_backend.cc",
+ ],
+}
+
+// GN: //src/tracing:in_process_backend_fake
+filegroup {
+ name: "perfetto_src_tracing_in_process_backend_fake",
+ srcs: [
+ "src/tracing/internal/in_process_tracing_backend_fake.cc",
+ ],
+}
+
// GN: //src/tracing/ipc:common
filegroup {
name: "perfetto_src_tracing_ipc_common",
@@ -6639,6 +6663,14 @@
],
}
+// GN: //src/tracing:system_process_backend
+filegroup {
+ name: "perfetto_src_tracing_system_process_backend",
+ srcs: [
+ "src/tracing/internal/system_tracing_backend.cc",
+ ],
+}
+
// GN: //src/tracing/test:api_test_support
filegroup {
name: "perfetto_src_tracing_test_api_test_support",