tp: move metrics descriptor generation to build time
This is necessary because generating the descriptor at check-in time was
leading to conflicts in G3 where the third_party/perfetto prefix is
present for extensions defined in Google3 but not the builtin
descriptors.
This CL ensures that wherever we build, we get a consistent generation
of the builtin metric descriptor.
Change-Id: I94be63dae7960edc8aabac8f47686a82daa4796e
diff --git a/Android.bp b/Android.bp
index 3e39756..18258df 100644
--- a/Android.bp
+++ b/Android.bp
@@ -14,6 +14,21 @@
//
// This file is automatically generated by tools/gen_android_bp. Do not edit.
+// GN: //src/trace_processor/metrics:gen_cc_metrics_descriptor
+genrule {
+ name: "gen_cc_metrics_descriptor",
+ srcs: [
+ ":perfetto_protos_perfetto_metrics_descriptor",
+ ],
+ cmd: "$(location tools/gen_cc_proto_descriptor.py) --gen_dir=$(genDir) --cpp_out=$(out) $(in)",
+ out: [
+ "src/trace_processor/metrics/metrics.descriptor.h",
+ ],
+ tool_files: [
+ "tools/gen_cc_proto_descriptor.py",
+ ],
+}
+
// GN: //src/trace_processor/metrics:gen_merged_sql_metrics
genrule {
name: "gen_merged_sql_metrics",
@@ -3317,6 +3332,21 @@
],
}
+// GN: //protos/perfetto/metrics:descriptor
+genrule {
+ name: "perfetto_protos_perfetto_metrics_descriptor",
+ srcs: [
+ "protos/perfetto/metrics/metrics.proto",
+ ],
+ tools: [
+ "aprotoc",
+ ],
+ cmd: "mkdir -p $(genDir)/external/perfetto/ && $(location aprotoc) --proto_path=external/perfetto --descriptor_set_out=$(out) --include_imports $(in)",
+ out: [
+ "perfetto_protos_perfetto_metrics_descriptor.bin",
+ ],
+}
+
// GN: //protos/perfetto/trace/android:cpp
genrule {
name: "perfetto_protos_perfetto_trace_android_cpp_gen",
@@ -8059,6 +8089,7 @@
"perfetto_gtest_logcat_printer",
],
generated_headers: [
+ "gen_cc_metrics_descriptor",
"gen_merged_sql_metrics",
"perfetto_protos_perfetto_common_cpp_gen_headers",
"perfetto_protos_perfetto_common_zero_gen_headers",
@@ -8254,6 +8285,7 @@
"libz",
],
generated_headers: [
+ "gen_cc_metrics_descriptor",
"gen_merged_sql_metrics",
"perfetto_protos_perfetto_common_zero_gen_headers",
"perfetto_protos_perfetto_config_android_zero_gen_headers",
@@ -8374,6 +8406,7 @@
"libz",
],
generated_headers: [
+ "gen_cc_metrics_descriptor",
"gen_merged_sql_metrics",
"perfetto_protos_perfetto_common_zero_gen_headers",
"perfetto_protos_perfetto_config_android_zero_gen_headers",