summaryrefslogtreecommitdiff
path: root/build.py
diff options
context:
space:
mode:
author Abhishek Pandit-Subedi <abhishekpandit@google.com> 2022-12-16 16:09:01 -0800
committer Abhishek Pandit-Subedi <abhishekpandit@google.com> 2023-02-10 14:48:53 -0800
commit2a9a916764e4c47621436ed1dea2685804f7667b (patch)
treecab7f3303b6a70799a4c8b21e5e88846c916eaf5 /build.py
parentb11874a7baa77f96c50a52c2396e996533a8727c (diff)
floss: Add hcidoc tool to read snoop files
Hcidoc will be used to analyze snoop files and snooz files to identify errors and other behaviors. This commit simply sets up the hcidoc crate and a simple snoop reader. Bug: 262928525 Tag: #floss Test: ./build.py --target utils Change-Id: I7eeae136a35d51a01ac2ab137dbf114e07f800e9
Diffstat (limited to 'build.py')
-rwxr-xr-xbuild.py67
1 files changed, 43 insertions, 24 deletions
diff --git a/build.py b/build.py
index 7fd925e8d1..b73349382e 100755
--- a/build.py
+++ b/build.py
@@ -67,12 +67,13 @@ VALID_TARGETS = [
'all', # All targets except test and clean
'clean', # Clean up output directory
'docs', # Build Rust docs
+ 'hosttools', # Build the host tools (i.e. packetgen)
'main', # Build the main C++ codebase
'prepare', # Prepare the output directory (gn gen + rust setup)
'rootcanal', # Build Rust targets for RootCanal
'rust', # Build only the rust components + copy artifacts to output dir
'test', # Run the unit tests
- 'tools', # Build the host tools (i.e. packetgen)
+ 'utils', # Build Floss utils
]
# TODO(b/190750167) - Host tests are disabled until we are full bazel build
@@ -440,14 +441,14 @@ class HostBuild():
self._gn_configure()
self._rust_configure()
- def _target_tools(self):
+ def _target_hosttools(self):
""" Build the tools target in an already prepared environment.
"""
self._gn_build('tools')
# Also copy bluetooth_packetgen to CARGO_HOME so it's available
- shutil.copy(
- os.path.join(self._gn_default_output(), 'bluetooth_packetgen'), os.path.join(self.env['CARGO_HOME'], 'bin'))
+ shutil.copy(os.path.join(self._gn_default_output(), 'bluetooth_packetgen'),
+ os.path.join(self.env['CARGO_HOME'], 'bin'))
def _target_docs(self):
"""Build the Rust docs."""
@@ -488,10 +489,20 @@ class HostBuild():
# Host tests second based on host test list
for t in HOST_TESTS:
- self.run_command(
- 'test', [os.path.join(self.output_dir, 'out/Default', t)],
- cwd=os.path.join(self.output_dir),
- env=self.env)
+ self.run_command('test', [os.path.join(self.output_dir, 'out/Default', t)],
+ cwd=os.path.join(self.output_dir),
+ env=self.env)
+
+ def _target_utils(self):
+ """ Builds the utility applications.
+ """
+ rust_targets = ['hcidoc']
+
+ # Build targets
+ for target in rust_targets:
+ self.run_command('utils', ['cargo', 'build', '-p', target],
+ cwd=os.path.join(self.platform_dir, 'bt'),
+ env=self.env)
def _target_install(self):
""" Installs files required to run Floss to install directory.
@@ -568,7 +579,7 @@ class HostBuild():
""" Build all common targets (skipping doc, test, and clean).
"""
self._target_prepare()
- self._target_tools()
+ self._target_hosttools()
self._target_main()
self._target_rust()
@@ -584,8 +595,8 @@ class HostBuild():
if self.target == 'prepare':
self._target_prepare()
- elif self.target == 'tools':
- self._target_tools()
+ elif self.target == 'hosttools':
+ self._target_hosttools()
elif self.target == 'rootcanal':
self._target_rootcanal()
elif self.target == 'rust':
@@ -600,6 +611,8 @@ class HostBuild():
self._target_clean()
elif self.target == 'install':
self._target_install()
+ elif self.target == 'utils':
+ self._target_utils()
elif self.target == 'all':
self._target_all()
@@ -846,18 +859,22 @@ class Bootstrap():
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Simple build for host.')
- parser.add_argument(
- '--bootstrap-dir', help='Directory to run bootstrap on (or was previously run on).', default="~/.floss")
- parser.add_argument(
- '--run-bootstrap',
- help='Run bootstrap code to verify build env is ok to build.',
- default=False,
- action='store_true')
- parser.add_argument(
- '--print-env', help='Print environment variables used for build.', default=False, action='store_true')
+ parser.add_argument('--bootstrap-dir',
+ help='Directory to run bootstrap on (or was previously run on).',
+ default="~/.floss")
+ parser.add_argument('--run-bootstrap',
+ help='Run bootstrap code to verify build env is ok to build.',
+ default=False,
+ action='store_true')
+ parser.add_argument('--print-env',
+ help='Print environment variables used for build.',
+ default=False,
+ action='store_true')
parser.add_argument('--no-clang', help='Don\'t use clang compiler.', default=False, action='store_true')
- parser.add_argument(
- '--no-strip', help='Skip stripping binaries during install.', default=False, action='store_true')
+ parser.add_argument('--no-strip',
+ help='Skip stripping binaries during install.',
+ default=False,
+ action='store_true')
parser.add_argument('--use', help='Set a specific use flag.')
parser.add_argument('--notest', help='Don\'t compile test code.', default=False, action='store_true')
parser.add_argument('--test-name', help='Run test with this string in the name.', default=None)
@@ -865,8 +882,10 @@ if __name__ == '__main__':
parser.add_argument('--sysroot', help='Set a specific sysroot path', default='/')
parser.add_argument('--libdir', help='Libdir - default = usr/lib', default='usr/lib')
parser.add_argument('--jobs', help='Number of jobs to run', default=0, type=int)
- parser.add_argument(
- '--no-vendored-rust', help='Do not use vendored rust crates', default=False, action='store_true')
+ parser.add_argument('--no-vendored-rust',
+ help='Do not use vendored rust crates',
+ default=False,
+ action='store_true')
parser.add_argument('--verbose', help='Verbose logs for build.')
parser.add_argument('--rust-debug', help='Build Rust code as debug.', default=False, action='store_true')
parser.add_argument(