Print dependencies at the end.

This introduces a tiny change of behavior since command line options which affect the
printing of dependencies (-modules, -all, -ml-synonym, -mlfi-synonym) are taken into
account even for files mentioned before on the command-line.  This is probably not going to break
anything.

Note: this commit also reverse the ordering of the output, but we will normalize it in the next
commit anyway.
master
alainfrisch 2016-02-01 18:58:28 +01:00
parent 2261e4413d
commit 1ef3f35c02
1 changed files with 5 additions and 6 deletions

View File

@ -339,7 +339,7 @@ let print_mli_dependencies source_file extracted_deps =
extracted_deps ([], []) in extracted_deps ([], []) in
print_dependencies [basename ^ ".cmi"] byt_deps print_dependencies [basename ^ ".cmi"] byt_deps
let print_dependencies (source_file, kind, extracted_deps) = let print_file_dependencies (source_file, kind, extracted_deps) =
if !raw_dependencies then begin if !raw_dependencies then begin
print_raw_dependencies source_file extracted_deps print_raw_dependencies source_file extracted_deps
end else end else
@ -362,8 +362,7 @@ let ml_file_dependencies source_file =
Config.ast_impl_magic_number source_file Config.ast_impl_magic_number source_file
in in
let r = (source_file, ML, extracted_deps) in let r = (source_file, ML, extracted_deps) in
if !sort_files then files := r :: !files files := r :: !files
else print_dependencies r
let mli_file_dependencies source_file = let mli_file_dependencies source_file =
let (extracted_deps, ()) = let (extracted_deps, ()) =
@ -371,8 +370,7 @@ let mli_file_dependencies source_file =
Config.ast_intf_magic_number source_file Config.ast_intf_magic_number source_file
in in
let r = (source_file, MLI, extracted_deps) in let r = (source_file, MLI, extracted_deps) in
if !sort_files then files := r :: !files files := r :: !files
else print_dependencies r
let process_file_as process_fun def source_file = let process_file_as process_fun def source_file =
Compenv.readenv ppf (Before_compile source_file); Compenv.readenv ppf (Before_compile source_file);
@ -594,5 +592,6 @@ let _ =
" Print version number and exit"; " Print version number and exit";
] file_dependencies usage; ] file_dependencies usage;
Compenv.readenv ppf Before_link; Compenv.readenv ppf Before_link;
if !sort_files then sort_files_by_dependencies !files; if !sort_files then sort_files_by_dependencies !files
else List.iter print_file_dependencies !files;
exit (if !error_occurred then 2 else 0) exit (if !error_occurred then 2 else 0)