Fix Main.external_lib_deps
This commit is contained in:
parent
c7b9c2cd3e
commit
e65213e303
25
src/main.ml
25
src/main.ml
|
@ -90,25 +90,30 @@ let setup ?(log=Log.no_log)
|
||||||
; file_tree = conf.file_tree
|
; file_tree = conf.file_tree
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let find_context_exn t ~name =
|
||||||
|
match List.find t.contexts ~f:(fun c -> c.name = name) with
|
||||||
|
| Some ctx -> ctx
|
||||||
|
| None ->
|
||||||
|
die "@{<Error>Error@}: Context %S not found!@." name
|
||||||
|
|
||||||
let external_lib_deps ?log ~packages () =
|
let external_lib_deps ?log ~packages () =
|
||||||
Scheduler.go ?log
|
Scheduler.go ?log
|
||||||
(setup () ~filter_out_optional_stanzas_with_missing_deps:false
|
(setup () ~filter_out_optional_stanzas_with_missing_deps:false
|
||||||
>>| fun setup ->
|
>>| fun setup ->
|
||||||
|
let context = find_context_exn setup ~name:"default" in
|
||||||
let install_files =
|
let install_files =
|
||||||
List.map packages ~f:(fun pkg ->
|
List.map packages ~f:(fun pkg ->
|
||||||
match package_install_file setup pkg with
|
match package_install_file setup pkg with
|
||||||
| Ok path -> path
|
| Ok path -> Path.append context.build_dir path
|
||||||
| Error () -> die "Unknown package %S" (Package.Name.to_string pkg))
|
| Error () -> die "Unknown package %S" (Package.Name.to_string pkg))
|
||||||
in
|
in
|
||||||
match String_map.find setup.stanzas "default" with
|
let stanzas = Option.value_exn (String_map.find setup.stanzas "default") in
|
||||||
| None -> die "You need to set a default context to use external-lib-deps"
|
let internals = Jbuild.Stanzas.lib_names stanzas in
|
||||||
| Some stanzas ->
|
Path.Map.map
|
||||||
let internals = Jbuild.Stanzas.lib_names stanzas in
|
(Build_system.all_lib_deps setup.build_system
|
||||||
Path.Map.map
|
~request:(Build.paths install_files))
|
||||||
(Build_system.all_lib_deps setup.build_system
|
~f:(String_map.filteri ~f:(fun name _ ->
|
||||||
~request:(Build.paths install_files))
|
not (String_set.mem internals name))))
|
||||||
~f:(String_map.filteri ~f:(fun name _ ->
|
|
||||||
not (String_set.mem internals name))))
|
|
||||||
|
|
||||||
let ignored_during_bootstrap =
|
let ignored_during_bootstrap =
|
||||||
Path.Set.of_list
|
Path.Set.of_list
|
||||||
|
|
Loading…
Reference in New Issue