diff --git a/bin-saphe/depsConfig.ml b/bin-saphe/depsConfig.ml index e08bf66b8..037803af2 100644 --- a/bin-saphe/depsConfig.ml +++ b/bin-saphe/depsConfig.ml @@ -1,4 +1,8 @@ +open MyUtil +open ConfigError + + type envelope_name = string type envelope_dependency = { @@ -13,6 +17,10 @@ type envelope_spec = { } type t = { - envelopes : envelope_spec list; - direct_dependencies : envelope_dependency list; + envelopes : envelope_spec list; + explicit_dependencies : envelope_dependency list; } + + +let write (_abspath_deps_config : abs_path) (_deps_config : t) : (unit, config_error) result = + failwith "TODO: DepsConfig.write" diff --git a/bin-saphe/lockConfig.ml b/bin-saphe/lockConfig.ml index ab6157df1..1ccd3988b 100644 --- a/bin-saphe/lockConfig.ml +++ b/bin-saphe/lockConfig.ml @@ -19,6 +19,7 @@ type lock_dependency = { used_as : string; } +(* TODO: make `locked_package` keep registry, package name, and version *) type locked_package = { lock_name : lock_name; lock_contents : lock_contents; diff --git a/bin-saphe/main.ml b/bin-saphe/main.ml index e1ec2b5e2..7d569a29d 100644 --- a/bin-saphe/main.ml +++ b/bin-saphe/main.ml @@ -735,13 +735,35 @@ type build_input = } -let make_deps_config (_lock_config : LockConfig.t) : DepsConfig.t = +let make_envelope_dependency (lock_dep : LockConfig.lock_dependency) : DepsConfig.envelope_dependency = DepsConfig.{ - envelopes = failwith "TODO: DepsConfig"; - direct_dependencies = []; + dependency_name = lock_dep.depended_lock_name; + dependency_used_as = lock_dep.used_as; } +let make_envelope_spec (locked_package : LockConfig.locked_package) : DepsConfig.envelope_spec = + let envelope_dependencies = + locked_package.lock_dependencies |> List.map make_envelope_dependency + in + DepsConfig.{ + envelope_name = locked_package.lock_name; + envelope_path = failwith "TODO: make_envelope_spec, envelope_path"; + envelope_dependencies; + } + + +let make_deps_config (lock_config : LockConfig.t) : DepsConfig.t = + let envelopes = + lock_config.LockConfig.locked_packages |> List.map make_envelope_spec + in + let explicit_dependencies = + lock_config.LockConfig.explicit_dependencies + |> List.map make_envelope_dependency + in + DepsConfig.{ envelopes; explicit_dependencies } + + let build ~(fpath_in : string) ~(fpath_out_opt : string option) @@ -813,22 +835,27 @@ let build | PackageBuildInput{ root = _absdir_package; lock = abspath_lock_config; - deps = _abspath_deps_config; + deps = abspath_deps_config; envelope = _abspath_envelope_config; options = _build_option; } -> let* lock_config = LockConfig.load abspath_lock_config in - let _deps_config = make_deps_config lock_config in + let deps_config = make_deps_config lock_config in + + let* () = DepsConfig.write abspath_deps_config deps_config in failwith "TODO: PackageBuildInput" | DocumentBuildInput{ lock = abspath_lock_config; - deps = _abspath_deps_config; + deps = abspath_deps_config; out = _abspath_out; dump = _abspath_dump; options = _build_option; } -> - let* _lock_config = LockConfig.load abspath_lock_config in + 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" in match res with