Remove opaque from Lib.t
Only use Compilation_context.t for controlling this Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
parent
e09bbfcd6e
commit
9f43a88950
|
@ -5,7 +5,7 @@ module SC = Super_context
|
||||||
module Includes = struct
|
module Includes = struct
|
||||||
type t = string list Arg_spec.t Cm_kind.Dict.t
|
type t = string list Arg_spec.t Cm_kind.Dict.t
|
||||||
|
|
||||||
let make sctx ~requires : _ Cm_kind.Dict.t =
|
let make sctx ~opaque ~requires : _ Cm_kind.Dict.t =
|
||||||
match requires with
|
match requires with
|
||||||
| Error exn -> Cm_kind.Dict.make_all (Arg_spec.Dyn (fun _ -> raise exn))
|
| Error exn -> Cm_kind.Dict.make_all (Arg_spec.Dyn (fun _ -> raise exn))
|
||||||
| Ok libs ->
|
| Ok libs ->
|
||||||
|
@ -22,13 +22,15 @@ module Includes = struct
|
||||||
Arg_spec.S
|
Arg_spec.S
|
||||||
[ iflags
|
[ iflags
|
||||||
; Hidden_deps
|
; Hidden_deps
|
||||||
( libs
|
( if opaque then
|
||||||
|> List.map ~f:(fun lib ->
|
List.map libs ~f:(fun lib ->
|
||||||
(lib, if Lib.opaque lib then
|
(lib, if Lib.is_local lib then
|
||||||
".cmi"
|
".cmi"
|
||||||
else
|
else
|
||||||
".cmi-and-.cmx"))
|
".cmi-and-.cmx"))
|
||||||
|> SC.Libs.file_deps_with_exts sctx
|
|> SC.Libs.file_deps_with_exts sctx
|
||||||
|
else
|
||||||
|
SC.Libs.file_deps sctx libs ~ext:".cmi-and-.cmx"
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
in
|
in
|
||||||
|
@ -89,7 +91,7 @@ let create ~super_context ~scope ~dir ?(dir_kind=File_tree.Dune_file.Kind.Dune)
|
||||||
; lib_interface_module
|
; lib_interface_module
|
||||||
; flags
|
; flags
|
||||||
; requires
|
; requires
|
||||||
; includes = Includes.make super_context ~requires
|
; includes = Includes.make super_context ~opaque ~requires
|
||||||
; preprocessing
|
; preprocessing
|
||||||
; no_keep_locs
|
; no_keep_locs
|
||||||
; opaque
|
; opaque
|
||||||
|
|
|
@ -17,6 +17,8 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
let sctx = P.sctx
|
let sctx = P.sctx
|
||||||
let ctx = SC.context sctx
|
let ctx = SC.context sctx
|
||||||
|
|
||||||
|
let opaque = ctx.profile = "dev"
|
||||||
|
|
||||||
(* +-----------------------------------------------------------------+
|
(* +-----------------------------------------------------------------+
|
||||||
| Library stuff |
|
| Library stuff |
|
||||||
+-----------------------------------------------------------------+ *)
|
+-----------------------------------------------------------------+ *)
|
||||||
|
@ -199,7 +201,7 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
~requires
|
~requires
|
||||||
~preprocessing:pp
|
~preprocessing:pp
|
||||||
~no_keep_locs:lib.no_keep_locs
|
~no_keep_locs:lib.no_keep_locs
|
||||||
~opaque:(Lib.Compile.opaque compile_info)
|
~opaque
|
||||||
in
|
in
|
||||||
|
|
||||||
let dep_graphs = Ocamldep.rules cctx in
|
let dep_graphs = Ocamldep.rules cctx in
|
||||||
|
@ -521,7 +523,7 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
~flags
|
~flags
|
||||||
~requires
|
~requires
|
||||||
~preprocessing:pp
|
~preprocessing:pp
|
||||||
~opaque:(Lib.Compile.opaque compile_info)
|
~opaque
|
||||||
in
|
in
|
||||||
|
|
||||||
Exe.build_and_link_many cctx
|
Exe.build_and_link_many cctx
|
||||||
|
@ -545,7 +547,6 @@ module Gen(P : Install_rules.Params) = struct
|
||||||
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
|
~allow_overlaps:exes.buildable.allow_overlapping_dependencies
|
||||||
~opaque:(ctx.profile = "dev")
|
|
||||||
in
|
in
|
||||||
SC.Libs.gen_select_rules sctx compile_info ~dir;
|
SC.Libs.gen_select_rules sctx compile_info ~dir;
|
||||||
SC.Libs.with_lib_deps sctx compile_info ~dir
|
SC.Libs.with_lib_deps sctx compile_info ~dir
|
||||||
|
|
17
src/lib.ml
17
src/lib.ml
|
@ -63,7 +63,6 @@ module Info = struct
|
||||||
; pps : (Loc.t * Jbuild.Pp.t) list
|
; pps : (Loc.t * Jbuild.Pp.t) list
|
||||||
; optional : bool
|
; optional : bool
|
||||||
; virtual_deps : (Loc.t * string) list
|
; virtual_deps : (Loc.t * string) list
|
||||||
; opaque : bool
|
|
||||||
; dune_version : Syntax.Version.t option
|
; dune_version : Syntax.Version.t option
|
||||||
; sub_systems : Jbuild.Sub_system_info.t Sub_system_name.Map.t
|
; sub_systems : Jbuild.Sub_system_info.t Sub_system_name.Map.t
|
||||||
}
|
}
|
||||||
|
@ -73,7 +72,7 @@ module Info = struct
|
||||||
~init:(Deps.to_lib_deps t.requires)
|
~init:(Deps.to_lib_deps t.requires)
|
||||||
~f:(fun acc s -> Jbuild.Lib_dep.Direct s :: acc)
|
~f:(fun acc s -> Jbuild.Lib_dep.Direct s :: acc)
|
||||||
|
|
||||||
let of_library_stanza ~dir ~opaque (conf : Jbuild.Library.t) =
|
let of_library_stanza ~dir (conf : Jbuild.Library.t) =
|
||||||
let archive_file ext = Path.relative dir (conf.name ^ ext) in
|
let archive_file ext = Path.relative dir (conf.name ^ ext) in
|
||||||
let archive_files ~f_ext =
|
let archive_files ~f_ext =
|
||||||
Mode.Dict.of_func (fun ~mode -> [archive_file (f_ext mode)])
|
Mode.Dict.of_func (fun ~mode -> [archive_file (f_ext mode)])
|
||||||
|
@ -117,7 +116,6 @@ module Info = struct
|
||||||
; pps = Jbuild.Preprocess_map.pps conf.buildable.preprocess
|
; pps = Jbuild.Preprocess_map.pps conf.buildable.preprocess
|
||||||
; sub_systems = conf.sub_systems
|
; sub_systems = conf.sub_systems
|
||||||
; dune_version = Some conf.dune_version
|
; dune_version = Some conf.dune_version
|
||||||
; opaque
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let of_findlib_package pkg =
|
let of_findlib_package pkg =
|
||||||
|
@ -144,7 +142,6 @@ module Info = struct
|
||||||
; virtual_deps = []
|
; virtual_deps = []
|
||||||
; optional = false
|
; optional = false
|
||||||
; status = Installed
|
; status = Installed
|
||||||
; opaque = false
|
|
||||||
; (* We don't know how these are named for external libraries *)
|
; (* We don't know how these are named for external libraries *)
|
||||||
foreign_archives = Mode.Dict.make_both []
|
foreign_archives = Mode.Dict.make_both []
|
||||||
; sub_systems = sub_systems
|
; sub_systems = sub_systems
|
||||||
|
@ -338,8 +335,6 @@ let plugins t = t.info.plugins
|
||||||
let jsoo_runtime t = t.info.jsoo_runtime
|
let jsoo_runtime t = t.info.jsoo_runtime
|
||||||
let unique_id t = t.unique_id
|
let unique_id t = t.unique_id
|
||||||
|
|
||||||
let opaque t = t.info.opaque
|
|
||||||
|
|
||||||
let dune_version t = t.info.dune_version
|
let dune_version t = t.info.dune_version
|
||||||
|
|
||||||
let src_dir t = t.info.src_dir
|
let src_dir t = t.info.src_dir
|
||||||
|
@ -914,7 +909,6 @@ module Compile = struct
|
||||||
; pps : t list Or_exn.t
|
; pps : t list Or_exn.t
|
||||||
; resolved_selects : Resolved_select.t list
|
; resolved_selects : Resolved_select.t list
|
||||||
; optional : bool
|
; optional : bool
|
||||||
; opaque : bool
|
|
||||||
; user_written_deps : Jbuild.Lib_deps.t
|
; user_written_deps : Jbuild.Lib_deps.t
|
||||||
; sub_systems : Sub_system0.Instance.t Lazy.t Sub_system_name.Map.t
|
; sub_systems : Sub_system0.Instance.t Lazy.t Sub_system_name.Map.t
|
||||||
}
|
}
|
||||||
|
@ -927,7 +921,6 @@ module Compile = struct
|
||||||
; optional = t.info.optional
|
; optional = t.info.optional
|
||||||
; user_written_deps = t.user_written_deps
|
; user_written_deps = t.user_written_deps
|
||||||
; sub_systems = t.sub_systems
|
; sub_systems = t.sub_systems
|
||||||
; opaque = t.info.opaque
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let direct_requires t = t.direct_requires
|
let direct_requires t = t.direct_requires
|
||||||
|
@ -936,7 +929,6 @@ module Compile = struct
|
||||||
let pps t = t.pps
|
let pps t = t.pps
|
||||||
let optional t = t.optional
|
let optional t = t.optional
|
||||||
let user_written_deps t = t.user_written_deps
|
let user_written_deps t = t.user_written_deps
|
||||||
let opaque t = t.opaque
|
|
||||||
let sub_systems t =
|
let sub_systems t =
|
||||||
Sub_system_name.Map.values t.sub_systems
|
Sub_system_name.Map.values t.sub_systems
|
||||||
|> List.map ~f:(fun (lazy (Sub_system0.Instance.T ((module M), t))) ->
|
|> List.map ~f:(fun (lazy (Sub_system0.Instance.T ((module M), t))) ->
|
||||||
|
@ -965,10 +957,10 @@ module DB = struct
|
||||||
; all = Lazy.from_fun all
|
; all = Lazy.from_fun all
|
||||||
}
|
}
|
||||||
|
|
||||||
let create_from_library_stanzas ?parent ~opaque stanzas =
|
let create_from_library_stanzas ?parent stanzas =
|
||||||
let map =
|
let map =
|
||||||
List.concat_map stanzas ~f:(fun (dir, (conf : Jbuild.Library.t)) ->
|
List.concat_map stanzas ~f:(fun (dir, (conf : Jbuild.Library.t)) ->
|
||||||
let info = Info.of_library_stanza ~dir ~opaque conf in
|
let info = Info.of_library_stanza ~dir conf in
|
||||||
match conf.public with
|
match conf.public with
|
||||||
| None ->
|
| None ->
|
||||||
[(conf.name, Resolve_result.Found info)]
|
[(conf.name, Resolve_result.Found info)]
|
||||||
|
@ -1063,7 +1055,7 @@ module DB = struct
|
||||||
let t = Option.some_if (not allow_overlaps) t in
|
let t = Option.some_if (not allow_overlaps) t in
|
||||||
Compile.for_lib t lib
|
Compile.for_lib t lib
|
||||||
|
|
||||||
let resolve_user_written_deps t ?(allow_overlaps=false) ~opaque deps ~pps =
|
let resolve_user_written_deps t ?(allow_overlaps=false) deps ~pps =
|
||||||
let res, pps, resolved_selects =
|
let res, pps, resolved_selects =
|
||||||
resolve_user_deps t (Info.Deps.of_lib_deps deps) ~pps
|
resolve_user_deps t (Info.Deps.of_lib_deps deps) ~pps
|
||||||
~stack:Dep_stack.empty ~allow_private_deps:true
|
~stack:Dep_stack.empty ~allow_private_deps:true
|
||||||
|
@ -1081,7 +1073,6 @@ module DB = struct
|
||||||
; optional = false
|
; optional = false
|
||||||
; user_written_deps = deps
|
; user_written_deps = deps
|
||||||
; sub_systems = Sub_system_name.Map.empty
|
; sub_systems = Sub_system_name.Map.empty
|
||||||
; opaque
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let resolve_pps t pps =
|
let resolve_pps t pps =
|
||||||
|
|
|
@ -26,8 +26,6 @@ val archives : t -> Path.t list Mode.Dict.t
|
||||||
val plugins : t -> Path.t list Mode.Dict.t
|
val plugins : t -> Path.t list Mode.Dict.t
|
||||||
val jsoo_runtime : t -> Path.t list
|
val jsoo_runtime : t -> Path.t list
|
||||||
|
|
||||||
val opaque : t -> bool
|
|
||||||
|
|
||||||
val dune_version : t -> Syntax.Version.t option
|
val dune_version : t -> Syntax.Version.t option
|
||||||
|
|
||||||
(** A unique integer identifier. It is only unique for the duration of
|
(** A unique integer identifier. It is only unique for the duration of
|
||||||
|
@ -107,12 +105,11 @@ module Info : sig
|
||||||
; pps : (Loc.t * Jbuild.Pp.t) list
|
; pps : (Loc.t * Jbuild.Pp.t) list
|
||||||
; optional : bool
|
; optional : bool
|
||||||
; virtual_deps : (Loc.t * string) list
|
; virtual_deps : (Loc.t * string) list
|
||||||
; opaque : bool
|
|
||||||
; dune_version : Syntax.Version.t option
|
; dune_version : Syntax.Version.t option
|
||||||
; sub_systems : Jbuild.Sub_system_info.t Sub_system_name.Map.t
|
; sub_systems : Jbuild.Sub_system_info.t Sub_system_name.Map.t
|
||||||
}
|
}
|
||||||
|
|
||||||
val of_library_stanza : dir:Path.t -> opaque:bool -> Jbuild.Library.t -> t
|
val of_library_stanza : dir:Path.t -> Jbuild.Library.t -> t
|
||||||
val of_findlib_package : Findlib.Package.t -> t
|
val of_findlib_package : Findlib.Package.t -> t
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -221,8 +218,6 @@ module Compile : sig
|
||||||
val optional : t -> bool
|
val optional : t -> bool
|
||||||
val user_written_deps : t -> Jbuild.Lib_deps.t
|
val user_written_deps : t -> Jbuild.Lib_deps.t
|
||||||
|
|
||||||
val opaque : t -> bool
|
|
||||||
|
|
||||||
(** Sub-systems used in this compilation context *)
|
(** Sub-systems used in this compilation context *)
|
||||||
val sub_systems : t -> sub_system list
|
val sub_systems : t -> sub_system list
|
||||||
end
|
end
|
||||||
|
@ -262,7 +257,6 @@ module DB : sig
|
||||||
(** Create a database from a list of library stanzas *)
|
(** Create a database from a list of library stanzas *)
|
||||||
val create_from_library_stanzas
|
val create_from_library_stanzas
|
||||||
: ?parent:t
|
: ?parent:t
|
||||||
-> opaque:bool
|
|
||||||
-> (Path.t * Jbuild.Library.t) list
|
-> (Path.t * Jbuild.Library.t) list
|
||||||
-> t
|
-> t
|
||||||
|
|
||||||
|
@ -295,7 +289,6 @@ module DB : sig
|
||||||
val resolve_user_written_deps
|
val resolve_user_written_deps
|
||||||
: t
|
: t
|
||||||
-> ?allow_overlaps:bool
|
-> ?allow_overlaps:bool
|
||||||
-> opaque:bool
|
|
||||||
-> Jbuild.Lib_dep.t list
|
-> Jbuild.Lib_dep.t list
|
||||||
-> pps:(Loc.t * Jbuild.Pp.t) list
|
-> pps:(Loc.t * Jbuild.Pp.t) list
|
||||||
-> Compile.t
|
-> Compile.t
|
||||||
|
|
|
@ -50,7 +50,7 @@ module DB = struct
|
||||||
(Project_name_map.keys t.by_name)
|
(Project_name_map.keys t.by_name)
|
||||||
]
|
]
|
||||||
|
|
||||||
let create ~projects ~context ~opaque ~installed_libs internal_libs =
|
let create ~projects ~context ~installed_libs internal_libs =
|
||||||
let projects_by_name =
|
let projects_by_name =
|
||||||
List.map projects ~f:(fun (project : Dune_project.t) ->
|
List.map projects ~f:(fun (project : Dune_project.t) ->
|
||||||
(project.name, project))
|
(project.name, project))
|
||||||
|
@ -119,7 +119,7 @@ module DB = struct
|
||||||
let project = Option.value_exn project in
|
let project = Option.value_exn project in
|
||||||
let libs = Option.value libs ~default:[] in
|
let libs = Option.value libs ~default:[] in
|
||||||
let db =
|
let db =
|
||||||
Lib.DB.create_from_library_stanzas libs ~parent:public_libs ~opaque
|
Lib.DB.create_from_library_stanzas libs ~parent:public_libs
|
||||||
in
|
in
|
||||||
let root = Path.append_local build_context_dir project.root in
|
let root = Path.append_local build_context_dir project.root in
|
||||||
Some { project; db; root })
|
Some { project; db; root })
|
||||||
|
|
|
@ -24,7 +24,6 @@ module DB : sig
|
||||||
val create
|
val create
|
||||||
: projects:Dune_project.t list
|
: projects:Dune_project.t list
|
||||||
-> context:string
|
-> context:string
|
||||||
-> opaque:bool
|
|
||||||
-> installed_libs:Lib.DB.t
|
-> installed_libs:Lib.DB.t
|
||||||
-> (Path.t * Jbuild.Library.t) list
|
-> (Path.t * Jbuild.Library.t) list
|
||||||
-> t * Lib.DB.t
|
-> t * Lib.DB.t
|
||||||
|
|
|
@ -506,11 +506,9 @@ let create
|
||||||
| Library lib -> Some (ctx_dir, lib)
|
| Library lib -> Some (ctx_dir, lib)
|
||||||
| _ -> None))
|
| _ -> None))
|
||||||
in
|
in
|
||||||
let opaque = context.profile = "dev" in
|
|
||||||
let scopes, public_libs =
|
let scopes, public_libs =
|
||||||
Scope.DB.create
|
Scope.DB.create
|
||||||
~projects
|
~projects
|
||||||
~opaque
|
|
||||||
~context:context.name
|
~context:context.name
|
||||||
~installed_libs
|
~installed_libs
|
||||||
internal_libs
|
internal_libs
|
||||||
|
|
Loading…
Reference in New Issue