Copy args from BuckAnalyze to -- buck module

master
Andrzej Kotulski 10 years ago
parent b57ac1fe49
commit 9c0cc5c651

@ -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:

Loading…
Cancel
Save