tools/gen_bazel: Standalone Bazel build

Updates the gen_bazel generator and generates
a BUILD file that allows to build traced, traced_probes
perfetto and trace_processor both on Linux and Mac.
This also allows easy integration with google internal builds.
The major differences of the new generator are:
1. Uses the new way of dealing with protobuf libraries
   (proto_library -> cc_proto_library -> executable target
   see go/new-proto-library)
2. Instead of repeating all the source files in each target
   it creates Bazel filegroup(s) out of GN source_set(s).
   While doing so it takes care of propagating up flags and
   dependencies. This is because Bazel filegroup(s),
   conversely to GN source_set(s), are pure bags of sources.

Still missing:
 - cflags / ldflags propagation into Bazel.
 - Android toolchain (perhaps will never happen)

This will require a matching change to Google internal
sources.

Test: bazel build //:all
Change-Id: Ic1c725bd83e2a5e92eebb5c5b34728cf6d5983e6
diff --git a/BUILD.extras b/BUILD.extras
index 8a76d28..3bfd20a 100644
--- a/BUILD.extras
+++ b/BUILD.extras
@@ -1,16 +1,19 @@
-gensignature(
-    name = "trace_processor_sig",
-    srcs = [
-        ":trace_processor_shell",
-        ":trace_to_text",
-    ],
-    tags = [
-        "__TRACE_PROCESSOR_SIG_TAG1",
-        "__TRACE_PROCESSOR_SIG_TAG2",
-    ],
+build_config_dir_ = "include/perfetto/base/build_configs/bazel"
+
+# Deliberately NOT a perfetto_cc_library, to avoid cyclic deps.
+# This is pulled as a default dep by all targets.
+cc_library(
+    name = "build_config_hdr",
+    hdrs = [build_config_dir_ + "/perfetto_build_flags.h"],
+    includes = [build_config_dir_],
 )
 
-py_binary(
+perfetto_cc_library(
+    name = "cc_merged_sql_metrics",
+    hdrs = ["src/trace_processor/metrics/sql_metrics.h"],
+)
+
+perfetto_py_binary(
     name = "gen_merged_sql_metrics_py",
     srcs = [
         "tools/gen_merged_sql_metrics.py",