Merge pull request #1119 from ocaml/rename-jbuild-module
Rename Jbuild module to Dune_file
This commit is contained in:
commit
4ecca14b70
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
type t =
|
||||
{ context : Context.t
|
||||
|
|
|
@ -206,13 +206,13 @@ module Rule = struct
|
|||
; build : (unit, Action.t) Build.t
|
||||
; targets : Target.t list
|
||||
; sandbox : bool
|
||||
; mode : Jbuild.Rule.Mode.t
|
||||
; mode : Dune_file.Rule.Mode.t
|
||||
; locks : Path.t list
|
||||
; loc : Loc.t option
|
||||
; dir : Path.t
|
||||
}
|
||||
|
||||
let make ?(sandbox=false) ?(mode=Jbuild.Rule.Mode.Not_a_rule_stanza)
|
||||
let make ?(sandbox=false) ?(mode=Dune_file.Rule.Mode.Not_a_rule_stanza)
|
||||
~context ?(locks=[]) ?loc build =
|
||||
let targets = targets build in
|
||||
let dir =
|
||||
|
|
|
@ -15,7 +15,7 @@ module Rule : sig
|
|||
; build : (unit, Action.t) Build.t
|
||||
; targets : Target.t list
|
||||
; sandbox : bool
|
||||
; mode : Jbuild.Rule.Mode.t
|
||||
; mode : Dune_file.Rule.Mode.t
|
||||
; locks : Path.t list
|
||||
; loc : Loc.t option
|
||||
; (** Directory where all the targets are produced *)
|
||||
|
@ -24,7 +24,7 @@ module Rule : sig
|
|||
|
||||
val make
|
||||
: ?sandbox:bool
|
||||
-> ?mode:Jbuild.Rule.Mode.t
|
||||
-> ?mode:Dune_file.Rule.Mode.t
|
||||
-> context:Context.t option
|
||||
-> ?locks:Path.t list
|
||||
-> ?loc:Loc.t
|
||||
|
|
|
@ -112,7 +112,7 @@ module Internal_rule = struct
|
|||
; targets : Path.Set.t
|
||||
; context : Context.t option
|
||||
; build : (unit, Action.t) Build.t
|
||||
; mode : Jbuild.Rule.Mode.t
|
||||
; mode : Dune_file.Rule.Mode.t
|
||||
; loc : Loc.t option
|
||||
; dir : Path.t
|
||||
; mutable exec : Exec_status.t
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
open Import
|
||||
module Menhir_rules = Menhir
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
open! No_io
|
||||
|
||||
module Modules_field_evaluator : sig
|
||||
|
@ -228,7 +228,7 @@ type t =
|
|||
; dir : Path.t
|
||||
; text_files : String.Set.t
|
||||
; modules : modules Lazy.t
|
||||
; mlds : (Jbuild.Documentation.t * Path.t list) list Lazy.t
|
||||
; mlds : (Dune_file.Documentation.t * Path.t list) list Lazy.t
|
||||
}
|
||||
|
||||
and kind =
|
||||
|
@ -312,7 +312,7 @@ let load_text_files sctx ft_dir d =
|
|||
(* Manually add files generated by the (select ...)
|
||||
dependencies *)
|
||||
List.filter_map buildable.libraries ~f:(fun dep ->
|
||||
match (dep : Jbuild.Lib_dep.t) with
|
||||
match (dep : Dune_file.Lib_dep.t) with
|
||||
| Direct _ -> None
|
||||
| Select s -> Some s.result_fn)
|
||||
| _ -> [])
|
||||
|
|
|
@ -34,10 +34,10 @@ val modules_of_library : t -> name:string -> Library_modules.t
|
|||
val modules_of_executables : t -> first_exe:string -> Executables_modules.t
|
||||
|
||||
(** Find out what buildable a module is part of *)
|
||||
val lookup_module : t -> Module.Name.t -> Jbuild.Buildable.t option
|
||||
val lookup_module : t -> Module.Name.t -> Dune_file.Buildable.t option
|
||||
|
||||
(** All mld files attached to this documentation stanza *)
|
||||
val mlds : t -> Jbuild.Documentation.t -> Path.t list
|
||||
val mlds : t -> Dune_file.Documentation.t -> Path.t list
|
||||
|
||||
val get : Super_context.t -> dir:Path.t -> t
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ module Linkage = struct
|
|||
let so_flags_windows = o_flags
|
||||
let so_flags_unix = ["-output-complete-obj"; "-runtime-variant"; "_pic"]
|
||||
|
||||
let of_user_config (ctx : Context.t) (m : Jbuild.Executables.Link_mode.t) =
|
||||
let of_user_config (ctx : Context.t) (m : Dune_file.Executables.Link_mode.t) =
|
||||
let wanted_mode : Mode.t =
|
||||
match m.mode with
|
||||
| Byte -> Byte
|
||||
|
@ -110,7 +110,7 @@ let link_exe
|
|||
~(linkage:Linkage.t)
|
||||
~top_sorted_modules
|
||||
?(link_flags=Build.arr (fun _ -> []))
|
||||
?(js_of_ocaml=Jbuild.Js_of_ocaml.default)
|
||||
?(js_of_ocaml=Dune_file.Js_of_ocaml.default)
|
||||
cctx
|
||||
=
|
||||
let sctx = CC.super_context cctx in
|
||||
|
@ -174,7 +174,7 @@ let build_and_link_many
|
|||
~programs
|
||||
~linkages
|
||||
?link_flags
|
||||
?(js_of_ocaml=Jbuild.Js_of_ocaml.default)
|
||||
?(js_of_ocaml=Dune_file.Js_of_ocaml.default)
|
||||
cctx
|
||||
=
|
||||
let dep_graphs = Ocamldep.rules cctx in
|
||||
|
|
|
@ -29,7 +29,7 @@ module Linkage : sig
|
|||
-> unit
|
||||
-> t
|
||||
|
||||
val of_user_config : Context.t -> Jbuild.Executables.Link_mode.t -> t
|
||||
val of_user_config : Context.t -> Dune_file.Executables.Link_mode.t -> t
|
||||
end
|
||||
|
||||
(** {1 High-level functions} *)
|
||||
|
@ -40,7 +40,7 @@ val build_and_link
|
|||
: program:Program.t
|
||||
-> linkages:Linkage.t list
|
||||
-> ?link_flags:(unit, string list) Build.t
|
||||
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t
|
||||
-> ?js_of_ocaml:Dune_file.Js_of_ocaml.t
|
||||
-> Compilation_context.t
|
||||
-> unit
|
||||
|
||||
|
@ -48,7 +48,7 @@ val build_and_link_many
|
|||
: programs:Program.t list
|
||||
-> linkages:Linkage.t list
|
||||
-> ?link_flags:(unit, string list) Build.t
|
||||
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t
|
||||
-> ?js_of_ocaml:Dune_file.Js_of_ocaml.t
|
||||
-> Compilation_context.t
|
||||
-> unit
|
||||
|
||||
|
@ -60,6 +60,6 @@ val link_exe
|
|||
-> linkage:Linkage.t
|
||||
-> top_sorted_modules:(unit, Module.t list) Build.t
|
||||
-> ?link_flags:(unit, string list) Build.t
|
||||
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t
|
||||
-> ?js_of_ocaml:Dune_file.Js_of_ocaml.t
|
||||
-> Compilation_context.t
|
||||
-> unit
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
open Import
|
||||
module Menhir_rules = Menhir
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
open Build.O
|
||||
open! No_io
|
||||
|
||||
|
@ -548,7 +548,7 @@ module Gen(P : Install_rules.Params) = struct
|
|||
let compile_info =
|
||||
Lib.DB.resolve_user_written_deps (Scope.libs scope)
|
||||
exes.buildable.libraries
|
||||
~pps:(Jbuild.Preprocess_map.pps exes.buildable.preprocess)
|
||||
~pps:(Dune_file.Preprocess_map.pps exes.buildable.preprocess)
|
||||
~allow_overlaps:exes.buildable.allow_overlapping_dependencies
|
||||
in
|
||||
SC.Libs.gen_select_rules sctx compile_info ~dir;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
open Build.O
|
||||
open! No_io
|
||||
|
||||
|
@ -18,7 +18,7 @@ module Backend = struct
|
|||
; extends : (Loc.t * string) list
|
||||
}
|
||||
|
||||
type Jbuild.Sub_system_info.t += T of t
|
||||
type Dune_file.Sub_system_info.t += T of t
|
||||
|
||||
let loc t = t.loc
|
||||
|
||||
|
@ -112,7 +112,7 @@ include Sub_system.Register_end_point(
|
|||
; libraries : (Loc.t * string) list
|
||||
}
|
||||
|
||||
type Jbuild.Sub_system_info.t += T of t
|
||||
type Dune_file.Sub_system_info.t += T of t
|
||||
|
||||
let empty loc =
|
||||
{ loc
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
open Build.O
|
||||
open! No_io
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ let parse_sub_systems ~parsing_context sexps =
|
|||
| Error (name, _, (loc, _, _)) ->
|
||||
Loc.fail loc "%S present twice" (Sub_system_name.to_string name))
|
||||
|> Sub_system_name.Map.mapi ~f:(fun name (_, version, data) ->
|
||||
let (module M) = Jbuild.Sub_system_info.get name in
|
||||
let (module M) = Dune_file.Sub_system_info.get name in
|
||||
Syntax.check_supported M.syntax version;
|
||||
let parsing_context =
|
||||
(* We set the syntax to the version used when generating this subsystem.
|
||||
|
@ -89,7 +89,7 @@ let gen ~(dune_version : Syntax.Version.t) confs =
|
|||
let sexps =
|
||||
Sub_system_name.Map.to_list confs
|
||||
|> List.map ~f:(fun (name, (ver, conf)) ->
|
||||
let (module M) = Jbuild.Sub_system_info.get name in
|
||||
let (module M) = Dune_file.Sub_system_info.get name in
|
||||
Sexp.List [ Sexp.atom (Sub_system_name.to_string name)
|
||||
; Syntax.Version.sexp_of_t ver
|
||||
; conf
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
open Stdune
|
||||
|
||||
val load : Path.t -> Jbuild.Sub_system_info.t Sub_system_name.Map.t
|
||||
val load : Path.t -> Dune_file.Sub_system_info.t Sub_system_name.Map.t
|
||||
val gen
|
||||
: dune_version:Syntax.Version.t
|
||||
-> (Syntax.Version.t * Sexp.t) Sub_system_name.Map.t
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
module Jbuild = struct
|
||||
type t =
|
||||
|
|
|
@ -4,7 +4,7 @@ module Jbuild : sig
|
|||
type t =
|
||||
{ dir : Path.t
|
||||
; project : Dune_project.t
|
||||
; stanzas : Jbuild.Stanzas.t
|
||||
; stanzas : Dune_file.Stanzas.t
|
||||
; kind : File_tree.Dune_file.Kind.t
|
||||
}
|
||||
end
|
||||
|
|
|
@ -109,7 +109,7 @@ let link_rule cc ~runtime ~target =
|
|||
; Arg_spec.Dyn get_all
|
||||
]
|
||||
|
||||
let build_cm cc ~(js_of_ocaml:Jbuild.Js_of_ocaml.t) ~src ~target =
|
||||
let build_cm cc ~(js_of_ocaml:Dune_file.Js_of_ocaml.t) ~src ~target =
|
||||
let sctx = Compilation_context.super_context cc in
|
||||
let dir = Compilation_context.dir cc in
|
||||
if separate_compilation_enabled sctx
|
||||
|
@ -164,7 +164,7 @@ let setup_separate_compilation_rules sctx components =
|
|||
As flags) ~spec ~target))
|
||||
|
||||
let build_exe cc ~js_of_ocaml ~src =
|
||||
let {Jbuild.Js_of_ocaml.javascript_files; _} = js_of_ocaml in
|
||||
let {Dune_file.Js_of_ocaml.javascript_files; _} = js_of_ocaml in
|
||||
let javascript_files =
|
||||
List.map javascript_files ~f:(Path.relative (Compilation_context.dir cc)) in
|
||||
let mk_target ext = Path.extend_basename src ~suffix:ext in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(** Generate rules for js_of_ocaml *)
|
||||
|
||||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
val build_cm
|
||||
: Compilation_context.t
|
||||
|
|
42
src/lib.ml
42
src/lib.ml
|
@ -28,10 +28,10 @@ module Info = struct
|
|||
module Deps = struct
|
||||
type t =
|
||||
| Simple of (Loc.t * string) list
|
||||
| Complex of Jbuild.Lib_dep.t list
|
||||
| Complex of Dune_file.Lib_dep.t list
|
||||
|
||||
let of_lib_deps deps =
|
||||
let rec loop acc (deps : Jbuild.Lib_dep.t list) =
|
||||
let rec loop acc (deps : Dune_file.Lib_dep.t list) =
|
||||
match deps with
|
||||
| [] -> Some (List.rev acc)
|
||||
| Direct x :: deps -> loop (x :: acc) deps
|
||||
|
@ -42,13 +42,13 @@ module Info = struct
|
|||
| None -> Complex deps
|
||||
|
||||
let to_lib_deps = function
|
||||
| Simple l -> List.map l ~f:Jbuild.Lib_dep.direct
|
||||
| Simple l -> List.map l ~f:Dune_file.Lib_dep.direct
|
||||
| Complex l -> l
|
||||
end
|
||||
|
||||
type t =
|
||||
{ loc : Loc.t
|
||||
; kind : Jbuild.Library.Kind.t
|
||||
; kind : Dune_file.Library.Kind.t
|
||||
; status : Status.t
|
||||
; src_dir : Path.t
|
||||
; obj_dir : Path.t
|
||||
|
@ -60,26 +60,26 @@ module Info = struct
|
|||
; jsoo_runtime : Path.t list
|
||||
; requires : Deps.t
|
||||
; ppx_runtime_deps : (Loc.t * string) list
|
||||
; pps : (Loc.t * Jbuild.Pp.t) list
|
||||
; pps : (Loc.t * Dune_file.Pp.t) list
|
||||
; optional : bool
|
||||
; virtual_deps : (Loc.t * string) list
|
||||
; dune_version : Syntax.Version.t option
|
||||
; sub_systems : Jbuild.Sub_system_info.t Sub_system_name.Map.t
|
||||
; sub_systems : Dune_file.Sub_system_info.t Sub_system_name.Map.t
|
||||
}
|
||||
|
||||
let user_written_deps t =
|
||||
List.fold_left (t.virtual_deps @ t.ppx_runtime_deps)
|
||||
~init:(Deps.to_lib_deps t.requires)
|
||||
~f:(fun acc s -> Jbuild.Lib_dep.Direct s :: acc)
|
||||
~f:(fun acc s -> Dune_file.Lib_dep.Direct s :: acc)
|
||||
|
||||
let of_library_stanza ~dir (conf : Jbuild.Library.t) =
|
||||
let of_library_stanza ~dir (conf : Dune_file.Library.t) =
|
||||
let archive_file ext = Path.relative dir (conf.name ^ ext) in
|
||||
let archive_files ~f_ext =
|
||||
Mode.Dict.of_func (fun ~mode -> [archive_file (f_ext mode)])
|
||||
in
|
||||
let stubs =
|
||||
if Jbuild.Library.has_stubs conf then
|
||||
[Jbuild.Library.stubs_archive conf ~dir ~ext_lib:""]
|
||||
if Dune_file.Library.has_stubs conf then
|
||||
[Dune_file.Library.stubs_archive conf ~dir ~ext_lib:""]
|
||||
else
|
||||
[]
|
||||
in
|
||||
|
@ -113,7 +113,7 @@ module Info = struct
|
|||
; virtual_deps = conf.virtual_deps
|
||||
; requires = Deps.of_lib_deps conf.buildable.libraries
|
||||
; ppx_runtime_deps = conf.ppx_runtime_libraries
|
||||
; pps = Jbuild.Preprocess_map.pps conf.buildable.preprocess
|
||||
; pps = Dune_file.Preprocess_map.pps conf.buildable.preprocess
|
||||
; sub_systems = conf.sub_systems
|
||||
; dune_version = Some conf.dune_version
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ type t =
|
|||
; ppx_runtime_deps : t list Or_exn.t
|
||||
; pps : t list Or_exn.t
|
||||
; resolved_selects : Resolved_select.t list
|
||||
; user_written_deps : Jbuild.Lib_deps.t
|
||||
; user_written_deps : Dune_file.Lib_deps.t
|
||||
; (* This is mutable to avoid this error:
|
||||
|
||||
{[
|
||||
|
@ -447,7 +447,7 @@ module Sub_system = struct
|
|||
type t = sub_system = ..
|
||||
|
||||
module type S = sig
|
||||
module Info : Jbuild.Sub_system_info.S
|
||||
module Info : Dune_file.Sub_system_info.S
|
||||
type t
|
||||
type sub_system += T of t
|
||||
val instantiate
|
||||
|
@ -745,7 +745,7 @@ and resolve_complex_deps db deps ~allow_private_deps ~stack =
|
|||
let res, resolved_selects =
|
||||
List.fold_left deps ~init:(Ok [], []) ~f:(fun (acc_res, acc_selects) dep ->
|
||||
let res, acc_selects =
|
||||
match (dep : Jbuild.Lib_dep.t) with
|
||||
match (dep : Dune_file.Lib_dep.t) with
|
||||
| Direct (loc, name) ->
|
||||
let res =
|
||||
resolve_dep db name ~allow_private_deps ~loc ~stack >>| fun x -> [x]
|
||||
|
@ -813,7 +813,7 @@ and resolve_user_deps db deps ~allow_private_deps ~pps ~stack =
|
|||
{ (fst first) with stop = (fst last).stop }
|
||||
in
|
||||
let pps =
|
||||
let pps = (pps : (Loc.t * Jbuild.Pp.t) list :> (Loc.t * string) list) in
|
||||
let pps = (pps : (Loc.t * Dune_file.Pp.t) list :> (Loc.t * string) list) in
|
||||
resolve_simple_deps db pps ~allow_private_deps:true ~stack
|
||||
>>= fun pps ->
|
||||
closure_with_overlap_checks None pps ~stack
|
||||
|
@ -909,7 +909,7 @@ module Compile = struct
|
|||
; pps : t list Or_exn.t
|
||||
; resolved_selects : Resolved_select.t list
|
||||
; optional : bool
|
||||
; user_written_deps : Jbuild.Lib_deps.t
|
||||
; user_written_deps : Dune_file.Lib_deps.t
|
||||
; sub_systems : Sub_system0.Instance.t Lazy.t Sub_system_name.Map.t
|
||||
}
|
||||
|
||||
|
@ -959,13 +959,13 @@ module DB = struct
|
|||
|
||||
let create_from_library_stanzas ?parent stanzas =
|
||||
let map =
|
||||
List.concat_map stanzas ~f:(fun (dir, (conf : Jbuild.Library.t)) ->
|
||||
List.concat_map stanzas ~f:(fun (dir, (conf : Dune_file.Library.t)) ->
|
||||
let info = Info.of_library_stanza ~dir conf in
|
||||
match conf.public with
|
||||
| None ->
|
||||
[(conf.name, Resolve_result.Found info)]
|
||||
| Some p ->
|
||||
let name = Jbuild.Public_lib.name p in
|
||||
let name = Dune_file.Public_lib.name p in
|
||||
if name = conf.name then
|
||||
[(name, Found info)]
|
||||
else
|
||||
|
@ -977,11 +977,11 @@ module DB = struct
|
|||
| Ok x -> x
|
||||
| Error (name, _, _) ->
|
||||
match
|
||||
List.filter_map stanzas ~f:(fun (_, (conf : Jbuild.Library.t)) ->
|
||||
List.filter_map stanzas ~f:(fun (_, (conf : Dune_file.Library.t)) ->
|
||||
if name = conf.name ||
|
||||
match conf.public with
|
||||
| None -> false
|
||||
| Some p -> name = Jbuild.Public_lib.name p
|
||||
| Some p -> name = Dune_file.Public_lib.name p
|
||||
then Some conf.buildable.loc
|
||||
else None)
|
||||
with
|
||||
|
@ -1077,7 +1077,7 @@ module DB = struct
|
|||
|
||||
let resolve_pps t pps =
|
||||
resolve_simple_deps t ~allow_private_deps:true
|
||||
(pps : (Loc.t *Jbuild.Pp.t) list :> (Loc.t * string) list)
|
||||
(pps : (Loc.t * Dune_file.Pp.t) list :> (Loc.t * string) list)
|
||||
~stack:Dep_stack.empty
|
||||
|
||||
let rec all ?(recursive=false) t =
|
||||
|
|
24
src/lib.mli
24
src/lib.mli
|
@ -21,7 +21,7 @@ val obj_dir : t -> Path.t
|
|||
val is_local : t -> bool
|
||||
|
||||
val synopsis : t -> string option
|
||||
val kind : t -> Jbuild.Library.Kind.t
|
||||
val kind : t -> Dune_file.Library.Kind.t
|
||||
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
|
||||
|
@ -83,14 +83,14 @@ module Info : sig
|
|||
module Deps : sig
|
||||
type t =
|
||||
| Simple of (Loc.t * string) list
|
||||
| Complex of Jbuild.Lib_dep.t list
|
||||
| Complex of Dune_file.Lib_dep.t list
|
||||
end
|
||||
|
||||
(** Raw description of a library, where dependencies are not
|
||||
resolved. *)
|
||||
type t =
|
||||
{ loc : Loc.t
|
||||
; kind : Jbuild.Library.Kind.t
|
||||
; kind : Dune_file.Library.Kind.t
|
||||
; status : Status.t
|
||||
; src_dir : Path.t
|
||||
; obj_dir : Path.t
|
||||
|
@ -102,14 +102,14 @@ module Info : sig
|
|||
; jsoo_runtime : Path.t list
|
||||
; requires : Deps.t
|
||||
; ppx_runtime_deps : (Loc.t * string) list
|
||||
; pps : (Loc.t * Jbuild.Pp.t) list
|
||||
; pps : (Loc.t * Dune_file.Pp.t) list
|
||||
; optional : bool
|
||||
; virtual_deps : (Loc.t * string) list
|
||||
; dune_version : Syntax.Version.t option
|
||||
; sub_systems : Jbuild.Sub_system_info.t Sub_system_name.Map.t
|
||||
; sub_systems : Dune_file.Sub_system_info.t Sub_system_name.Map.t
|
||||
}
|
||||
|
||||
val of_library_stanza : dir:Path.t -> Jbuild.Library.t -> t
|
||||
val of_library_stanza : dir:Path.t -> Dune_file.Library.t -> t
|
||||
val of_findlib_package : Findlib.Package.t -> t
|
||||
end
|
||||
|
||||
|
@ -216,7 +216,7 @@ module Compile : sig
|
|||
val pps : t -> L.t Or_exn.t
|
||||
|
||||
val optional : t -> bool
|
||||
val user_written_deps : t -> Jbuild.Lib_deps.t
|
||||
val user_written_deps : t -> Dune_file.Lib_deps.t
|
||||
|
||||
(** Sub-systems used in this compilation context *)
|
||||
val sub_systems : t -> sub_system list
|
||||
|
@ -257,7 +257,7 @@ module DB : sig
|
|||
(** Create a database from a list of library stanzas *)
|
||||
val create_from_library_stanzas
|
||||
: ?parent:t
|
||||
-> (Path.t * Jbuild.Library.t) list
|
||||
-> (Path.t * Dune_file.Library.t) list
|
||||
-> t
|
||||
|
||||
val create_from_findlib
|
||||
|
@ -289,13 +289,13 @@ module DB : sig
|
|||
val resolve_user_written_deps
|
||||
: t
|
||||
-> ?allow_overlaps:bool
|
||||
-> Jbuild.Lib_dep.t list
|
||||
-> pps:(Loc.t * Jbuild.Pp.t) list
|
||||
-> Dune_file.Lib_dep.t list
|
||||
-> pps:(Loc.t * Dune_file.Pp.t) list
|
||||
-> Compile.t
|
||||
|
||||
val resolve_pps
|
||||
: t
|
||||
-> (Loc.t * Jbuild.Pp.t) list
|
||||
-> (Loc.t * Dune_file.Pp.t) list
|
||||
-> L.t Or_exn.t
|
||||
|
||||
(** Return the list of all libraries in this database. If
|
||||
|
@ -316,7 +316,7 @@ module Sub_system : sig
|
|||
type t = sub_system = ..
|
||||
|
||||
module type S = sig
|
||||
module Info : Jbuild.Sub_system_info.S
|
||||
module Info : Dune_file.Sub_system_info.S
|
||||
type t
|
||||
type sub_system += T of t
|
||||
val instantiate
|
||||
|
|
|
@ -9,7 +9,7 @@ module SC = Super_context
|
|||
(* This signature describes the input of the functor [Run], which follows. *)
|
||||
|
||||
type stanza =
|
||||
Jbuild.Menhir.t
|
||||
Dune_file.Menhir.t
|
||||
|
||||
module type PARAMS = sig
|
||||
|
||||
|
@ -140,13 +140,13 @@ end
|
|||
|
||||
(* The final glue. *)
|
||||
|
||||
let targets (stanza : Jbuild.Menhir.t) =
|
||||
let targets (stanza : Dune_file.Menhir.t) =
|
||||
let f m = [m ^ ".ml"; m ^ ".mli"] in
|
||||
match stanza.merge_into with
|
||||
| Some m -> f m
|
||||
| None -> List.concat_map stanza.modules ~f
|
||||
|
||||
let module_names (stanza : Jbuild.Menhir.t) =
|
||||
let module_names (stanza : Dune_file.Menhir.t) =
|
||||
match stanza.merge_into with
|
||||
| Some m -> [Module.Name.of_string m]
|
||||
| None -> List.map stanza.modules ~f:Module.Name.of_string
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
(** Return the list of targets that are generated by this stanza. This
|
||||
list of targets is used by the code that computes the list of
|
||||
modules in the directory. *)
|
||||
val targets : Jbuild.Menhir.t -> string list
|
||||
val targets : Dune_file.Menhir.t -> string list
|
||||
|
||||
(** Return the list of modules that are generated by this stanza. *)
|
||||
val module_names : Jbuild.Menhir.t -> Module.Name.t list
|
||||
val module_names : Dune_file.Menhir.t -> Module.Name.t list
|
||||
|
||||
(** Generate the rules for a [(menhir ...)] stanza. *)
|
||||
val gen_rules
|
||||
: Compilation_context.t
|
||||
-> Jbuild.Menhir.t
|
||||
-> Dune_file.Menhir.t
|
||||
-> unit
|
||||
|
|
|
@ -6,10 +6,10 @@ module SC = Super_context
|
|||
|
||||
module Preprocess = struct
|
||||
type t =
|
||||
| Pps of Jbuild.Preprocess.pps
|
||||
| Pps of Dune_file.Preprocess.pps
|
||||
| Other
|
||||
|
||||
let make : Jbuild.Preprocess.t -> t = function
|
||||
let make : Dune_file.Preprocess.t -> t = function
|
||||
| Pps pps -> Pps pps
|
||||
| _ -> Other
|
||||
|
||||
|
@ -28,7 +28,7 @@ module Preprocess = struct
|
|||
| Gt | Lt as ne -> ne
|
||||
| Eq ->
|
||||
List.compare pps1 pps2 ~compare:(fun (_, a) (_, b) ->
|
||||
Jbuild.Pp.compare a b)
|
||||
Dune_file.Pp.compare a b)
|
||||
with
|
||||
| Eq -> a
|
||||
| _ -> Other
|
||||
|
@ -77,7 +77,7 @@ type t =
|
|||
let make
|
||||
?(requires=Ok [])
|
||||
?(flags=Build.return [])
|
||||
?(preprocess=Jbuild.Preprocess.No_preprocessing)
|
||||
?(preprocess=Dune_file.Preprocess.No_preprocessing)
|
||||
?libname
|
||||
?(source_dirs=Path.Set.empty)
|
||||
?(objs_dirs=Path.Set.empty)
|
||||
|
|
|
@ -7,7 +7,7 @@ type t
|
|||
val make
|
||||
: ?requires:Lib.t list Or_exn.t
|
||||
-> ?flags:(unit, string list) Build.t
|
||||
-> ?preprocess:Jbuild.Preprocess.t
|
||||
-> ?preprocess:Dune_file.Preprocess.t
|
||||
-> ?libname:string
|
||||
-> ?source_dirs: Path.Set.t
|
||||
-> ?objs_dirs:Path.Set.t
|
||||
|
|
|
@ -5,7 +5,7 @@ open Import
|
|||
(** Setup rules to build a single module. *)
|
||||
val build_module
|
||||
: ?sandbox:bool
|
||||
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t
|
||||
-> ?js_of_ocaml:Dune_file.Js_of_ocaml.t
|
||||
-> ?dynlink:bool
|
||||
-> dep_graphs:Ocamldep.Dep_graphs.t
|
||||
-> Compilation_context.t
|
||||
|
@ -15,7 +15,7 @@ val build_module
|
|||
(** Setup rules to build all of the modules in the compilation context. *)
|
||||
val build_modules
|
||||
: ?sandbox:bool
|
||||
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t
|
||||
-> ?js_of_ocaml:Dune_file.Js_of_ocaml.t
|
||||
-> ?dynlink:bool
|
||||
-> dep_graphs:Ocamldep.Dep_graphs.t
|
||||
-> Compilation_context.t
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
open Build.O
|
||||
|
||||
module SC = Super_context
|
||||
|
@ -506,7 +506,7 @@ module Gen (S : sig val sctx : SC.t end) = struct
|
|||
(stanzas
|
||||
|> List.concat_map ~f:(fun (w : SC.Dir_with_jbuild.t) ->
|
||||
List.filter_map w.stanzas ~f:(function
|
||||
| Jbuild.Library (l : Jbuild.Library.t) ->
|
||||
| Dune_file.Library (l : Dune_file.Library.t) ->
|
||||
begin match l.public with
|
||||
| Some _ -> None
|
||||
| None ->
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(** Odoc rules *)
|
||||
|
||||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
module Gen (S : sig val sctx : Super_context.t end) : sig
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ module Map = struct
|
|||
|
||||
let of_bindings bindings =
|
||||
{ vars =
|
||||
Jbuild.Bindings.fold bindings ~init:String.Map.empty ~f:(fun x acc ->
|
||||
Dune_file.Bindings.fold bindings ~init:String.Map.empty ~f:(fun x acc ->
|
||||
match x with
|
||||
| Unnamed _ -> acc
|
||||
| Named (s, _) -> String.Map.add acc s (No_info Var.Named_local))
|
||||
|
|
|
@ -40,7 +40,7 @@ module Map : sig
|
|||
val superpose : t -> t -> t
|
||||
|
||||
(** Map with all named values as [Named_local] *)
|
||||
val of_bindings : _ Jbuild.Bindings.t -> t
|
||||
val of_bindings : _ Dune_file.Bindings.t -> t
|
||||
|
||||
val singleton : string -> Var.t -> t
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
open Import
|
||||
open Build.O
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
module SC = Super_context
|
||||
|
||||
|
@ -29,7 +29,7 @@ module Driver = struct
|
|||
; replaces : (Loc.t * string) list
|
||||
}
|
||||
|
||||
type Jbuild.Sub_system_info.t += T of t
|
||||
type Dune_file.Sub_system_info.t += T of t
|
||||
|
||||
let loc t = t.loc
|
||||
|
||||
|
@ -269,7 +269,7 @@ let build_ppx_driver sctx ~lib_db ~dep_kind ~target ~dir_kind pps =
|
|||
(* Extend the dependency stack as we don't have locations at
|
||||
this point *)
|
||||
Dep_path.prepend_exn e
|
||||
(Preprocess (pps : Jbuild.Pp.t list :> string list)))
|
||||
(Preprocess (pps : Dune_file.Pp.t list :> string list)))
|
||||
(Lib.DB.resolve_pps lib_db
|
||||
(List.map pps ~f:(fun x -> (Loc.none, x)))
|
||||
>>= Lib.closure
|
||||
|
@ -320,7 +320,7 @@ let get_rules sctx key ~dir_kind =
|
|||
| [] -> []
|
||||
| driver :: rest -> List.sort rest ~compare:String.compare @ [driver]
|
||||
in
|
||||
let pps = List.map names ~f:Jbuild.Pp.of_string in
|
||||
let pps = List.map names ~f:Dune_file.Pp.of_string in
|
||||
build_ppx_driver sctx pps ~lib_db ~dep_kind:Required ~target:exe ~dir_kind
|
||||
|
||||
let gen_rules sctx components =
|
||||
|
@ -478,7 +478,7 @@ let lint_module sctx ~dir ~dep_kind ~lint ~lib_name ~scope ~dir_kind =
|
|||
let bindings = Pform.Map.input_file src.path in
|
||||
add_alias src.path ~loc:None
|
||||
(Build.path src.path
|
||||
>>^ (fun _ -> Jbuild.Bindings.empty)
|
||||
>>^ (fun _ -> Dune_file.Bindings.empty)
|
||||
>>> SC.Action.run sctx
|
||||
action
|
||||
~loc
|
||||
|
@ -561,7 +561,7 @@ let make sctx ~dir ~dep_kind ~lint ~preprocess
|
|||
(preprocessor_deps
|
||||
>>>
|
||||
Build.path src
|
||||
>>^ (fun _ -> Jbuild.Bindings.empty)
|
||||
>>^ (fun _ -> Dune_file.Bindings.empty)
|
||||
>>>
|
||||
SC.Action.run sctx
|
||||
(Redirect
|
||||
|
|
|
@ -11,8 +11,8 @@ val make
|
|||
: Super_context.t
|
||||
-> dir:Path.t
|
||||
-> dep_kind:Lib_deps_info.Kind.t
|
||||
-> lint:Jbuild.Preprocess_map.t
|
||||
-> preprocess:Jbuild.Preprocess_map.t
|
||||
-> lint:Dune_file.Preprocess_map.t
|
||||
-> preprocess:Dune_file.Preprocess_map.t
|
||||
-> preprocessor_deps:(unit, Path.t list) Build.t
|
||||
-> lib_name:string option
|
||||
-> scope:Scope.t
|
||||
|
@ -41,7 +41,7 @@ val get_ppx_driver
|
|||
: Super_context.t
|
||||
-> scope:Scope.t
|
||||
-> dir_kind:File_tree.Dune_file.Kind.t
|
||||
-> (Loc.t * Jbuild.Pp.t) list
|
||||
-> (Loc.t * Dune_file.Pp.t) list
|
||||
-> Path.t Or_exn.t
|
||||
|
||||
module Compat_ppx_exe_kind : sig
|
||||
|
|
|
@ -68,7 +68,7 @@ module DB = struct
|
|||
]
|
||||
in
|
||||
let libs_by_project_name =
|
||||
List.map internal_libs ~f:(fun (dir, (lib : Jbuild.Library.t)) ->
|
||||
List.map internal_libs ~f:(fun (dir, (lib : Dune_file.Library.t)) ->
|
||||
(lib.project.name, (dir, lib)))
|
||||
|> Project_name_map.of_list_multi
|
||||
in
|
||||
|
@ -78,7 +78,7 @@ module DB = struct
|
|||
List.filter_map internal_libs ~f:(fun (_dir, lib) ->
|
||||
match lib.public with
|
||||
| None -> None
|
||||
| Some p -> Some (Jbuild.Public_lib.name p, lib.project))
|
||||
| Some p -> Some (Dune_file.Public_lib.name p, lib.project))
|
||||
|> String.Map.of_list
|
||||
|> function
|
||||
| Ok x -> x
|
||||
|
@ -87,7 +87,7 @@ module DB = struct
|
|||
List.filter_map internal_libs ~f:(fun (_dir, lib) ->
|
||||
match lib.public with
|
||||
| None -> None
|
||||
| Some p -> Option.some_if (name = Jbuild.Public_lib.name p)
|
||||
| Some p -> Option.some_if (name = Dune_file.Public_lib.name p)
|
||||
lib.buildable.loc)
|
||||
with
|
||||
| [] | [_] -> assert false
|
||||
|
|
|
@ -25,7 +25,7 @@ module DB : sig
|
|||
: projects:Dune_project.t list
|
||||
-> context:string
|
||||
-> installed_libs:Lib.DB.t
|
||||
-> (Path.t * Jbuild.Library.t) list
|
||||
-> (Path.t * Dune_file.Library.t) list
|
||||
-> t * Lib.DB.t
|
||||
|
||||
val find_by_dir : t -> Path.t -> scope
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
open Build.O
|
||||
open! No_io
|
||||
|
||||
|
@ -86,7 +86,7 @@ let alias sctx ~dir ~scope (alias_conf : Alias_conf.t) =
|
|||
let module S = Sexp.To_sexp in
|
||||
Sexp.List
|
||||
[ Sexp.unsafe_atom_of_string "user-alias"
|
||||
; Jbuild.Bindings.sexp_of_t Jbuild.Dep_conf.sexp_of_t alias_conf.deps
|
||||
; Dune_file.Bindings.sexp_of_t Dune_file.Dep_conf.sexp_of_t alias_conf.deps
|
||||
; S.option Action.Unexpanded.sexp_of_t
|
||||
(Option.map alias_conf.action ~f:snd)
|
||||
]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(** Simple rules: user, copy_files, alias *)
|
||||
|
||||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
(** Interpret a [(rule ...)] stanza and return the targets it produces. *)
|
||||
val user_rule
|
||||
|
|
|
@ -3,7 +3,7 @@ open! Import
|
|||
include Sub_system_intf
|
||||
|
||||
module Register_backend(M : Backend) = struct
|
||||
include Jbuild.Sub_system_info.Register(M.Info)
|
||||
include Dune_file.Sub_system_info.Register(M.Info)
|
||||
include Lib.Sub_system.Register(struct
|
||||
include M
|
||||
type Lib.Sub_system.t += T of t
|
||||
|
@ -121,7 +121,7 @@ type Lib.Sub_system.t +=
|
|||
Gen of (Library_compilation_context.t -> unit)
|
||||
|
||||
module Register_end_point(M : End_point) = struct
|
||||
include Jbuild.Sub_system_info.Register(M.Info)
|
||||
include Dune_file.Sub_system_info.Register(M.Info)
|
||||
|
||||
let gen info (c : Library_compilation_context.t) =
|
||||
let open Result.O in
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
open! Import
|
||||
|
||||
module type Info = Jbuild.Sub_system_info.S
|
||||
module type Info = Dune_file.Sub_system_info.S
|
||||
|
||||
module type S = sig
|
||||
module Info : Info
|
||||
|
@ -84,7 +84,7 @@ module Library_compilation_context = struct
|
|||
type t =
|
||||
{ super_context : Super_context.t
|
||||
; dir : Path.t
|
||||
; stanza : Jbuild.Library.t
|
||||
; stanza : Dune_file.Library.t
|
||||
; scope : Scope.t
|
||||
; source_modules : Module.t Module.Name.Map.t
|
||||
; compile_info : Lib.Compile.t
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
module A = Action
|
||||
module Alias = Build_system.Alias
|
||||
|
@ -772,12 +772,12 @@ module Deps = struct
|
|||
|
||||
let interpret_named t ~scope ~dir bindings =
|
||||
List.map bindings ~f:(function
|
||||
| Jbuild.Bindings.Unnamed p ->
|
||||
| Dune_file.Bindings.Unnamed p ->
|
||||
dep t ~scope ~dir p >>^ fun l ->
|
||||
List.map l ~f:(fun x -> Jbuild.Bindings.Unnamed x)
|
||||
List.map l ~f:(fun x -> Dune_file.Bindings.Unnamed x)
|
||||
| Named (s, ps) ->
|
||||
Build.all (List.map ps ~f:(dep t ~scope ~dir)) >>^ fun l ->
|
||||
[Jbuild.Bindings.Named (s, List.concat l)])
|
||||
[Dune_file.Bindings.Named (s, List.concat l)])
|
||||
|> Build.all
|
||||
>>^ List.concat
|
||||
end
|
||||
|
@ -821,7 +821,7 @@ module Action = struct
|
|||
~f:(fun f -> U.partial_expand t ~dir ~map_exe ~f)
|
||||
|
||||
let expand_step2 ~dir ~dynamic_expansions ~bindings
|
||||
~(deps_written_by_user : Path.t Jbuild.Bindings.t)
|
||||
~(deps_written_by_user : Path.t Dune_file.Bindings.t)
|
||||
~map_exe t =
|
||||
U.Partial.expand t ~dir ~map_exe ~f:(fun pform syntax_version ->
|
||||
let key = String_with_vars.Var.full_name pform in
|
||||
|
@ -831,18 +831,18 @@ module Action = struct
|
|||
| None ->
|
||||
Option.map (Pform.Map.expand bindings pform syntax_version) ~f:(function
|
||||
| Var Named_local ->
|
||||
begin match Jbuild.Bindings.find deps_written_by_user key with
|
||||
begin match Dune_file.Bindings.find deps_written_by_user key with
|
||||
| None ->
|
||||
Exn.code_error "Local named variable not present in named deps"
|
||||
[ "pform", String_with_vars.Var.sexp_of_t pform
|
||||
; "deps_written_by_user",
|
||||
Jbuild.Bindings.sexp_of_t Path.sexp_of_t deps_written_by_user
|
||||
Dune_file.Bindings.sexp_of_t Path.sexp_of_t deps_written_by_user
|
||||
]
|
||||
| Some x -> Value.L.paths x
|
||||
end
|
||||
| Var Deps ->
|
||||
deps_written_by_user
|
||||
|> Jbuild.Bindings.to_list
|
||||
|> Dune_file.Bindings.to_list
|
||||
|> Value.L.paths
|
||||
| Var First_dep ->
|
||||
begin match deps_written_by_user with
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
*)
|
||||
|
||||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
|
||||
(** A directory with a jbuild *)
|
||||
module Dir_with_jbuild : sig
|
||||
|
@ -121,7 +121,7 @@ val prefix_rules
|
|||
val add_rule
|
||||
: t
|
||||
-> ?sandbox:bool
|
||||
-> ?mode:Jbuild.Rule.Mode.t
|
||||
-> ?mode:Dune_file.Rule.Mode.t
|
||||
-> ?locks:Path.t list
|
||||
-> ?loc:Loc.t
|
||||
-> (unit, Action.t) Build.t
|
||||
|
@ -129,7 +129,7 @@ val add_rule
|
|||
val add_rule_get_targets
|
||||
: t
|
||||
-> ?sandbox:bool
|
||||
-> ?mode:Jbuild.Rule.Mode.t
|
||||
-> ?mode:Dune_file.Rule.Mode.t
|
||||
-> ?locks:Path.t list
|
||||
-> ?loc:Loc.t
|
||||
-> (unit, Action.t) Build.t
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
open Import
|
||||
open Jbuild
|
||||
open Dune_file
|
||||
open Build.O
|
||||
open! No_io
|
||||
|
||||
|
|
|
@ -9,6 +9,6 @@ val utop_exe : Path.t -> Path.t
|
|||
val setup
|
||||
: Super_context.t
|
||||
-> dir:Path.t
|
||||
-> libs:Jbuild.Library.t list
|
||||
-> libs:Dune_file.Library.t list
|
||||
-> scope:Scope.t
|
||||
-> unit
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
|
||||
(alias
|
||||
(name runtest)
|
||||
(deps (:t jbuild.mlt)
|
||||
(deps (:t dune_file.mlt)
|
||||
(glob_files %{project_root}/src/.dune.objs/*.cmi)
|
||||
(glob_files %{project_root}/src/stdune/.stdune.objs/*.cmi))
|
||||
(action (chdir %{project_root}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
(* -*- tuareg -*- *)
|
||||
open Dune;;
|
||||
open Stdune;;
|
||||
|
||||
let sexp_pp = Sexp.pp Dune;;
|
||||
#install_printer Dune_file.Mode_conf.pp;;
|
||||
#install_printer Binary_kind.pp;;
|
||||
#install_printer sexp_pp;;
|
||||
|
||||
(* Dune_file.Executables.Link_mode.t *)
|
||||
let test s =
|
||||
Sexp.Of_sexp.parse Dune_file.Executables.Link_mode.t Univ_map.empty
|
||||
(Sexp.parse_string ~fname:"" ~mode:Sexp.Parser.Mode.Single s)
|
||||
[%%expect{|
|
||||
val sexp_pp : Format.formatter -> Usexp.t -> unit = <fun>
|
||||
val test : string -> Dune_file.Executables.Link_mode.t = <fun>
|
||||
|}]
|
||||
|
||||
(* Link modes can be read as a (<mode> <kind>) list *)
|
||||
test "(best exe)"
|
||||
[%%expect{|
|
||||
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = exe}
|
||||
|}]
|
||||
|
||||
(* Some shortcuts also exist *)
|
||||
test "exe"
|
||||
[%%expect{|
|
||||
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = exe}
|
||||
|}]
|
||||
test "object"
|
||||
[%%expect{|
|
||||
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = object}
|
||||
|}]
|
||||
test "shared_object"
|
||||
[%%expect{|
|
||||
- : Dune_file.Executables.Link_mode.t = {mode = best; kind = shared_object}
|
||||
|}]
|
||||
test "byte"
|
||||
[%%expect{|
|
||||
- : Dune_file.Executables.Link_mode.t = {mode = byte; kind = exe}
|
||||
|}]
|
||||
test "native"
|
||||
[%%expect{|
|
||||
- : Dune_file.Executables.Link_mode.t = {mode = native; kind = exe}
|
||||
|}]
|
||||
|
||||
(* Dune_file.Executables.Link_mode.sexp_of_t *)
|
||||
let test l =
|
||||
Dune_file.Executables.Link_mode.sexp_of_t l
|
||||
[%%expect{|
|
||||
val test : Dune_file.Executables.Link_mode.t -> Usexp.t = <fun>
|
||||
|}]
|
||||
|
||||
(* In the general case, modes are serialized as a list *)
|
||||
test {Dune_file.Executables.Link_mode.kind = Shared_object; mode = Byte }
|
||||
[%%expect{|
|
||||
- : Usexp.t = (byte shared_object)
|
||||
|}]
|
||||
|
||||
(* But the specialized ones are serialized in the minimal version *)
|
||||
test Dune_file.Executables.Link_mode.exe
|
||||
[%%expect{|
|
||||
- : Usexp.t = exe
|
||||
|}]
|
|
@ -1,64 +0,0 @@
|
|||
(* -*- tuareg -*- *)
|
||||
open Dune;;
|
||||
open Stdune;;
|
||||
|
||||
let sexp_pp = Sexp.pp Dune;;
|
||||
#install_printer Jbuild.Mode_conf.pp;;
|
||||
#install_printer Binary_kind.pp;;
|
||||
#install_printer sexp_pp;;
|
||||
|
||||
(* Jbuild.Executables.Link_mode.t *)
|
||||
let test s =
|
||||
Sexp.Of_sexp.parse Jbuild.Executables.Link_mode.t Univ_map.empty
|
||||
(Sexp.parse_string ~fname:"" ~mode:Sexp.Parser.Mode.Single s)
|
||||
[%%expect{|
|
||||
val sexp_pp : Format.formatter -> Usexp.t -> unit = <fun>
|
||||
val test : string -> Jbuild.Executables.Link_mode.t = <fun>
|
||||
|}]
|
||||
|
||||
(* Link modes can be read as a (<mode> <kind>) list *)
|
||||
test "(best exe)"
|
||||
[%%expect{|
|
||||
- : Jbuild.Executables.Link_mode.t = {mode = best; kind = exe}
|
||||
|}]
|
||||
|
||||
(* Some shortcuts also exist *)
|
||||
test "exe"
|
||||
[%%expect{|
|
||||
- : Jbuild.Executables.Link_mode.t = {mode = best; kind = exe}
|
||||
|}]
|
||||
test "object"
|
||||
[%%expect{|
|
||||
- : Jbuild.Executables.Link_mode.t = {mode = best; kind = object}
|
||||
|}]
|
||||
test "shared_object"
|
||||
[%%expect{|
|
||||
- : Jbuild.Executables.Link_mode.t = {mode = best; kind = shared_object}
|
||||
|}]
|
||||
test "byte"
|
||||
[%%expect{|
|
||||
- : Jbuild.Executables.Link_mode.t = {mode = byte; kind = exe}
|
||||
|}]
|
||||
test "native"
|
||||
[%%expect{|
|
||||
- : Jbuild.Executables.Link_mode.t = {mode = native; kind = exe}
|
||||
|}]
|
||||
|
||||
(* Jbuild.Executables.Link_mode.sexp_of_t *)
|
||||
let test l =
|
||||
Jbuild.Executables.Link_mode.sexp_of_t l
|
||||
[%%expect{|
|
||||
val test : Jbuild.Executables.Link_mode.t -> Usexp.t = <fun>
|
||||
|}]
|
||||
|
||||
(* In the general case, modes are serialized as a list *)
|
||||
test {Jbuild.Executables.Link_mode.kind = Shared_object; mode = Byte }
|
||||
[%%expect{|
|
||||
- : Usexp.t = (byte shared_object)
|
||||
|}]
|
||||
|
||||
(* But the specialized ones are serialized in the minimal version *)
|
||||
test Jbuild.Executables.Link_mode.exe
|
||||
[%%expect{|
|
||||
- : Usexp.t = exe
|
||||
|}]
|
Loading…
Reference in New Issue