Make traced a top-level executable
- Make a little change to the Android blueprint generator, which
makes it so that executables in the top-level BUILD.gn file
don't get the perfetto_ prefix. This allows to get a binary
in the Android.bp that is called just "traced" and ends up in
/system/bin/traced
- Adds the consumer_cmd binary introduced by the previous change
(Iccf88b7b1d2beb6a0750adafd86d92a0f563182d) to the blueprint.
Bug:
Change-Id: Ia091ba35f186a451c4c0e111fcc03a0d8decf816
diff --git a/tools/gen_android_bp b/tools/gen_android_bp
index eb5e051..bcc0f43 100755
--- a/tools/gen_android_bp
+++ b/tools/gen_android_bp
@@ -34,7 +34,11 @@
import sys
# Default targets to translate to the blueprint file.
-default_targets = ['//:perfetto_tests', '//src/traced:traced']
+default_targets = [
+ '//:perfetto_tests',
+ '//:traced',
+ '//src/tracing:consumer_cmd',
+]
# Arguments for the GN output directory.
gn_args = 'target_os="android" target_cpu="arm" is_debug=false'
@@ -195,9 +199,9 @@
def label_to_module_name(label):
"""Turn a GN label (e.g., //:perfetto_tests) into a module name."""
- label = re.sub(r'^//:?', '', label)
- module = re.sub(r'[^a-zA-Z0-9_]', '_', label)
- if not module.startswith(module_prefix):
+ module = re.sub(r'^//:?', '', label)
+ module = re.sub(r'[^a-zA-Z0-9_]', '_', module)
+ if not module.startswith(module_prefix) and label not in default_targets:
return module_prefix + module
return module