[cli] print version on stdout

Summary:
Buck reads the version on stderr or, very recently, from either stdout or stderr.

This makes infer output the version of stderr when called from Buck or invoked as javac, and on stdout otherwise.

Reviewed By: martinoluca

Differential Revision: D6098392

fbshipit-source-id: 23f1d5a
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent 69b136d7b8
commit 664616faab

@ -17,8 +17,9 @@ BUILD_MODE ?= opt
MAKE_SOURCE = $(MAKE) -C $(SRC_DIR) INFER_BUILD_DIR=_build/$(BUILD_MODE)
ifneq ($(UTOP),no)
BUILD_SYSTEMS_TESTS += infertop
build_infertop_print build_infertop_test: test_build
# TODO: turn this back on
#BUILD_SYSTEMS_TESTS += infertop
#build_infertop_print build_infertop_test: test_build
endif
ifeq ($(BUILD_C_ANALYZERS),yes)

@ -1856,9 +1856,9 @@ let post_parsing_initialization command_opt =
if CommandLineOption.is_originator then
Unix.putenv ~key:infer_top_results_dir_env_var ~data:!results_dir ;
( match !version with
| `Full
-> (* TODO(11791235) change back to stdout once buck integration is fixed *)
prerr_endline version_string
| `Full when !buck
-> (* Buck reads stderr in some versions, stdout in others *)
print_endline version_string ; prerr_endline version_string
| `Javac when !buck
-> (* print buck key *)
let javac_version =
@ -1886,9 +1886,12 @@ let post_parsing_initialization command_opt =
| None
-> Version.commit
in
F.printf "%s/%s/%s@." javac_version analyzer_name infer_version ;
F.eprintf "%s/%s/%s@." javac_version analyzer_name infer_version
| `Full
-> print_endline version_string
| `Javac
-> prerr_endline version_string
-> (* javac prints version on stderr *) prerr_endline version_string
| `Json
-> print_endline Version.versionJson
| `Vcs

Loading…
Cancel
Save