[java] Add support for blacklisting in capture mode for Javac

Reviewed By: jvillard

Differential Revision: D9633683

fbshipit-source-id: 933ee9fe4
master
Ezgi Çiçek 6 years ago committed by Facebook Github Bot
parent 882285a44e
commit 50e6d491ca

@ -815,14 +815,6 @@ and array_level =
|}
and blacklist =
CLOpt.mk_string_opt
~deprecated:["-blacklist-regex"; "-blacklist"]
~long:"buck-blacklist"
~in_help:InferCommand.[(Run, manual_buck_flavors); (Capture, manual_buck_flavors)]
~meta:"regex" "Skip analysis of files matched by the specified regular expression"
and bo_relational_domain =
CLOpt.mk_symbol_opt ~long:"bo-relational-domain"
~in_help:InferCommand.[(Analyze, manual_buffer_overrun)]
@ -839,6 +831,16 @@ and bootclasspath =
(** Automatically set when running from within Buck *)
and buck = CLOpt.mk_bool ~long:"buck" ""
and buck_blacklist =
CLOpt.mk_string_opt
~deprecated:["-blacklist-regex"; "-blacklist"]
~long:"buck-blacklist"
~in_help:InferCommand.[(Run, manual_buck_flavors); (Capture, manual_buck_flavors)]
~meta:"regex"
"Skip capture of files matched by the specified regular expression (only the \"flavors \
(C++)\" Buck integration is supported, not Java)."
and buck_build_args =
CLOpt.mk_string_list ~long:"Xbuck"
~in_help:InferCommand.[(Capture, manual_buck_flavors)]
@ -878,6 +880,14 @@ and capture =
"capture and translate source files into infer's intermediate language for analysis"
and capture_blacklist =
CLOpt.mk_string_opt ~long:"capture-blacklist"
~in_help:InferCommand.[(Run, manual_buck_flavors); (Capture, manual_buck_flavors)]
~meta:"regex"
"Skip capture of files matched by the specified OCaml regular expression (only supported by \
the javac integration for now)."
and changed_files_index =
CLOpt.mk_path_opt ~long:"changed-files-index"
~in_help:InferCommand.[(Analyze, manual_generic); (Diff, manual_generic)]
@ -2472,8 +2482,6 @@ and array_level = !array_level
and biabduction = !biabduction
and blacklist = !blacklist
and bootclasspath = !bootclasspath
and bo_debug = !bo_debug
@ -2482,6 +2490,8 @@ and bo_relational_domain = !bo_relational_domain
and buck = !buck
and buck_blacklist = !buck_blacklist
and buck_build_args = !buck_build_args
and buck_build_args_no_inline = !buck_build_args_no_inline
@ -2513,6 +2523,8 @@ and capture =
!capture
and capture_blacklist = !capture_blacklist
and changed_files_index = !changed_files_index
and check_nullable = !check_nullable

@ -236,8 +236,6 @@ val array_level : int
val biabduction : bool
val blacklist : string option
val bootclasspath : string option
val bo_debug : int
@ -246,6 +244,8 @@ val bo_relational_domain : [`Bo_relational_domain_oct | `Bo_relational_domain_po
val buck : bool
val buck_blacklist : string option
val buck_build_args : string list
val buck_build_args_no_inline : string list
@ -260,6 +260,8 @@ val bufferoverrun : bool
val capture : bool
val capture_blacklist : string option
val captured_dir : string
(** directory where the results of the capture phase are stored *)

@ -225,7 +225,7 @@ let capture ~changed_files = function
let infer_py = Config.lib_dir ^/ "python" ^/ "infer.py" in
let args =
List.rev_append Config.anon_args
( ( match Config.blacklist with
( ( match Config.buck_blacklist with
| Some s when in_buck_mode ->
["--blacklist-regex"; s]
| _ ->

@ -84,6 +84,12 @@ let compile compiler build_prog build_args =
let capture compiler ~prog ~args =
let verbose_out_file = compile compiler prog args in
if Config.analyzer <> Config.CompileOnly then JMain.from_verbose_out verbose_out_file ;
if not Config.debug_mode then Unix.unlink verbose_out_file
match (compiler, Config.capture_blacklist) with
| Javac, Some blacklist
when let re = Str.regexp blacklist in
List.exists ~f:(fun arg -> Str.string_match re arg 0) args ->
()
| _ ->
let verbose_out_file = compile compiler prog args in
if Config.analyzer <> Config.CompileOnly then JMain.from_verbose_out verbose_out_file ;
if not Config.debug_mode then Unix.unlink verbose_out_file

Loading…
Cancel
Save