Revert public_interfaces for now
The code to support it is starting to become increasingly complicated and the number of problem found is a bit alarming. We'll reinclude it later after a bit more testing and hopefully some simplifications.
This commit is contained in:
parent
9893c14500
commit
4b40cad247
|
@ -1,11 +1,6 @@
|
||||||
1.0.0 (coming soon)
|
1.0.0 (coming soon)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
- Add a field `public_interfaces` to libraries. It lists the modules
|
|
||||||
that are accessible outside of the scope where the libraries is
|
|
||||||
defined, for instance when the library is installed (Francois Bobot,
|
|
||||||
#106)
|
|
||||||
|
|
||||||
- Fix the error message when there are more than one `<package>.opam`
|
- Fix the error message when there are more than one `<package>.opam`
|
||||||
file for a given pacakge
|
file for a given pacakge
|
||||||
|
|
||||||
|
|
|
@ -81,12 +81,6 @@ modules you want.
|
||||||
letter. For instance to exclude module ``Foo``: ``(modules (:standard \
|
letter. For instance to exclude module ``Foo``: ``(modules (:standard \
|
||||||
foo))``
|
foo))``
|
||||||
|
|
||||||
- ``(public_interfaces <modules>)`` specifies the modules that are
|
|
||||||
visible to users of the library. Modules that are not part of this
|
|
||||||
list will only be visible inside the library itself.
|
|
||||||
``<public_interfaces>`` uses the same `Ordered set language` than
|
|
||||||
``<modules>`` and is currently only allowed for public libraries.
|
|
||||||
|
|
||||||
- ``(libraries (<library-dependencies>))`` is used to specify the dependencies
|
- ``(libraries (<library-dependencies>))`` is used to specify the dependencies
|
||||||
of the library. See the section about `Library dependencies`_ for more details
|
of the library. See the section about `Library dependencies`_ for more details
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ module Gen(P : Params) = struct
|
||||||
in
|
in
|
||||||
List.map cclibs ~f
|
List.map cclibs ~f
|
||||||
|
|
||||||
let build_lib (lib : Library.t) ~flags ~dir ~mode ~modules ~dep_graph =
|
let build_lib (lib : Library.t) ~scope ~flags ~dir ~mode ~modules ~dep_graph =
|
||||||
Option.iter (Context.compiler ctx mode) ~f:(fun compiler ->
|
Option.iter (Context.compiler ctx mode) ~f:(fun compiler ->
|
||||||
let target = lib_archive lib ~dir ~ext:(Mode.compiled_lib_ext mode) in
|
let target = lib_archive lib ~dir ~ext:(Mode.compiled_lib_ext mode) in
|
||||||
let dep_graph = Ml_kind.Dict.get dep_graph Impl in
|
let dep_graph = Ml_kind.Dict.get dep_graph Impl in
|
||||||
|
@ -107,7 +107,7 @@ module Gen(P : Params) = struct
|
||||||
; A "-a"; A "-o"; Target target
|
; A "-a"; A "-o"; Target target
|
||||||
; As stubs_flags
|
; As stubs_flags
|
||||||
; Dyn (fun (_, cclibs) -> Arg_spec.quote_args "-cclib" (map_cclibs cclibs))
|
; Dyn (fun (_, cclibs) -> Arg_spec.quote_args "-cclib" (map_cclibs cclibs))
|
||||||
; As (List.map lib.library_flags ~f:(SC.expand_vars sctx ~scope:lib.scope ~dir))
|
; As (List.map lib.library_flags ~f:(SC.expand_vars sctx ~scope ~dir))
|
||||||
; As (match lib.kind with
|
; As (match lib.kind with
|
||||||
| Normal -> []
|
| Normal -> []
|
||||||
| Ppx_deriver | Ppx_rewriter -> ["-linkall"])
|
| Ppx_deriver | Ppx_rewriter -> ["-linkall"])
|
||||||
|
@ -131,7 +131,7 @@ module Gen(P : Params) = struct
|
||||||
(Dep ctx.ocamlc)
|
(Dep ctx.ocamlc)
|
||||||
[ As (Utils.g ())
|
[ As (Utils.g ())
|
||||||
; Dyn (fun (c_flags, libs) ->
|
; Dyn (fun (c_flags, libs) ->
|
||||||
S [ Lib.c_include_flags ~context:ctx.name ~source_dir:Internal libs
|
S [ Lib.c_include_flags libs
|
||||||
; Arg_spec.quote_args "-ccopt" c_flags
|
; Arg_spec.quote_args "-ccopt" c_flags
|
||||||
])
|
])
|
||||||
; A "-o"; Target dst
|
; A "-o"; Target dst
|
||||||
|
@ -159,7 +159,7 @@ module Gen(P : Params) = struct
|
||||||
[ S [A "-I"; Path ctx.stdlib_dir]
|
[ S [A "-I"; Path ctx.stdlib_dir]
|
||||||
; As (SC.cxx_flags sctx)
|
; As (SC.cxx_flags sctx)
|
||||||
; Dyn (fun (cxx_flags, libs) ->
|
; Dyn (fun (cxx_flags, libs) ->
|
||||||
S [ Lib.c_include_flags ~context:ctx.name ~source_dir:Internal libs
|
S [ Lib.c_include_flags libs
|
||||||
; As cxx_flags
|
; As cxx_flags
|
||||||
])
|
])
|
||||||
; A "-o"; Target dst
|
; A "-o"; Target dst
|
||||||
|
@ -176,7 +176,7 @@ module Gen(P : Params) = struct
|
||||||
let alias_module_build_sandbox = Scanf.sscanf ctx.version "%u.%u"
|
let alias_module_build_sandbox = Scanf.sscanf ctx.version "%u.%u"
|
||||||
(fun a b -> a, b) <= (4, 02)
|
(fun a b -> a, b) <= (4, 02)
|
||||||
|
|
||||||
let library_rules (lib : Library.t) ~dir ~all_modules ~files =
|
let library_rules (lib : Library.t) ~dir ~all_modules ~files ~scope =
|
||||||
let dep_kind = if lib.optional then Build.Optional else Required in
|
let dep_kind = if lib.optional then Build.Optional else Required in
|
||||||
let flags = Ocaml_flags.make lib.buildable in
|
let flags = Ocaml_flags.make lib.buildable in
|
||||||
let modules =
|
let modules =
|
||||||
|
@ -225,7 +225,7 @@ module Gen(P : Params) = struct
|
||||||
SC.PP.pped_modules sctx ~dir ~dep_kind ~modules ~preprocess:lib.buildable.preprocess
|
SC.PP.pped_modules sctx ~dir ~dep_kind ~modules ~preprocess:lib.buildable.preprocess
|
||||||
~preprocessor_deps:lib.buildable.preprocessor_deps
|
~preprocessor_deps:lib.buildable.preprocessor_deps
|
||||||
~lib_name:(Some lib.name)
|
~lib_name:(Some lib.name)
|
||||||
~scope:lib.scope
|
~scope
|
||||||
in
|
in
|
||||||
let modules =
|
let modules =
|
||||||
match alias_module with
|
match alias_module with
|
||||||
|
@ -272,7 +272,7 @@ module Gen(P : Params) = struct
|
||||||
Option.iter alias_module ~f:(fun m ->
|
Option.iter alias_module ~f:(fun m ->
|
||||||
let flags = Ocaml_flags.default () in
|
let flags = Ocaml_flags.default () in
|
||||||
Module_compilation.build_module sctx m
|
Module_compilation.build_module sctx m
|
||||||
~js_of_ocaml
|
~js_of_ocaml
|
||||||
~dynlink
|
~dynlink
|
||||||
~sandbox:alias_module_build_sandbox
|
~sandbox:alias_module_build_sandbox
|
||||||
~flags:{ flags with common = flags.common @ ["-w"; "-49"] }
|
~flags:{ flags with common = flags.common @ ["-w"; "-49"] }
|
||||||
|
@ -349,49 +349,20 @@ module Gen(P : Params) = struct
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(* Setup artifact aliases for users of the library *)
|
List.iter Cm_kind.all ~f:(fun cm_kind ->
|
||||||
begin
|
let files =
|
||||||
(* If the library is public, users of the library read the files from
|
String_map.fold modules ~init:[] ~f:(fun ~key:_ ~data:m acc ->
|
||||||
"_build/install/..." *)
|
Module.cm_file m ~dir cm_kind :: acc)
|
||||||
let artifact_dir, modules =
|
|
||||||
match lib.public with
|
|
||||||
| None -> dir, modules
|
|
||||||
| Some { package; sub_dir; _ } ->
|
|
||||||
let dir =
|
|
||||||
let install_dir = Config.local_install_dir ~context:ctx.name in
|
|
||||||
let dir = Path.append install_dir (Install.lib_install_path ~package) in
|
|
||||||
match sub_dir with
|
|
||||||
| None -> dir
|
|
||||||
| Some s -> Path.relative dir s
|
|
||||||
in
|
|
||||||
let modules =
|
|
||||||
if Ordered_set_lang.is_standard lib.public_interfaces then
|
|
||||||
modules
|
|
||||||
else
|
|
||||||
let public_interfaces =
|
|
||||||
Ordered_set_lang.eval_with_standard lib.public_interfaces
|
|
||||||
~standard:(String_map.keys modules)
|
|
||||||
|> String_set.of_list
|
|
||||||
in
|
|
||||||
String_map.filter modules ~f:(fun m _ -> String_set.mem m public_interfaces)
|
|
||||||
in
|
|
||||||
(dir, modules)
|
|
||||||
in
|
in
|
||||||
List.iter Cm_kind.all ~f:(fun cm_kind ->
|
SC.Libs.setup_file_deps_alias sctx (dir, lib) ~ext:(Cm_kind.ext cm_kind)
|
||||||
let files =
|
files);
|
||||||
String_map.fold modules ~init:[] ~f:(fun ~key:_ ~data:m acc ->
|
SC.Libs.setup_file_deps_group_alias sctx (dir, lib) ~exts:[".cmi"; ".cmx"];
|
||||||
Module.cm_file m ~dir:artifact_dir cm_kind :: acc)
|
SC.Libs.setup_file_deps_alias sctx (dir, lib) ~ext:".h"
|
||||||
in
|
(List.map lib.install_c_headers ~f:(fun header ->
|
||||||
SC.Libs.setup_file_deps_alias sctx (dir, lib) ~ext:(Cm_kind.ext cm_kind)
|
Path.relative dir (header ^ ".h")));
|
||||||
files);
|
|
||||||
SC.Libs.setup_file_deps_group_alias sctx (dir, lib) ~exts:[".cmi"; ".cmx"];
|
|
||||||
SC.Libs.setup_file_deps_alias sctx (dir, lib) ~ext:".h"
|
|
||||||
(List.map lib.install_c_headers ~f:(fun header ->
|
|
||||||
Path.relative artifact_dir (header ^ ".h")));
|
|
||||||
end;
|
|
||||||
|
|
||||||
List.iter Mode.all ~f:(fun mode ->
|
List.iter Mode.all ~f:(fun mode ->
|
||||||
build_lib lib ~flags ~dir ~mode ~modules ~dep_graph);
|
build_lib lib ~scope ~flags ~dir ~mode ~modules ~dep_graph);
|
||||||
(* Build *.cma.js *)
|
(* Build *.cma.js *)
|
||||||
SC.add_rules sctx (
|
SC.add_rules sctx (
|
||||||
let src = lib_archive lib ~dir ~ext:(Mode.compiled_lib_ext Mode.Byte) in
|
let src = lib_archive lib ~dir ~ext:(Mode.compiled_lib_ext Mode.Byte) in
|
||||||
|
@ -471,8 +442,7 @@ module Gen(P : Params) = struct
|
||||||
[ Ocaml_flags.get flags mode
|
[ Ocaml_flags.get flags mode
|
||||||
; A "-o"; Target exe
|
; A "-o"; Target exe
|
||||||
; As link_flags
|
; As link_flags
|
||||||
; Dyn (fun (libs, _) -> Lib.link_flags libs ~context:ctx.name
|
; Dyn (fun (libs, _) -> Lib.link_flags libs ~mode)
|
||||||
~source_dir:Internal ~mode)
|
|
||||||
; Dyn (fun (_, cm_files) -> Deps cm_files)
|
; Dyn (fun (_, cm_files) -> Deps cm_files)
|
||||||
]);
|
]);
|
||||||
if mode = Mode.Byte then
|
if mode = Mode.Byte then
|
||||||
|
@ -724,7 +694,8 @@ Add it to your jbuild file to remove this warning.
|
||||||
match (stanza : Stanza.t) with
|
match (stanza : Stanza.t) with
|
||||||
| Library lib ->
|
| Library lib ->
|
||||||
Some (library_rules lib ~dir
|
Some (library_rules lib ~dir
|
||||||
~all_modules:(Lazy.force all_modules) ~files:(Lazy.force files))
|
~all_modules:(Lazy.force all_modules) ~files:(Lazy.force files)
|
||||||
|
~scope)
|
||||||
| Executables exes ->
|
| Executables exes ->
|
||||||
Some (executables_rules exes ~dir ~all_modules:(Lazy.force all_modules)
|
Some (executables_rules exes ~dir ~all_modules:(Lazy.force all_modules)
|
||||||
~scope)
|
~scope)
|
||||||
|
@ -874,20 +845,10 @@ Add it to your jbuild file to remove this warning.
|
||||||
sprintf "<module table for context %s>"
|
sprintf "<module table for context %s>"
|
||||||
(Path.to_string ctx.build_dir))
|
(Path.to_string ctx.build_dir))
|
||||||
in
|
in
|
||||||
let public_interfaces =
|
|
||||||
Ordered_set_lang.eval_with_standard lib.public_interfaces
|
|
||||||
~standard:(List.map modules ~f:(fun s -> s.Module.name))
|
|
||||||
|> String_set.of_list
|
|
||||||
in
|
|
||||||
List.concat
|
List.concat
|
||||||
[ List.concat_map modules ~f:(fun m ->
|
[ List.concat_map modules ~f:(fun m ->
|
||||||
let intf =
|
|
||||||
if String_set.mem m.Module.name public_interfaces
|
|
||||||
then [ Module.cm_file m ~dir Cmi ]
|
|
||||||
else []
|
|
||||||
in
|
|
||||||
List.concat
|
List.concat
|
||||||
[ intf
|
[ [ Module.cm_file m ~dir Cmi ]
|
||||||
; if_ native [ Module.cm_file m ~dir Cmx ]
|
; if_ native [ Module.cm_file m ~dir Cmx ]
|
||||||
; List.filter_map Ml_kind.all ~f:(Module.cmt_file m ~dir)
|
; List.filter_map Ml_kind.all ~f:(Module.cmt_file m ~dir)
|
||||||
; [ match Module.file m ~dir Intf with
|
; [ match Module.file m ~dir Intf with
|
||||||
|
|
|
@ -128,8 +128,6 @@ module Entry = struct
|
||||||
Path.relative main_dir dst
|
Path.relative main_dir dst
|
||||||
end
|
end
|
||||||
|
|
||||||
let lib_install_path ~package = Path.relative Entry.Paths.lib package.Package.name
|
|
||||||
|
|
||||||
module SMap = Map.Make(Section)
|
module SMap = Map.Make(Section)
|
||||||
|
|
||||||
let files entries =
|
let files entries =
|
||||||
|
|
|
@ -33,5 +33,3 @@ end
|
||||||
|
|
||||||
val files : Entry.t list -> Path.Set.t
|
val files : Entry.t list -> Path.Set.t
|
||||||
val gen_install_file : Entry.t list -> string
|
val gen_install_file : Entry.t list -> string
|
||||||
|
|
||||||
val lib_install_path: package:Package.t -> Path.t
|
|
||||||
|
|
|
@ -70,9 +70,6 @@ module Scope = struct
|
||||||
; root : Path.t
|
; root : Path.t
|
||||||
}
|
}
|
||||||
|
|
||||||
let compare t1 t2 = Path.compare t1.root t2.root
|
|
||||||
let name t = Option.value ~default:"[root]" t.name
|
|
||||||
|
|
||||||
let empty =
|
let empty =
|
||||||
{ name = None
|
{ name = None
|
||||||
; packages = String_map.empty
|
; packages = String_map.empty
|
||||||
|
@ -526,7 +523,6 @@ module Library = struct
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
{ name : string
|
{ name : string
|
||||||
; scope : Scope.t
|
|
||||||
; public : Public_lib.t option
|
; public : Public_lib.t option
|
||||||
; synopsis : string option
|
; synopsis : string option
|
||||||
; install_c_headers : string list
|
; install_c_headers : string list
|
||||||
|
@ -545,7 +541,6 @@ module Library = struct
|
||||||
; optional : bool
|
; optional : bool
|
||||||
; buildable : Buildable.t
|
; buildable : Buildable.t
|
||||||
; dynlink : bool
|
; dynlink : bool
|
||||||
; public_interfaces : Ordered_set_lang.t
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let v1 pkgs =
|
let v1 pkgs =
|
||||||
|
@ -569,15 +564,8 @@ module Library = struct
|
||||||
field_b "optional" >>= fun optional ->
|
field_b "optional" >>= fun optional ->
|
||||||
field "self_build_stubs_archive" (option string) ~default:None >>= fun self_build_stubs_archive ->
|
field "self_build_stubs_archive" (option string) ~default:None >>= fun self_build_stubs_archive ->
|
||||||
field_b "no_dynlink" >>= fun no_dynlink ->
|
field_b "no_dynlink" >>= fun no_dynlink ->
|
||||||
map_validate (field_o "public_interfaces" Ordered_set_lang.t) ~f:(fun public_interfaces ->
|
|
||||||
match public_interfaces, public with
|
|
||||||
| Some _, None ->
|
|
||||||
Error "Field 'public_interfaces' is not allowed for private libraries."
|
|
||||||
| _ -> Ok public_interfaces)
|
|
||||||
>>= fun public_interfaces ->
|
|
||||||
return
|
return
|
||||||
{ name
|
{ name
|
||||||
; scope = pkgs
|
|
||||||
; public
|
; public
|
||||||
; synopsis
|
; synopsis
|
||||||
; install_c_headers
|
; install_c_headers
|
||||||
|
@ -596,8 +584,6 @@ module Library = struct
|
||||||
; optional
|
; optional
|
||||||
; buildable
|
; buildable
|
||||||
; dynlink = not no_dynlink
|
; dynlink = not no_dynlink
|
||||||
; public_interfaces =
|
|
||||||
Option.value public_interfaces ~default:Ordered_set_lang.standard
|
|
||||||
})
|
})
|
||||||
|
|
||||||
let has_stubs t =
|
let has_stubs t =
|
||||||
|
|
|
@ -17,10 +17,6 @@ module Scope : sig
|
||||||
; root : Path.t
|
; root : Path.t
|
||||||
}
|
}
|
||||||
|
|
||||||
val compare : t -> t -> int
|
|
||||||
val name: t -> string
|
|
||||||
(** Pretty name *)
|
|
||||||
|
|
||||||
val make : Package.t list -> t
|
val make : Package.t list -> t
|
||||||
|
|
||||||
val empty : t
|
val empty : t
|
||||||
|
@ -132,7 +128,6 @@ module Library : sig
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
{ name : string
|
{ name : string
|
||||||
; scope : Scope.t
|
|
||||||
; public : Public_lib.t option
|
; public : Public_lib.t option
|
||||||
; synopsis : string option
|
; synopsis : string option
|
||||||
; install_c_headers : string list
|
; install_c_headers : string list
|
||||||
|
@ -151,7 +146,6 @@ module Library : sig
|
||||||
; optional : bool
|
; optional : bool
|
||||||
; buildable : Buildable.t
|
; buildable : Buildable.t
|
||||||
; dynlink : bool
|
; dynlink : bool
|
||||||
; public_interfaces : Ordered_set_lang.t
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val has_stubs : t -> bool
|
val has_stubs : t -> bool
|
||||||
|
|
36
src/lib.ml
36
src/lib.ml
|
@ -22,39 +22,23 @@ end
|
||||||
include T
|
include T
|
||||||
module Set = Set.Make(T)
|
module Set = Set.Make(T)
|
||||||
|
|
||||||
module Source_dir = struct
|
let dir = function
|
||||||
type t =
|
| Internal (dir, _) -> dir
|
||||||
| Internal
|
|
||||||
| Install
|
|
||||||
end
|
|
||||||
|
|
||||||
let dir ~context ~source_dir = function
|
|
||||||
| Internal (dir, lib) -> begin
|
|
||||||
match lib.public, (source_dir : Source_dir.t) with
|
|
||||||
| None, _ | _, Internal ->
|
|
||||||
dir
|
|
||||||
| Some { package; sub_dir; _ }, Install ->
|
|
||||||
let install_dir = Config.local_install_dir ~context in
|
|
||||||
let dir = Path.append install_dir (Install.lib_install_path ~package) in
|
|
||||||
match sub_dir with
|
|
||||||
| None -> dir
|
|
||||||
| Some x -> Path.relative dir x
|
|
||||||
end
|
|
||||||
| External pkg -> pkg.dir
|
| External pkg -> pkg.dir
|
||||||
|
|
||||||
let include_paths ~context ~source_dir ts =
|
let include_paths ts =
|
||||||
List.fold_left ts ~init:Path.Set.empty ~f:(fun acc t ->
|
List.fold_left ts ~init:Path.Set.empty ~f:(fun acc t ->
|
||||||
Path.Set.add (dir ~context ~source_dir t) acc)
|
Path.Set.add (dir t) acc)
|
||||||
|
|
||||||
let include_flags ~context ~source_dir ts =
|
let include_flags ts =
|
||||||
let dirs = include_paths ~context ~source_dir ts in
|
let dirs = include_paths ts in
|
||||||
Arg_spec.S (List.concat_map (Path.Set.elements dirs) ~f:(fun dir ->
|
Arg_spec.S (List.concat_map (Path.Set.elements dirs) ~f:(fun dir ->
|
||||||
[Arg_spec.A "-I"; Path dir]))
|
[Arg_spec.A "-I"; Path dir]))
|
||||||
|
|
||||||
let c_include_flags ~context ~source_dir ts =
|
let c_include_flags ts =
|
||||||
let dirs =
|
let dirs =
|
||||||
List.fold_left ts ~init:Path.Set.empty ~f:(fun acc t ->
|
List.fold_left ts ~init:Path.Set.empty ~f:(fun acc t ->
|
||||||
Path.Set.add (dir ~context ~source_dir t) acc)
|
Path.Set.add (dir t) acc)
|
||||||
in
|
in
|
||||||
Arg_spec.S (List.concat_map (Path.Set.elements dirs) ~f:(fun dir ->
|
Arg_spec.S (List.concat_map (Path.Set.elements dirs) ~f:(fun dir ->
|
||||||
[Arg_spec.A "-I"; Path dir]))
|
[Arg_spec.A "-I"; Path dir]))
|
||||||
|
@ -68,9 +52,9 @@ let describe = function
|
||||||
| External pkg ->
|
| External pkg ->
|
||||||
sprintf "%s (external)" pkg.name
|
sprintf "%s (external)" pkg.name
|
||||||
|
|
||||||
let link_flags ~context ~source_dir ts ~mode =
|
let link_flags ts ~mode =
|
||||||
Arg_spec.S
|
Arg_spec.S
|
||||||
(include_flags ~context ~source_dir ts ::
|
(include_flags ts ::
|
||||||
List.map ts ~f:(fun t ->
|
List.map ts ~f:(fun t ->
|
||||||
match t with
|
match t with
|
||||||
| External pkg ->
|
| External pkg ->
|
||||||
|
|
33
src/lib.mli
33
src/lib.mli
|
@ -12,38 +12,13 @@ module Set : Set.S with type elt := t
|
||||||
|
|
||||||
(*val deps : t -> string list*)
|
(*val deps : t -> string list*)
|
||||||
|
|
||||||
module Source_dir : sig
|
val include_paths : t list -> Path.Set.t
|
||||||
(** Which include directory to use for internal public libraries *)
|
|
||||||
type t =
|
|
||||||
| Internal (** use the directory from "_build/<context>" *)
|
|
||||||
| Install (** use the directory from "_build/install/<context>" *)
|
|
||||||
end
|
|
||||||
|
|
||||||
(** The scope given is the current one *)
|
val include_flags : t list -> _ Arg_spec.t
|
||||||
val include_paths
|
|
||||||
: context:string
|
|
||||||
-> source_dir:Source_dir.t
|
|
||||||
-> t list
|
|
||||||
-> Path.Set.t
|
|
||||||
|
|
||||||
val include_flags
|
val c_include_flags : t list -> _ Arg_spec.t
|
||||||
: context:string
|
|
||||||
-> source_dir:Source_dir.t
|
|
||||||
-> t list
|
|
||||||
-> _ Arg_spec.t
|
|
||||||
|
|
||||||
val c_include_flags
|
val link_flags : t list -> mode:Mode.t -> _ Arg_spec.t
|
||||||
: context:string
|
|
||||||
-> source_dir:Source_dir.t
|
|
||||||
-> t list
|
|
||||||
-> _ Arg_spec.t
|
|
||||||
|
|
||||||
val link_flags
|
|
||||||
: context:string
|
|
||||||
-> source_dir:Source_dir.t
|
|
||||||
-> t list
|
|
||||||
-> mode:Mode.t
|
|
||||||
-> _ Arg_spec.t
|
|
||||||
|
|
||||||
val archive_files : t list -> mode:Mode.t -> ext_lib:string -> Path.t list
|
val archive_files : t list -> mode:Mode.t -> ext_lib:string -> Path.t list
|
||||||
|
|
||||||
|
|
|
@ -9,3 +9,4 @@ type t =
|
||||||
|
|
||||||
(** Add rules for generating the .merlin in a directory *)
|
(** Add rules for generating the .merlin in a directory *)
|
||||||
val add_rules : Super_context.t -> dir:Path.t -> t list -> unit
|
val add_rules : Super_context.t -> dir:Path.t -> t list -> unit
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ let build_cm sctx ?sandbox ~dynlink ~flags ~cm_kind ~(dep_graph:Ocamldep.dep_gra
|
||||||
~extra_targets
|
~extra_targets
|
||||||
[ Ocaml_flags.get_for_cm flags ~cm_kind
|
[ Ocaml_flags.get_for_cm flags ~cm_kind
|
||||||
; cmt_args
|
; cmt_args
|
||||||
; Dyn (Lib.include_flags ~context:ctx.name ~source_dir:Install)
|
; Dyn Lib.include_flags
|
||||||
; As extra_args
|
; As extra_args
|
||||||
; if dynlink || cm_kind <> Cmx then As [] else A "-nodynlink"
|
; if dynlink || cm_kind <> Cmx then As [] else A "-nodynlink"
|
||||||
; A "-no-alias-deps"
|
; A "-no-alias-deps"
|
||||||
|
|
|
@ -134,7 +134,7 @@ let setup_library_rules sctx (lib : Library.t) ~dir ~modules ~requires
|
||||||
(requires
|
(requires
|
||||||
>>>
|
>>>
|
||||||
SC.Libs.file_deps sctx ~ext:odoc_ext
|
SC.Libs.file_deps sctx ~ext:odoc_ext
|
||||||
>>^ Lib.include_flags ~context:context.name ~source_dir:Internal)
|
>>^ Lib.include_flags)
|
||||||
in
|
in
|
||||||
let modules_and_odoc_files =
|
let modules_and_odoc_files =
|
||||||
List.map (String_map.values modules)
|
List.map (String_map.values modules)
|
||||||
|
|
|
@ -786,7 +786,7 @@ module PP = struct
|
||||||
>>>
|
>>>
|
||||||
Build.run ~context:ctx (Dep compiler)
|
Build.run ~context:ctx (Dep compiler)
|
||||||
[ A "-o" ; Target target
|
[ A "-o" ; Target target
|
||||||
; Dyn (Lib.link_flags ~context:ctx.name ~source_dir:Internal ~mode)
|
; Dyn (Lib.link_flags ~mode)
|
||||||
])
|
])
|
||||||
|
|
||||||
let get_ppx_driver sctx pps ~dir ~dep_kind =
|
let get_ppx_driver sctx pps ~dir ~dep_kind =
|
||||||
|
|
12
test/jbuild
12
test/jbuild
|
@ -104,15 +104,3 @@
|
||||||
(deps ((alias sleep5)
|
(deps ((alias sleep5)
|
||||||
(alias sleep4-and-fail)
|
(alias sleep4-and-fail)
|
||||||
(alias sleep1-and-fail)))))
|
(alias sleep1-and-fail)))))
|
||||||
|
|
||||||
(alias
|
|
||||||
((name runtest)
|
|
||||||
(deps ((files_recursively_in workspaces/public_interfaces)))
|
|
||||||
(action
|
|
||||||
(chdir workspaces/public_interfaces
|
|
||||||
(progn
|
|
||||||
(run ${exe:run.exe} -log log1 --
|
|
||||||
${bin:jbuilder} build --verbose -j1 @install --root . --only good,mylib,mylib2)
|
|
||||||
(run ${exe:run.exe} -log log2 -inverse --
|
|
||||||
${bin:jbuilder} build -j1 @install --root . --only bad,mylib,mylib2
|
|
||||||
))))))
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
(library (
|
|
||||||
(name bad)
|
|
||||||
(public_name bad)
|
|
||||||
(libraries (mylib))
|
|
||||||
))
|
|
|
@ -1 +0,0 @@
|
||||||
let () = Printf.printf "%s" Mylib.Bad.v
|
|
|
@ -1,5 +0,0 @@
|
||||||
(library (
|
|
||||||
(name good)
|
|
||||||
(public_name good)
|
|
||||||
(libraries (mylib mylib2.see_private))
|
|
||||||
))
|
|
|
@ -1 +0,0 @@
|
||||||
let () = Printf.printf "%s (and bad size is %i)" Mylib.Good.v Mylib2_see_private.See_private.nb_bad
|
|
|
@ -1 +0,0 @@
|
||||||
let v = "Bad"
|
|
|
@ -1 +0,0 @@
|
||||||
let v = "Good"
|
|
|
@ -1,13 +0,0 @@
|
||||||
(library (
|
|
||||||
(name mylib)
|
|
||||||
(public_name mylib)
|
|
||||||
(modules (good bad))
|
|
||||||
(public_interfaces (:standard \ Bad))
|
|
||||||
))
|
|
||||||
|
|
||||||
(library (
|
|
||||||
(name mylib2_see_private)
|
|
||||||
(public_name mylib2.see_private)
|
|
||||||
(modules (see_private))
|
|
||||||
(libraries (mylib))
|
|
||||||
))
|
|
|
@ -1 +0,0 @@
|
||||||
let nb_bad = String.length Mylib.Bad.v
|
|
Loading…
Reference in New Issue