Remove ODR violations from Bazel builds

The process of generating Bazel build files
from GN caused ODR violations when flattening GN
source_set(s) into file groups.
The problem is the following: file groups are effectively
just list of source paths. Unlike GN, where the build
system retains the identity of the source_set, using
the same source_set in different targets causes the
same sources to get compiled and linked multiple times.
So in Bazel and SoonG we have two conflicting needs:
1. We can only depend on static_library targets. One
   can not depend on a filegroup in Bazel. This
   is the reason why "protozero" exists as a static
   library in Bazel builds: we need the generated
   protobuf sources to be able to depend on a target
   and that target becomes a static_library.
2. By flattening and propagating up source sets as
   filegroups we end up with the same filegroup being
   linked in several different static libraries.

Note that the same situation exists in SoonG. There,
however things are more complicated because heapprofd_client
depends on base but wants to build it with different cflags
(-DPERFETTO_ANDROID_ASYNC_SAFE_LOG) so we can't split that
into a static_library yet.

The root problem here was the following:
libperfetto_client_experimental(static_lib) ->  libprotozero(static_lib) -> base(filegroup)
libperfetto_client_experimental(static_lib) -> perfetto_ipc(static_lib) -> base(filegroup)

This CL fixes it by making base a static_library.
Furthermore this adds a test at the tools/gen_xxx level to
avoid regressing this in future.

Bug: 154625868
Test: built into tools/gen_android_bp and tools/gen_bazel
Change-Id: I80004c64e571bd85f9791673ee7740a088989dcc
13 files changed
tree: 80df2bc9d75dbe0a5b29a15e50782977aff5898a
  1. bazel/
  2. build_overrides/
  3. buildtools/
  4. debian/
  5. docs/
  6. examples/
  7. gn/
  8. include/
  9. infra/
  10. protos/
  11. src/
  12. test/
  13. tools/
  14. ui/
  15. .clang-format
  16. .clang-tidy
  17. .gitignore
  18. .gn
  19. .style.yapf
  20. Android.bp
  21. Android.bp.extras
  22. BUILD
  23. BUILD.extras
  24. BUILD.gn
  25. CHANGELOG
  26. codereview.settings
  27. heapprofd.rc
  28. LICENSE
  29. METADATA
  30. MODULE_LICENSE_APACHE2
  31. OWNERS
  32. perfetto.rc
  33. PRESUBMIT.py
  34. README.chromium
  35. README.md
  36. TEST_MAPPING
  37. traced_perf.rc
  38. WORKSPACE
README.md

Perfetto - System profiling, app tracing and trace analysis

Perfetto is a production-grade open-source stack for performance instrumentation and trace analysis. It offers services and libraries and for recording system-level and app-level traces, native + java heap profiling, a library for analyzing traces using SQL and a web-based UI to visualize and explore multi-GB traces.

See https://perfetto.dev/docs or the /docs/ directory for documentation.