@ -38,7 +38,7 @@ let rec rmtree name =
type build_mode =
type build_mode =
| Analyze | Ant | Buck | ClangCompilationDatabase | Gradle | Java | Javac | Make | Mvn | Ndk
| Analyze | Ant | Buck | Gradle | Java | Javac | Make | Mvn | Ndk
| Xcode | Genrule
| Xcode | Genrule
let build_mode_of_string path =
let build_mode_of_string path =
@ -46,7 +46,6 @@ let build_mode_of_string path =
| " analyze " -> Analyze
| " analyze " -> Analyze
| " ant " -> Ant
| " ant " -> Ant
| " buck " -> Buck
| " buck " -> Buck
| " clang-compilation-database " -> ClangCompilationDatabase
| " genrule " -> Genrule
| " genrule " -> Genrule
| " gradle " | " gradlew " -> Gradle
| " gradle " | " gradlew " -> Gradle
| " java " -> Java
| " java " -> Java
@ -61,7 +60,6 @@ let string_of_build_mode = function
| Analyze -> " analyze "
| Analyze -> " analyze "
| Ant -> " ant "
| Ant -> " ant "
| Buck -> " buck "
| Buck -> " buck "
| ClangCompilationDatabase -> " clang-compilation-database "
| Genrule -> " genrule "
| Genrule -> " genrule "
| Gradle -> " gradle "
| Gradle -> " gradle "
| Java -> " java "
| Java -> " java "
@ -151,21 +149,12 @@ let capture_with_compilation_database db_files =
CaptureCompilationDatabase . capture_files_in_database compilation_database
CaptureCompilationDatabase . capture_files_in_database compilation_database
let capture build_cmd = function
let capture build_cmd = function
| Analyze ->
| Analyze when not ( List . is_empty ! Config . clang_compilation_db_files ) ->
()
capture_with_compilation_database ! Config . clang_compilation_db_files
| Buck when Config . use_compilation_database < > None ->
| Buck when Config . use_compilation_database < > None ->
L . stdout " Capturing using Buck's compilation database...@ \n " ;
L . stdout " Capturing using Buck's compilation database...@ \n " ;
let json_cdb = CaptureCompilationDatabase . get_compilation_database_files_buck () in
let json_cdb = CaptureCompilationDatabase . get_compilation_database_files_buck () in
capture_with_compilation_database json_cdb
capture_with_compilation_database json_cdb
| ClangCompilationDatabase ->
L . stdout " Capturing using a compilation database file...@ \n " ;
let cmd_args = List . tl build_cmd | > Option . value ~ default : [] in
if List . is_empty cmd_args then (
failwith
" Error parsing arguments. Please, pass the compilation database json file as in \
infer - - clang - compilation - database file . json . " ;
Config . print_usage_exit () ) ;
capture_with_compilation_database cmd_args
| Genrule ->
| Genrule ->
L . stdout " Capturing for Buck genrule compatibility...@ \n " ;
L . stdout " Capturing for Buck genrule compatibility...@ \n " ;
let infer_java = Config . bin_dir ^/ " InferJava " in
let infer_java = Config . bin_dir ^/ " InferJava " in
@ -282,7 +271,7 @@ let analyze = function
| Java | Javac ->
| Java | Javac ->
(* In Java and Javac modes, analysis is invoked from capture. *)
(* In Java and Javac modes, analysis is invoked from capture. *)
()
()
| Analyze | Ant | Buck | ClangCompilationDatabase | Gradle | Genrule | Make | Mvn | Ndk | Xcode ->
| Analyze | Ant | Buck | Gradle | Genrule | Make | Mvn | Ndk | Xcode ->
if ( Sys . file_exists Config . ( results_dir ^/ captured_dir_name ) ) < > ` Yes then (
if ( Sys . file_exists Config . ( results_dir ^/ captured_dir_name ) ) < > ` Yes then (
L . stderr " There was nothing to analyze, exiting " ;
L . stderr " There was nothing to analyze, exiting " ;
Config . print_usage_exit ()
Config . print_usage_exit ()