From 9c0cc5c65194665f29bd104c73abce02c68bff45 Mon Sep 17 00:00:00 2001 From: Andrzej Kotulski Date: Wed, 17 Jun 2015 11:27:07 -0100 Subject: [PATCH] Copy args from BuckAnalyze to -- buck module --- infer/lib/capture/buck.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/infer/lib/capture/buck.py b/infer/lib/capture/buck.py index 68ee4cfc8..482ba49dd 100644 --- a/infer/lib/capture/buck.py +++ b/infer/lib/capture/buck.py @@ -1,3 +1,4 @@ +import argparse import os import subprocess import traceback @@ -16,9 +17,27 @@ infer -- buck build HelloWorld''' def gen_instance(*args): return BuckAnalyzer(*args) + # This creates an empty argparser for the module, which provides only # description/usage information and no arguments. -create_argparser = util.base_argparser(MODULE_DESCRIPTION, MODULE_NAME) +def create_argparser(group_name=MODULE_NAME): + """This defines the set of arguments that get added by this module to the + set of global args defined in the infer top-level module + Do not use this function directly, it should be invoked by the infer + top-level module""" + parser = argparse.ArgumentParser(add_help=False) + group = parser.add_argument_group( + "{grp} module".format(grp=MODULE_NAME), + description=MODULE_DESCRIPTION, + ) + group.add_argument('--verbose', action='store_true', + help='Print buck compilation steps') + group.add_argument('--no-cache', action='store_true', + help='Do not use buck distributed cache') + group.add_argument('--print-harness', action='store_true', + help='Print generated harness code (Android only)') + return parser + class BuckAnalyzer: @@ -33,6 +52,13 @@ class BuckAnalyzer: capture_cmd.append('-g') if self.args.no_filtering: capture_cmd.append('--no-filtering') + if self.args.verbose: + capture_cmd.append('--verbose') + if self.args.no_cache: + capture_cmd.append('--no-cache') + if self.args.print_harness: + capture_cmd.append('--print-harness') + capture_cmd += self.cmd capture_cmd += ['--analyzer', self.args.analyzer] try: