Allow relative or absolute names in ondemand_file

Summary:public
Allow the value of the INFER_ONDEMAND_FILE environment variable to be
either an absolute path, or relative to the project root.

Likewise, allow the entries in the file determined by
INFER_ONDEMAND_FILE to be either absolute or relative to the project
root.  Note, however, that if they are absolute but not under the
project root, they will not be found.

Reviewed By: cristianoc

Differential Revision: D3098489

fb-gh-sync-id: e861300
fbshipit-source-id: e861300
master
Josh Berdine 9 years ago committed by Facebook Github Bot 8
parent bc5dc80df6
commit 97bc95e8c9

@ -23,14 +23,15 @@ let read_dirs_to_analyze () =
| None ->
None
| Some fname ->
read_file fname in
read_file (DB.source_file_to_abs_path (DB.source_file_from_string fname)) in
match lines_opt with
| None ->
None
| Some lines ->
let res = ref StringSet.empty in
let do_line line =
let source_dir = DB.source_dir_from_source_file (DB.source_file_from_string line) in
let rel_file = DB.source_file_to_rel_path (DB.source_file_from_string line) in
let source_dir = DB.source_dir_from_source_file (DB.source_file_from_string rel_file) in
res := StringSet.add (DB.source_dir_to_string source_dir) !res in
IList.iter do_line lines;
Some !res

Loading…
Cancel
Save