Add -Xbuck option to pass arguments to buck build

Reviewed By: jvillard

Differential Revision: D3488295

fbshipit-source-id: f8a82d2
master
Andrzej Kotulski 9 years ago committed by Facebook Github Bot
parent c06795e631
commit afc192b100

@ -33,6 +33,8 @@ def gen_instance(*args):
return BuckAnalyzer(*args) return BuckAnalyzer(*args)
def string_in_quotes(value):
return value.strip('\'')
# This creates an empty argparser for the module, which provides only # This creates an empty argparser for the module, which provides only
# description/usage information and no arguments. # description/usage information and no arguments.
def create_argparser(group_name=MODULE_NAME): def create_argparser(group_name=MODULE_NAME):
@ -64,6 +66,12 @@ def create_argparser(group_name=MODULE_NAME):
help='Merge the infer-deps.txt files generated by Buck ' help='Merge the infer-deps.txt files generated by Buck '
'during the analysis (requires --use-flavors to ' 'during the analysis (requires --use-flavors to '
'work)') 'work)')
group.add_argument('--Xbuck', action='append', default=[],
type=string_in_quotes,
help='Pass values as command-line arguments to '
'invocations of `buck build`.'
'NOTE: value should be wrapped in single quotes')
return parser return parser
@ -110,7 +118,8 @@ class BuckAnalyzer:
'infer.clang_compiler={clang}'.format(clang=clang_path), 'infer.clang_compiler={clang}'.format(clang=clang_path),
'--config', '--config',
'infer.clang_plugin={plugin}'.format(plugin=plugin_path), 'infer.clang_plugin={plugin}'.format(plugin=plugin_path),
] ] + self.args.Xbuck
if self.args.xcode_developer_dir is not None: if self.args.xcode_developer_dir is not None:
args.append('--config') args.append('--config')
args.append('apple.xcode_developer_dir={devdir}'.format( args.append('apple.xcode_developer_dir={devdir}'.format(

@ -526,6 +526,10 @@ and buck =
CLOpt.mk_bool ~long:"buck" CLOpt.mk_bool ~long:"buck"
"To use when run with buck" "To use when run with buck"
and buck_build_args =
CLOpt.mk_string_list ~long:"Xbuck"
"Pass values as command-line arguments to invocations of `buck build`"
and buck_out = and buck_out =
CLOpt.mk_string_opt ~long:"buck-out" CLOpt.mk_string_opt ~long:"buck-out"
~exes:CLOpt.[StatsAggregator] ~meta:"dir" "Specify the root directory of buck-out" ~exes:CLOpt.[StatsAggregator] ~meta:"dir" "Specify the root directory of buck-out"
@ -1293,6 +1297,7 @@ and array_level = !array_level
and ast_file = !ast_file and ast_file = !ast_file
and blacklist = !blacklist and blacklist = !blacklist
and buck = !buck and buck = !buck
and buck_build_args = !buck_build_args
and buck_out = !buck_out and buck_out = !buck_out
and bugs_csv = !bugs_csv and bugs_csv = !bugs_csv
and bugs_json = !bugs_json and bugs_json = !bugs_json

@ -136,6 +136,7 @@ val array_level : int
val ast_file : string option val ast_file : string option
val blacklist : string option val blacklist : string option
val buck : bool val buck : bool
val buck_build_args : string list
val buck_out : string option val buck_out : string option
val bugs_csv : outfile option val bugs_csv : outfile option
val bugs_json : outfile option val bugs_json : outfile option

@ -57,6 +57,10 @@ let () =
["--android-harness"]) @ ["--android-harness"]) @
(if not Config.buck then [] else (if not Config.buck then [] else
["--buck"]) @ ["--buck"]) @
(match IList.rev Config.buck_build_args with
| args when buck ->
IList.map (fun arg -> ["--Xbuck"; "'" ^ arg ^ "'"]) args |> IList.flatten
| _ -> []) @
(if not Config.debug_mode then [] else (if not Config.debug_mode then [] else
["--debug"]) @ ["--debug"]) @
(if not Config.debug_exceptions then [] else (if not Config.debug_exceptions then [] else

Loading…
Cancel
Save