diff --git a/bin-saphe/logging.ml b/bin-saphe/logging.ml index 8358ed8c2..1bc962193 100644 --- a/bin-saphe/logging.ml +++ b/bin-saphe/logging.ml @@ -28,12 +28,16 @@ let show_package_dependency_solutions (solutions : package_solution list) = ) -let end_lock_config_output (file_name_out : abs_path) = - Printf.printf " lock config written on '%s'.\n" (get_abs_path_string file_name_out) +let end_lock_config_output (abspath_lock_config : abs_path) = + Printf.printf " lock config written on '%s'.\n" (get_abs_path_string abspath_lock_config) -let end_envelope_config_output (file_name_out : abs_path) = - Printf.printf " envelope config written on '%s'.\n" (get_abs_path_string file_name_out) +let end_envelope_config_output (abspath_envelope_config : abs_path) = + Printf.printf " envelope config written on '%s'.\n" (get_abs_path_string abspath_envelope_config) + + +let end_deps_config_output (abspath_deps_config : abs_path) = + Printf.printf " deps config written on '%s'.\n" (get_abs_path_string abspath_deps_config) let lock_already_installed (lock_name : lock_name) (absdir : abs_path) = diff --git a/bin-saphe/logging.mli b/bin-saphe/logging.mli index 98c0e59b6..ede4742f3 100644 --- a/bin-saphe/logging.mli +++ b/bin-saphe/logging.mli @@ -10,6 +10,8 @@ val end_lock_config_output : abs_path -> unit val end_envelope_config_output : abs_path -> unit +val end_deps_config_output : abs_path -> unit + val lock_already_installed : lock_name -> abs_path -> unit val lock_cache_exists : lock_name -> abs_path -> unit diff --git a/bin-saphe/main.ml b/bin-saphe/main.ml index 7d569a29d..eeba9ba39 100644 --- a/bin-saphe/main.ml +++ b/bin-saphe/main.ml @@ -704,34 +704,21 @@ let solve ~(fpath_in : string) = | Error(e) -> report_config_error e; exit 1 -type build_option = { - text_mode : string option; - page_number_limit : int; - show_full_path : bool; - debug_show_bbox : bool; - debug_show_space : bool; - debug_show_block_bbox : bool; - debug_show_block_space : bool; - debug_show_overfull : bool; - type_check_only : bool; - bytecomp : bool; -} - - type build_input = | PackageBuildInput of { root : abs_path; lock : abs_path; deps : abs_path; envelope : abs_path; - options : build_option; + options : SatysfiCommand.build_option; } | DocumentBuildInput of { + doc : abs_path; lock : abs_path; deps : abs_path; out : abs_path; dump : abs_path; - options : build_option; + options : SatysfiCommand.build_option; } @@ -783,8 +770,8 @@ let build (* Constructs the input: *) let build_input = - let build_option = - { + let options = + SatysfiCommand.{ text_mode = text_mode_formats_str_opt; page_number_limit; show_full_path; @@ -808,7 +795,7 @@ let build lock = abspath_lock_config; deps = abspath_deps_config; envelope = abspath_envelope_config; - options = build_option; + options; } else let abspath_lock_config = Constant.document_lock_config_path abspath_in in @@ -823,40 +810,59 @@ let build in let abspath_dump = Constant.dump_path abspath_in in DocumentBuildInput{ + doc = abspath_in; lock = abspath_lock_config; deps = abspath_deps_config; out = abspath_out; dump = abspath_dump; - options = build_option; + options; } in match build_input with | PackageBuildInput{ - root = _absdir_package; + root = absdir_package; lock = abspath_lock_config; deps = abspath_deps_config; - envelope = _abspath_envelope_config; - options = _build_option; + envelope = abspath_envelope_config; + options; } -> let* lock_config = LockConfig.load abspath_lock_config in let deps_config = make_deps_config lock_config in - let* () = DepsConfig.write abspath_deps_config deps_config in - failwith "TODO: PackageBuildInput" + Logging.end_deps_config_output abspath_deps_config; + + SatysfiCommand.(build + ~input:(PackageInput{ + root = absdir_package; + envelope = abspath_envelope_config; + }) + ~deps:abspath_deps_config + ~options); + return () | DocumentBuildInput{ - lock = abspath_lock_config; - deps = abspath_deps_config; - out = _abspath_out; - dump = _abspath_dump; - options = _build_option; + doc = abspath_doc; + lock = abspath_lock_config; + deps = abspath_deps_config; + out = abspath_out; + dump = abspath_dump; + options; } -> let* lock_config = LockConfig.load abspath_lock_config in let deps_config = make_deps_config lock_config in - let* () = DepsConfig.write abspath_deps_config deps_config in - failwith "TODO: DocumentBuildInput" + Logging.end_deps_config_output abspath_deps_config; + + SatysfiCommand.(build + ~input:(DocumentInput{ + doc = abspath_doc; + out = abspath_out; + dump = abspath_dump; + }) + ~deps:abspath_deps_config + ~options); + return () in match res with | Ok(()) -> () diff --git a/bin-saphe/satysfiCommand.ml b/bin-saphe/satysfiCommand.ml new file mode 100644 index 000000000..6f0f9d241 --- /dev/null +++ b/bin-saphe/satysfiCommand.ml @@ -0,0 +1,35 @@ + +open MyUtil + + +type build_option = { + text_mode : string option; + page_number_limit : int; + show_full_path : bool; + debug_show_bbox : bool; + debug_show_space : bool; + debug_show_block_bbox : bool; + debug_show_block_space : bool; + debug_show_overfull : bool; + type_check_only : bool; + bytecomp : bool; +} + +type input = + | PackageInput of { + root : abs_path; + envelope : abs_path; + } + | DocumentInput of { + doc : abs_path; + out : abs_path; + dump : abs_path; + } + + +let build + ~input:(_ : input) + ~deps:(_abspath_deps_config : abs_path) + ~options:(_ : build_option) : unit += + failwith "TODO: SatysfiCommand.build"