Fix opaque calculation for includes
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
b394896c1f
commit
e09bbfcd6e
|
@ -5,7 +5,7 @@ module SC = Super_context
|
|||
module Includes = struct
|
||||
type t = string list Arg_spec.t Cm_kind.Dict.t
|
||||
|
||||
let make sctx ~opaque ~requires : _ Cm_kind.Dict.t =
|
||||
let make sctx ~requires : _ Cm_kind.Dict.t =
|
||||
match requires with
|
||||
| Error exn -> Cm_kind.Dict.make_all (Arg_spec.Dyn (fun _ -> raise exn))
|
||||
| Ok libs ->
|
||||
|
@ -19,13 +19,18 @@ module Includes = struct
|
|||
]
|
||||
in
|
||||
let cmx_includes =
|
||||
if opaque then
|
||||
cmi_includes
|
||||
else
|
||||
Arg_spec.S [ iflags
|
||||
; Hidden_deps
|
||||
(SC.Libs.file_deps sctx libs ~ext:".cmi-and-.cmx")
|
||||
]
|
||||
Arg_spec.S
|
||||
[ iflags
|
||||
; Hidden_deps
|
||||
( libs
|
||||
|> List.map ~f:(fun lib ->
|
||||
(lib, if Lib.opaque lib then
|
||||
".cmi"
|
||||
else
|
||||
".cmi-and-.cmx"))
|
||||
|> SC.Libs.file_deps_with_exts sctx
|
||||
)
|
||||
]
|
||||
in
|
||||
{ cmi = cmi_includes
|
||||
; cmo = cmi_includes
|
||||
|
@ -84,7 +89,7 @@ let create ~super_context ~scope ~dir ?(dir_kind=File_tree.Dune_file.Kind.Dune)
|
|||
; lib_interface_module
|
||||
; flags
|
||||
; requires
|
||||
; includes = Includes.make super_context ~requires ~opaque
|
||||
; includes = Includes.make super_context ~requires
|
||||
; preprocessing
|
||||
; no_keep_locs
|
||||
; opaque
|
||||
|
|
|
@ -338,6 +338,8 @@ let plugins t = t.info.plugins
|
|||
let jsoo_runtime t = t.info.jsoo_runtime
|
||||
let unique_id t = t.unique_id
|
||||
|
||||
let opaque t = t.info.opaque
|
||||
|
||||
let dune_version t = t.info.dune_version
|
||||
|
||||
let src_dir t = t.info.src_dir
|
||||
|
|
|
@ -26,6 +26,8 @@ val archives : t -> Path.t list Mode.Dict.t
|
|||
val plugins : t -> Path.t list Mode.Dict.t
|
||||
val jsoo_runtime : t -> Path.t list
|
||||
|
||||
val opaque : t -> bool
|
||||
|
||||
val dune_version : t -> Syntax.Version.t option
|
||||
|
||||
(** A unique integer identifier. It is only unique for the duration of
|
||||
|
|
|
@ -708,6 +708,15 @@ module Libs = struct
|
|||
(lib_files_alias ~dir ~name:(Library.best_name lib) ~ext))
|
||||
|> Path.Set.of_list)
|
||||
|
||||
let file_deps_with_exts t lib_exts =
|
||||
List.rev_map lib_exts ~f:(fun ((lib : Lib.t), ext) ->
|
||||
if Lib.is_local lib then
|
||||
Alias.stamp_file
|
||||
(lib_files_alias ~dir:(Lib.src_dir lib) ~name:(Lib.name lib) ~ext)
|
||||
else
|
||||
Build_system.stamp_file_for_files_of t.build_system
|
||||
~dir:(Lib.obj_dir lib) ~ext)
|
||||
|
||||
let file_deps t libs ~ext =
|
||||
List.rev_map libs ~f:(fun (lib : Lib.t) ->
|
||||
if Lib.is_local lib then
|
||||
|
|
|
@ -197,6 +197,8 @@ module Libs : sig
|
|||
all the files with extension [ext] of libraries [libs]. *)
|
||||
val file_deps : t -> Lib.L.t -> ext:string -> Path.t list
|
||||
|
||||
val file_deps_with_exts : t -> (Lib.t * string) list -> Path.t list
|
||||
|
||||
(** Setup the alias that depends on all files with a given extension
|
||||
for a library *)
|
||||
val setup_file_deps_alias
|
||||
|
|
Loading…
Reference in New Issue