[infer][java] make sure the analysis does not default to absolute path on Buck projects

Summary: Prevent the analysis to default to absolute paths which would invalidate the cache.

Reviewed By: mbouaziz

Differential Revision: D6997490

fbshipit-source-id: 3c17658
master
Jeremy Dubreil 7 years ago committed by Facebook Github Bot
parent 9e0ed1c489
commit a4531b6fa0

@ -59,8 +59,7 @@ let from_abs_path ?(warn_on_error= true) fname =
| Some path -> | Some path ->
RelativeProjectRoot path RelativeProjectRoot path
| None when Config.buck_cache_mode && Filename.check_suffix fname_real "java" -> | None when Config.buck_cache_mode && Filename.check_suffix fname_real "java" ->
L.internal_error "%s is not relative to %s" fname_real project_root_real ; L.(die InternalError) "%s is not relative to %s" fname_real project_root_real
Invalid "absolute path"
| None -> | None ->
match Utils.filename_to_relative ~root:models_dir_real fname_real with match Utils.filename_to_relative ~root:models_dir_real fname_real with
| Some path -> | Some path ->

@ -94,7 +94,7 @@ let do_all_files classpath sources classes =
~f:(fun pattern -> Str.string_match (Str.regexp pattern) path 0) ~f:(fun pattern -> Str.string_match (Str.regexp pattern) path 0)
Config.skip_analysis_in_path Config.skip_analysis_in_path
in in
SourceFile.is_invalid source_file || is_path_matching (SourceFile.to_rel_path source_file) is_path_matching (SourceFile.to_rel_path source_file)
|| Inferconfig.skip_translation_matcher source_file Typ.Procname.empty_block || Inferconfig.skip_translation_matcher source_file Typ.Procname.empty_block
in in
let translate_source_file basename (package_opt, _) source_file = let translate_source_file basename (package_opt, _) source_file =

Loading…
Cancel
Save