Skip compilation of certain source files, if desired

Summary:
All files that match the regular-expressions passed via `--skip-analysis-in-path` are just compiled.
With this change, you can also opt for not compiling those files at all, by passing the `--skip-analysis-in-path-skips-compilation` argument

Reviewed By: mbouaziz

Differential Revision: D5121583

fbshipit-source-id: 4e1325a
master
Martino Luca 8 years ago committed by Facebook Github Bot
parent 71f20908a1
commit d5fbb298eb

@ -1348,6 +1348,12 @@ and skip_analysis_in_path =
~meta:"path prefix OCaml regex" ~meta:"path prefix OCaml regex"
"Ignore files whose path matches the given prefix (can be specified multiple times)" "Ignore files whose path matches the given prefix (can be specified multiple times)"
and skip_analysis_in_path_skips_compilation =
CLOpt.mk_bool ~long:"skip-analysis-in-path-skips-compilation"
~in_help:CLOpt.[Report, manual_generic]
~default:false
"Whether paths in --skip-analysis-in-path should be compiled or not"
and skip_duplicated_types = and skip_duplicated_types =
CLOpt.mk_bool ~long:"skip-duplicated-types" ~default:true CLOpt.mk_bool ~long:"skip-duplicated-types" ~default:true
~in_help:CLOpt.[ReportDiff, manual_generic] ~in_help:CLOpt.[ReportDiff, manual_generic]
@ -1851,6 +1857,7 @@ and show_progress_bar = !progress_bar
and siof = !siof and siof = !siof
and siof_safe_methods = !siof_safe_methods and siof_safe_methods = !siof_safe_methods
and skip_analysis_in_path = !skip_analysis_in_path and skip_analysis_in_path = !skip_analysis_in_path
and skip_analysis_in_path_skips_compilation = !skip_analysis_in_path_skips_compilation
and skip_duplicated_types = !skip_duplicated_types and skip_duplicated_types = !skip_duplicated_types
and skip_translation_headers = !skip_translation_headers and skip_translation_headers = !skip_translation_headers
and sources = !sources and sources = !sources

@ -321,6 +321,7 @@ val show_progress_bar : bool
val siof : bool val siof : bool
val siof_safe_methods : string list val siof_safe_methods : string list
val skip_analysis_in_path : string list val skip_analysis_in_path : string list
val skip_analysis_in_path_skips_compilation : bool
val skip_duplicated_types : bool val skip_duplicated_types : bool
val skip_translation_headers : string list val skip_translation_headers : string list
val spec_abs_level : int val spec_abs_level : int

@ -166,11 +166,16 @@ let cc1_capture clang_cmd => {
Logging.out "@\n*** Beginning capture of file %s ***@\n" source_path; Logging.out "@\n*** Beginning capture of file %s ***@\n" source_path;
if ( if (
Config.equal_analyzer Config.analyzer Config.CompileOnly || Config.equal_analyzer Config.analyzer Config.CompileOnly ||
CLocation.is_file_blacklisted source_path not Config.skip_analysis_in_path_skips_compilation && CLocation.is_file_blacklisted source_path
) { ) {
Logging.out "@\n Skip the analysis of source file %s@\n@\n" source_path; Logging.out "@\n Skip the analysis of source file %s@\n@\n" source_path;
/* We still need to run clang, but we don't have to attach the plugin. */ /* We still need to run clang, but we don't have to attach the plugin. */
run_clang (ClangCommand.command_to_run clang_cmd) Utils.consume_in run_clang (ClangCommand.command_to_run clang_cmd) Utils.consume_in
} else if (
Config.skip_analysis_in_path_skips_compilation && CLocation.is_file_blacklisted source_path
) {
Logging.out "@\n Skip compilation and analysis of source file %s@\n@\n" source_path;
()
} else { } else {
switch Config.clang_biniou_file { switch Config.clang_biniou_file {
| Some fname => run_and_validate_clang_frontend (`File fname) | Some fname => run_and_validate_clang_frontend (`File fname)

Loading…
Cancel
Save