[refactor] Separate InferPrint initialization code into separate Exe module

Reviewed By: jvillard

Differential Revision: D4114511

fbshipit-source-id: cdcf177
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent bf40ff99e7
commit e9654ca51d

@ -77,7 +77,7 @@ INFERPRINT_ATDGEN_STUB_BASE = backend/jsonbug
INFERPRINT_ATDGEN_STUB_ATD = $(INFERPRINT_ATDGEN_STUB_BASE).atd
INFERPRINT_ATDGEN_STUBS = $(addprefix $(INFERPRINT_ATDGEN_STUB_BASE), $(ATDGEN_SUFFIXES))
INFERPRINT_MAIN = backend/InferPrint
INFERPRINT_MAIN = backend/InferPrintExe
### InferUnit declarations ###
@ -251,7 +251,7 @@ rei:
%.rei : %.mli
refmt -assume-explicit-arity -heuristics-file unary.txt -parse ml -print re $< > $*.rei
roots:=Infer InferAnalyze InferClang JMain InferPrint BuckCompilationDatabase
roots:=Infer InferAnalyze InferClang JMain InferPrintExe BuckCompilationDatabase
clusters:=base clang java IR
src_dirs:=$(shell find * -type d)

@ -740,19 +740,6 @@ let module IssuesXml = {
let module CallsCsv = {
/** Print the header of the calls csv file, with column names */
let pp_header fmt () =>
Format.fprintf
fmt
"%s,%s,%s,%s,%s,%s,%s@\n"
Io_infer.Xml.tag_caller
Io_infer.Xml.tag_caller_id
Io_infer.Xml.tag_callee
Io_infer.Xml.tag_callee_id
Io_infer.Xml.tag_file
Io_infer.Xml.tag_line
Io_infer.Xml.tag_call_trace;
/** Write proc summary stats in csv format */
let pp_calls fmt summary => {
let pp x => F.fprintf fmt x;
@ -1082,8 +1069,6 @@ type bug_format_kind =
| Xml
| Latex;
type bug_format = (bug_format_kind, outfile);
let pp_issues_in_format (format_kind, outf) =>
switch format_kind {
| Json => IssuesJson.pp_issues_of_error_log outf.fmt
@ -1371,9 +1356,9 @@ let register_perf_stats_report () => {
let mk_format format_kind fname =>
Option.map_default (fun out_file => [(format_kind, out_file)]) [] (create_outfile fname);
let init_issues_format_list () => {
let csv_format = Option.map_default (mk_format Csv) [] Config.bugs_csv;
let json_format = Option.map_default (mk_format Json) [] Config.bugs_json;
let init_issues_format_list report_csv report_json => {
let csv_format = Option.map_default (mk_format Csv) [] report_csv;
let json_format = Option.map_default (mk_format Json) [] report_json;
let tests_format = Option.map_default (mk_format Tests) [] Config.bugs_tests;
let txt_format = Option.map_default (mk_format Text) [] Config.bugs_txt;
let xml_format = Option.map_default (mk_format Xml) [] Config.bugs_xml;
@ -1471,9 +1456,9 @@ let pp_summary_and_issues formats_by_report_kind => {
finalize_and_close_files formats_by_report_kind stats pdflatex
};
let () = {
let main report_csv::report_csv report_json::report_json => {
let formats_by_report_kind = [
(Issues, init_issues_format_list ()),
(Issues, init_issues_format_list report_csv report_json),
(Procs, init_procs_format_list ()),
(Calls, init_calls_format_list ()),
(Stats, init_stats_format_list ()),

@ -0,0 +1,11 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! Utils;
let main: report_csv::option string => report_json::option string => unit;

@ -0,0 +1,11 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! Utils;
let () = InferPrint.main report_csv::Config.bugs_csv report_json::Config.bugs_json;

@ -0,0 +1,9 @@
/*
* Copyright (c) 2016 - present Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
open! Utils;

@ -1081,7 +1081,7 @@ and progress_bar =
"Show a progress bar"
and quiet =
CLOpt.mk_bool ~long:"quiet" ~short:"q"
CLOpt.mk_bool ~long:"quiet" ~short:"q" ~default:(current_exe != CLOpt.Print)
~exes:CLOpt.[Print]
"Do not print specs on standard output"

Loading…
Cancel
Save