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/tools/gen_merged_sql_metrics.py b/tools/gen_merged_sql_metrics.py
index cb36db5..319d0d3 100755
--- a/tools/gen_merged_sql_metrics.py
+++ b/tools/gen_merged_sql_metrics.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
# Copyright (C) 2019 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -104,8 +104,7 @@
for path in sql_outputs.keys():
name = os.path.basename(path)
variable = filename_to_variable(os.path.splitext(name)[0])
- path_escaped = path.encode('string_escape')
- output.write('\n {{"{}", {}}},\n'.format(path_escaped, variable))
+ output.write('\n {{"{}", {}}},\n'.format(path, variable))
output.write("};\n")
output.write(NAMESPACE_END)