Single entry point to print deps.

master
alainfrisch 2016-02-01 18:55:47 +01:00
parent 4aea2c1903
commit 2261e4413d
1 changed files with 39 additions and 40 deletions

View File

@ -310,42 +310,43 @@ let read_parse_and_extract parse_function extract_function def magic
end
let print_ml_dependencies source_file extracted_deps =
if !raw_dependencies then begin
print_raw_dependencies source_file extracted_deps
end else begin
let basename = Filename.chop_extension source_file in
let byte_targets = [ basename ^ ".cmo" ] in
let native_targets =
if !all_dependencies
then [ basename ^ ".cmx"; basename ^ ".o" ]
else [ basename ^ ".cmx" ] in
let init_deps = if !all_dependencies then [source_file] else [] in
let cmi_name = basename ^ ".cmi" in
let init_deps, extra_targets =
if List.exists (fun ext -> Sys.file_exists (basename ^ ext))
!mli_synonyms
then (cmi_name :: init_deps, cmi_name :: init_deps), []
else (init_deps, init_deps),
(if !all_dependencies then [cmi_name] else [])
in
let (byt_deps, native_deps) =
Depend.StringSet.fold (find_dependency ML)
extracted_deps init_deps in
if not !native_only then
print_dependencies (byte_targets @ extra_targets) byt_deps;
print_dependencies (native_targets @ extra_targets) native_deps;
end
let basename = Filename.chop_extension source_file in
let byte_targets = [ basename ^ ".cmo" ] in
let native_targets =
if !all_dependencies
then [ basename ^ ".cmx"; basename ^ ".o" ]
else [ basename ^ ".cmx" ] in
let init_deps = if !all_dependencies then [source_file] else [] in
let cmi_name = basename ^ ".cmi" in
let init_deps, extra_targets =
if List.exists (fun ext -> Sys.file_exists (basename ^ ext))
!mli_synonyms
then (cmi_name :: init_deps, cmi_name :: init_deps), []
else (init_deps, init_deps),
(if !all_dependencies then [cmi_name] else [])
in
let (byt_deps, native_deps) =
Depend.StringSet.fold (find_dependency ML)
extracted_deps init_deps in
if not !native_only then
print_dependencies (byte_targets @ extra_targets) byt_deps;
print_dependencies (native_targets @ extra_targets) native_deps
let print_mli_dependencies source_file extracted_deps =
let basename = Filename.chop_extension source_file in
let (byt_deps, _opt_deps) =
Depend.StringSet.fold (find_dependency MLI)
extracted_deps ([], []) in
print_dependencies [basename ^ ".cmi"] byt_deps
let print_dependencies (source_file, kind, extracted_deps) =
if !raw_dependencies then begin
print_raw_dependencies source_file extracted_deps
end else begin
let basename = Filename.chop_extension source_file in
let (byt_deps, _opt_deps) =
Depend.StringSet.fold (find_dependency MLI)
extracted_deps ([], []) in
print_dependencies [basename ^ ".cmi"] byt_deps
end
end else
match kind with
| ML -> print_ml_dependencies source_file extracted_deps
| MLI -> print_mli_dependencies source_file extracted_deps
let ml_file_dependencies source_file =
let parse_use_file_as_impl lexbuf =
@ -360,20 +361,18 @@ let ml_file_dependencies source_file =
read_parse_and_extract parse_use_file_as_impl Depend.add_implementation ()
Config.ast_impl_magic_number source_file
in
if !sort_files then
files := (source_file, ML, extracted_deps) :: !files
else
print_ml_dependencies source_file extracted_deps
let r = (source_file, ML, extracted_deps) in
if !sort_files then files := r :: !files
else print_dependencies r
let mli_file_dependencies source_file =
let (extracted_deps, ()) =
read_parse_and_extract Parse.interface Depend.add_signature ()
Config.ast_intf_magic_number source_file
in
if !sort_files then
files := (source_file, MLI, extracted_deps) :: !files
else
print_mli_dependencies source_file extracted_deps
let r = (source_file, MLI, extracted_deps) in
if !sort_files then files := r :: !files
else print_dependencies r
let process_file_as process_fun def source_file =
Compenv.readenv ppf (Before_compile source_file);