[CLI] deprecate `-a capture/compile` and `-- analyze`

Summary: This also allows us to better test that the new commands will keep working.

Reviewed By: jeremydubreil

Differential Revision: D5172891

fbshipit-source-id: 169bd6f
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 1727bd4125
commit 5fae8ca712

@ -26,7 +26,7 @@ class InferJavacCapture():
# pass --continue to prevent removing the results-dir # pass --continue to prevent removing the results-dir
cmd = [ cmd = [
infer, infer,
'--analyzer', 'capture', 'capture',
'--continue', '--continue',
'--', 'javac' '--', 'javac'
] + self.javac_args ] + self.javac_args

@ -456,6 +456,9 @@ let driver_mode_of_build_cmd build_cmd =
assert_supported_build_system build_system; assert_supported_build_system build_system;
match build_system_of_exe_name (Filename.basename prog) with match build_system_of_exe_name (Filename.basename prog) with
| BAnalyze -> | BAnalyze ->
CLOpt.warnf
"WARNING: `infer -- analyze` is deprecated; \
use the `infer analyze` subcommand instead@.";
Analyze Analyze
| BBuck when Option.is_some Config.buck_compilation_database -> | BBuck when Option.is_some Config.buck_compilation_database ->
BuckCompilationDB (prog, List.append args (List.rev Config.buck_build_args)) BuckCompilationDB (prog, List.append args (List.rev Config.buck_build_args))

@ -455,13 +455,13 @@ let mk_symbol ~default ~symbols ~eq ?(deprecated=[]) ~long ?short ?parse_mode ?i
~decode_json:(string_json_decoder ~long) ~decode_json:(string_json_decoder ~long)
~mk_spec:(fun set -> Symbol (strings, set)) ~mk_spec:(fun set -> Symbol (strings, set))
let mk_symbol_opt ~symbols ?(deprecated=[]) ~long ?short ?parse_mode ?in_help ?meta doc = let mk_symbol_opt ~symbols ?(f=Fn.id) ?(deprecated=[]) ~long ?short ?parse_mode ?in_help ?meta doc =
let strings = List.map ~f:fst symbols in let strings = List.map ~f:fst symbols in
let of_string str = List.Assoc.find_exn ~equal:String.equal symbols str in let of_string str = List.Assoc.find_exn ~equal:String.equal symbols str in
let meta = Option.value meta ~default:(mk_symbols_meta symbols) in let meta = Option.value meta ~default:(mk_symbols_meta symbols) in
mk ~deprecated ~long ?short ~default:None ?parse_mode ?in_help ~meta doc mk ~deprecated ~long ?short ~default:None ?parse_mode ?in_help ~meta doc
~default_to_string:(fun _ -> "") ~default_to_string:(fun _ -> "")
~mk_setter:(fun var str -> var := Some (of_string str)) ~mk_setter:(fun var str -> var := Some (f (of_string str)))
~decode_json:(string_json_decoder ~long) ~decode_json:(string_json_decoder ~long)
~mk_spec:(fun set -> Symbol (strings, set)) ~mk_spec:(fun set -> Symbol (strings, set))
@ -705,7 +705,7 @@ let encode_argv_to_env argv =
(List.filter ~f:(fun arg -> (List.filter ~f:(fun arg ->
not (String.contains arg env_var_sep) not (String.contains arg env_var_sep)
|| ( || (
warnf "Ignoring unsupported option containing '%c' character: %s@\n" warnf "WARNING: Ignoring unsupported option containing '%c' character: %s@\n"
env_var_sep arg ; env_var_sep arg ;
false false
) )

@ -120,7 +120,7 @@ val mk_path_list : ?default:string list -> string list ref t
val mk_symbol : default:'a -> symbols:(string * 'a) list -> eq:('a -> 'a -> bool) -> 'a ref t val mk_symbol : default:'a -> symbols:(string * 'a) list -> eq:('a -> 'a -> bool) -> 'a ref t
(** [mk_symbol_opt] is similar to [mk_symbol] but defaults to [None]. *) (** [mk_symbol_opt] is similar to [mk_symbol] but defaults to [None]. *)
val mk_symbol_opt : symbols:(string * 'a) list -> 'a option ref t val mk_symbol_opt : symbols:(string * 'a) list -> ?f:('a -> 'a) -> 'a option ref t
(** [mk_symbol_seq long symbols] defines a command line flag [--long <symbol sequence>] where (** [mk_symbol_seq long symbols] defines a command line flag [--long <symbol sequence>] where
[<symbol sequence>] is a comma-separated sequence of [<symbol>]s such that [(<symbol>,_)] is an [<symbol sequence>] is a comma-separated sequence of [<symbol>]s such that [(<symbol>,_)] is an

@ -498,6 +498,15 @@ and analyzer =
- $(b,crashcontext): experimental (see $(b,--crashcontext))\n\ - $(b,crashcontext): experimental (see $(b,--crashcontext))\n\
- $(b,linters): run linters based on the ast only (Objective-C and Objective-C++ only, \ - $(b,linters): run linters based on the ast only (Objective-C and Objective-C++ only, \
activated by default)" activated by default)"
~f:(function
| CaptureOnly | CompileOnly as x ->
let analyzer_str = List.find_map_exn string_to_analyzer
~f:(fun (s, y) -> if equal_analyzer x y then Some s else None) in
CLOpt.warnf
"WARNING: The analyzer '%s' is deprecated, use the '%s' subcommand instead:@\n\
@\n infer %s ..." analyzer_str analyzer_str analyzer_str;
x
| _ as x -> x)
~symbols:string_to_analyzer ~symbols:string_to_analyzer
and android_harness = and android_harness =

@ -24,7 +24,7 @@ CLEAN_EXTRA = $(DOT_FILES) $(foreach source,$(SOURCES),infer-out-$(basename $(no
include $(TESTS_DIR)/clang-frontend.make include $(TESTS_DIR)/clang-frontend.make
INFER_OPTIONS = -a capture --frontend-tests --skip-translation-headers exclude_dir --no-failures-allowed INFER_OPTIONS = capture --frontend-tests --skip-translation-headers exclude_dir --no-failures-allowed
capture: $(DOT_FILES) capture: $(DOT_FILES)

@ -35,7 +35,7 @@ infer-out/report.json: $(SOURCES) $(CMAKE_DIR)/CMakeLists.txt $(CLANG_DEPS)
$(QUIET)$(MKDIR_P) $(CMAKE_ANALYZE_DIR) $(QUIET)$(MKDIR_P) $(CMAKE_ANALYZE_DIR)
$(QUIET)cd $(CMAKE_ANALYZE_DIR) && \ $(QUIET)cd $(CMAKE_ANALYZE_DIR) && \
$(call silent_on_success,Testing CMake integration: Generate Makefiles,\ $(call silent_on_success,Testing CMake integration: Generate Makefiles,\
$(INFER_BIN) -a compile $(INFER_OPTIONS) -- cmake ..) $(INFER_BIN) compile $(INFER_OPTIONS) -- cmake ..)
$(QUIET)$(call silent_on_success,Testing CMake integration: Run Makefiles,\ $(QUIET)$(call silent_on_success,Testing CMake integration: Run Makefiles,\
$(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -- $(MAKE) -C $(CMAKE_ANALYZE_DIR)) $(INFER_BIN) -a $(ANALYZER) $(INFER_OPTIONS) -- $(MAKE) -C $(CMAKE_ANALYZE_DIR))
# cmake makes all paths absolute # cmake makes all paths absolute

@ -22,14 +22,14 @@ include $(TESTS_DIR)/clang.make
infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(HEADERS) infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(HEADERS)
$(QUIET)$(call silent_on_success,Testing reactive mode: capture 1/3,\ $(QUIET)$(call silent_on_success,Testing reactive mode: capture 1/3,\
$(INFER_BIN) $(INFER_OPTIONS) -a capture -- \ $(INFER_BIN) $(INFER_OPTIONS) capture -- \
clang $(CLANG_OPTIONS) $(SOURCES1)) clang $(CLANG_OPTIONS) $(SOURCES1))
$(QUIET)$(call silent_on_success,Testing reactive mode: capture 2/3,\ $(QUIET)$(call silent_on_success,Testing reactive mode: capture 2/3,\
$(INFER_BIN) $(INFER_OPTIONS) -a capture --reactive --continue -- \ $(INFER_BIN) $(INFER_OPTIONS) capture --reactive --continue -- \
clang $(CLANG_OPTIONS) $(SOURCES2)) clang $(CLANG_OPTIONS) $(SOURCES2))
$(QUIET)$(call silent_on_success,Testing reactive mode: capture 3/3,\ $(QUIET)$(call silent_on_success,Testing reactive mode: capture 3/3,\
$(INFER_BIN) $(INFER_OPTIONS) -a capture --reactive --continue -- \ $(INFER_BIN) $(INFER_OPTIONS) capture --reactive --continue -- \
clang $(CLANG_OPTIONS) $(SOURCES3)) clang $(CLANG_OPTIONS) $(SOURCES3))
$(QUIET)$(call silent_on_success,Testing reactive mode: analysis,\ $(QUIET)$(call silent_on_success,Testing reactive mode: analysis,\
$(INFER_BIN) --dump-duplicate-symbols $(INFER_OPTIONS) -a $(ANALYZER) -- analyze) $(INFER_BIN) analyze --dump-duplicate-symbols $(INFER_OPTIONS) -a $(ANALYZER))
$(QUIET)$(call check_no_duplicates,infer-out/duplicates.txt) $(QUIET)$(call check_no_duplicates,infer-out/duplicates.txt)

@ -65,7 +65,7 @@ infer-out-cmake/report.json: $(CMAKE_DIR) $(CMAKE_SOURCES_DIR)/CMakeLists.txt $(
$(QUIET)cd $(CMAKE_ANALYZE_DIR) && \ $(QUIET)cd $(CMAKE_ANALYZE_DIR) && \
$(call silent_on_success,Testing\ $(call silent_on_success,Testing\
Infer/CMake is immune to UTF-8 in PWD: Makefile generation,\ Infer/CMake is immune to UTF-8 in PWD: Makefile generation,\
$(INFER_BIN) -a compile --project-root $(CMAKE_DIR) --results-dir $(CURDIR)/$(@D) -- cmake ..) $(INFER_BIN) compile --project-root $(CMAKE_DIR) --results-dir $(CURDIR)/$(@D) -- cmake ..)
$(QUIET)cd $(CMAKE_ANALYZE_DIR) && \ $(QUIET)cd $(CMAKE_ANALYZE_DIR) && \
$(call silent_on_success,Testing\ $(call silent_on_success,Testing\
Infer/CMake is immune to UTF-8 in PWD: Makefile execution,\ Infer/CMake is immune to UTF-8 in PWD: Makefile execution,\

@ -18,7 +18,7 @@ compile: $(OBJECTS)
$(ONE_SOURCE).test.dot: $(CLANG_DEPS) $(SOURCES) $(HEADERS) $(ONE_SOURCE).test.dot: $(CLANG_DEPS) $(SOURCES) $(HEADERS)
$(QUIET)$(call silent_on_success,Testing the infer/clang frontend in $(TEST_REL_DIR),\ $(QUIET)$(call silent_on_success,Testing the infer/clang frontend in $(TEST_REL_DIR),\
$(INFER_BIN) -a capture --frontend-tests --project-root $(TESTS_DIR) $(INFER_OPTIONS) -- \ $(INFER_BIN) capture --frontend-tests --project-root $(TESTS_DIR) $(INFER_OPTIONS) -- \
clang $(CLANG_OPTIONS) $(SOURCES)) clang $(CLANG_OPTIONS) $(SOURCES))
.PHONY: capture .PHONY: capture

Loading…
Cancel
Save