Skip to content

Commit

Permalink
develop saphe build
Browse files Browse the repository at this point in the history
  • Loading branch information
gfngfn committed Jan 2, 2024
1 parent 91aa482 commit 8f08114
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 36 deletions.
12 changes: 8 additions & 4 deletions bin-saphe/logging.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down
2 changes: 2 additions & 0 deletions bin-saphe/logging.mli
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
70 changes: 38 additions & 32 deletions bin-saphe/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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(()) -> ()
Expand Down
35 changes: 35 additions & 0 deletions bin-saphe/satysfiCommand.ml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 8f08114

Please sign in to comment.