Libraries and executables can allow overlapping dependencies
This commit is contained in:
parent
a5f9a9e063
commit
232acdd92f
|
@ -177,6 +177,9 @@ modules you want.
|
||||||
such modules to avoid surprises. ``<modules>`` must be a subset of
|
such modules to avoid surprises. ``<modules>`` must be a subset of
|
||||||
the modules listed in the ``(modules ...)`` field.
|
the modules listed in the ``(modules ...)`` field.
|
||||||
|
|
||||||
|
- ``(allow_overlapping_dependencies)`` allows external dependencies to
|
||||||
|
overlap with libraries that are present in the workspace
|
||||||
|
|
||||||
Note that when binding C libraries, Jbuilder doesn't provide special support for
|
Note that when binding C libraries, Jbuilder doesn't provide special support for
|
||||||
tools such as ``pkg-config``, however it integrates easily with `configurator
|
tools such as ``pkg-config``, however it integrates easily with `configurator
|
||||||
<https://github.com/janestreet/configurator>`__ by using ``(c_flags (:include
|
<https://github.com/janestreet/configurator>`__ by using ``(c_flags (:include
|
||||||
|
@ -263,6 +266,9 @@ binary at the same place as where ``ocamlc`` was found, or when there is a
|
||||||
- ``(modules_without_implementation <modules>)`` is the same as the
|
- ``(modules_without_implementation <modules>)`` is the same as the
|
||||||
corresponding field of `library`_
|
corresponding field of `library`_
|
||||||
|
|
||||||
|
- ``(allow_overlapping_dependencies)`` is the same as the
|
||||||
|
corresponding field of `library`_
|
||||||
|
|
||||||
executables
|
executables
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
|
|
@ -559,7 +559,10 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
|> String.concat ~sep:"\n")
|
|> String.concat ~sep:"\n")
|
||||||
>>> Build.write_file_dyn (Path.relative dir file.name)));
|
>>> Build.write_file_dyn (Path.relative dir file.name)));
|
||||||
|
|
||||||
let compile_info = Lib.DB.get_compile_info (Scope.libs scope) lib.name in
|
let compile_info =
|
||||||
|
Lib.DB.get_compile_info (Scope.libs scope) lib.name
|
||||||
|
~allow_overlaps:lib.buildable.allow_overlapping_dependencies
|
||||||
|
in
|
||||||
let requires, real_requires =
|
let requires, real_requires =
|
||||||
SC.Libs.requires sctx compile_info
|
SC.Libs.requires sctx compile_info
|
||||||
~dir ~has_dot_merlin:true
|
~dir ~has_dot_merlin:true
|
||||||
|
@ -810,6 +813,7 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
Lib.DB.resolve_user_written_deps (Scope.libs scope)
|
Lib.DB.resolve_user_written_deps (Scope.libs scope)
|
||||||
exes.buildable.libraries
|
exes.buildable.libraries
|
||||||
~pps:(Jbuild.Preprocess_map.pps exes.buildable.preprocess)
|
~pps:(Jbuild.Preprocess_map.pps exes.buildable.preprocess)
|
||||||
|
~allow_overlaps:exes.buildable.allow_overlapping_dependencies
|
||||||
in
|
in
|
||||||
let requires, real_requires =
|
let requires, real_requires =
|
||||||
SC.Libs.requires sctx ~dir
|
SC.Libs.requires sctx ~dir
|
||||||
|
|
|
@ -476,6 +476,7 @@ module Buildable = struct
|
||||||
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
||||||
; ocamlopt_flags : Ordered_set_lang.Unexpanded.t
|
; ocamlopt_flags : Ordered_set_lang.Unexpanded.t
|
||||||
; js_of_ocaml : Js_of_ocaml.t
|
; js_of_ocaml : Js_of_ocaml.t
|
||||||
|
; allow_overlapping_dependencies : bool
|
||||||
}
|
}
|
||||||
|
|
||||||
let modules_field name =
|
let modules_field name =
|
||||||
|
@ -487,8 +488,6 @@ module Buildable = struct
|
||||||
>>= fun preprocess ->
|
>>= fun preprocess ->
|
||||||
field "preprocessor_deps" (list Dep_conf.t) ~default:[]
|
field "preprocessor_deps" (list Dep_conf.t) ~default:[]
|
||||||
>>= fun preprocessor_deps ->
|
>>= fun preprocessor_deps ->
|
||||||
(* CR-someday jdimino: remove this. There are still a few Jane Street packages using
|
|
||||||
this *)
|
|
||||||
field "lint" Lint.t ~default:Lint.default
|
field "lint" Lint.t ~default:Lint.default
|
||||||
>>= fun lint ->
|
>>= fun lint ->
|
||||||
modules_field "modules"
|
modules_field "modules"
|
||||||
|
@ -500,7 +499,10 @@ module Buildable = struct
|
||||||
field_oslu "flags" >>= fun flags ->
|
field_oslu "flags" >>= fun flags ->
|
||||||
field_oslu "ocamlc_flags" >>= fun ocamlc_flags ->
|
field_oslu "ocamlc_flags" >>= fun ocamlc_flags ->
|
||||||
field_oslu "ocamlopt_flags" >>= fun ocamlopt_flags ->
|
field_oslu "ocamlopt_flags" >>= fun ocamlopt_flags ->
|
||||||
field "js_of_ocaml" (Js_of_ocaml.t) ~default:Js_of_ocaml.default >>= fun js_of_ocaml ->
|
field "js_of_ocaml" (Js_of_ocaml.t) ~default:Js_of_ocaml.default
|
||||||
|
>>= fun js_of_ocaml ->
|
||||||
|
field_b "allow_overlapping_dependencies"
|
||||||
|
>>= fun allow_overlapping_dependencies ->
|
||||||
return
|
return
|
||||||
{ loc
|
{ loc
|
||||||
; preprocess
|
; preprocess
|
||||||
|
@ -513,6 +515,7 @@ module Buildable = struct
|
||||||
; ocamlc_flags
|
; ocamlc_flags
|
||||||
; ocamlopt_flags
|
; ocamlopt_flags
|
||||||
; js_of_ocaml
|
; js_of_ocaml
|
||||||
|
; allow_overlapping_dependencies
|
||||||
}
|
}
|
||||||
|
|
||||||
let single_preprocess t =
|
let single_preprocess t =
|
||||||
|
@ -867,7 +870,8 @@ module Rule = struct
|
||||||
return (fallback, mode))
|
return (fallback, mode))
|
||||||
~f:(function
|
~f:(function
|
||||||
| true, Some _ ->
|
| true, Some _ ->
|
||||||
Error "Cannot use both (fallback) and (mode ...) at the same time.\n\
|
Error "Cannot use both (fallback) and (mode ...) at the \
|
||||||
|
same time.\n\
|
||||||
(fallback) is the same as (mode fallback), \
|
(fallback) is the same as (mode fallback), \
|
||||||
please use the latter in new code."
|
please use the latter in new code."
|
||||||
| false, Some mode -> Ok mode
|
| false, Some mode -> Ok mode
|
||||||
|
|
|
@ -143,6 +143,7 @@ module Buildable : sig
|
||||||
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
; ocamlc_flags : Ordered_set_lang.Unexpanded.t
|
||||||
; ocamlopt_flags : Ordered_set_lang.Unexpanded.t
|
; ocamlopt_flags : Ordered_set_lang.Unexpanded.t
|
||||||
; js_of_ocaml : Js_of_ocaml.t
|
; js_of_ocaml : Js_of_ocaml.t
|
||||||
|
; allow_overlapping_dependencies : bool
|
||||||
}
|
}
|
||||||
|
|
||||||
(** Preprocessing specification used by all modules or [No_preprocessing] *)
|
(** Preprocessing specification used by all modules or [No_preprocessing] *)
|
||||||
|
|
Loading…
Reference in New Issue