Merge pull request #1119 from ocaml/rename-jbuild-module

Rename Jbuild module to Dune_file
This commit is contained in:
Etienne Millon 2018-08-13 14:28:23 +02:00 committed by GitHub
commit 4ecca14b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 181 additions and 181 deletions

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
type t = type t =
{ context : Context.t { context : Context.t

View File

@ -206,13 +206,13 @@ module Rule = struct
; build : (unit, Action.t) Build.t ; build : (unit, Action.t) Build.t
; targets : Target.t list ; targets : Target.t list
; sandbox : bool ; sandbox : bool
; mode : Jbuild.Rule.Mode.t ; mode : Dune_file.Rule.Mode.t
; locks : Path.t list ; locks : Path.t list
; loc : Loc.t option ; loc : Loc.t option
; dir : Path.t ; 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 = ~context ?(locks=[]) ?loc build =
let targets = targets build in let targets = targets build in
let dir = let dir =

View File

@ -15,7 +15,7 @@ module Rule : sig
; build : (unit, Action.t) Build.t ; build : (unit, Action.t) Build.t
; targets : Target.t list ; targets : Target.t list
; sandbox : bool ; sandbox : bool
; mode : Jbuild.Rule.Mode.t ; mode : Dune_file.Rule.Mode.t
; locks : Path.t list ; locks : Path.t list
; loc : Loc.t option ; loc : Loc.t option
; (** Directory where all the targets are produced *) ; (** Directory where all the targets are produced *)
@ -24,7 +24,7 @@ module Rule : sig
val make val make
: ?sandbox:bool : ?sandbox:bool
-> ?mode:Jbuild.Rule.Mode.t -> ?mode:Dune_file.Rule.Mode.t
-> context:Context.t option -> context:Context.t option
-> ?locks:Path.t list -> ?locks:Path.t list
-> ?loc:Loc.t -> ?loc:Loc.t

View File

@ -112,7 +112,7 @@ module Internal_rule = struct
; targets : Path.Set.t ; targets : Path.Set.t
; context : Context.t option ; context : Context.t option
; build : (unit, Action.t) Build.t ; build : (unit, Action.t) Build.t
; mode : Jbuild.Rule.Mode.t ; mode : Dune_file.Rule.Mode.t
; loc : Loc.t option ; loc : Loc.t option
; dir : Path.t ; dir : Path.t
; mutable exec : Exec_status.t ; mutable exec : Exec_status.t

View File

@ -1,6 +1,6 @@
open Import open Import
module Menhir_rules = Menhir module Menhir_rules = Menhir
open Jbuild open Dune_file
open! No_io open! No_io
module Modules_field_evaluator : sig module Modules_field_evaluator : sig
@ -228,7 +228,7 @@ type t =
; dir : Path.t ; dir : Path.t
; text_files : String.Set.t ; text_files : String.Set.t
; modules : modules Lazy.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 = and kind =
@ -312,7 +312,7 @@ let load_text_files sctx ft_dir d =
(* Manually add files generated by the (select ...) (* Manually add files generated by the (select ...)
dependencies *) dependencies *)
List.filter_map buildable.libraries ~f:(fun dep -> 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 | Direct _ -> None
| Select s -> Some s.result_fn) | Select s -> Some s.result_fn)
| _ -> []) | _ -> [])

View File

@ -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 val modules_of_executables : t -> first_exe:string -> Executables_modules.t
(** Find out what buildable a module is part of *) (** 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 *) (** 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 val get : Super_context.t -> dir:Path.t -> t

View File

@ -51,7 +51,7 @@ module Linkage = struct
let so_flags_windows = o_flags let so_flags_windows = o_flags
let so_flags_unix = ["-output-complete-obj"; "-runtime-variant"; "_pic"] 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 = let wanted_mode : Mode.t =
match m.mode with match m.mode with
| Byte -> Byte | Byte -> Byte
@ -110,7 +110,7 @@ let link_exe
~(linkage:Linkage.t) ~(linkage:Linkage.t)
~top_sorted_modules ~top_sorted_modules
?(link_flags=Build.arr (fun _ -> [])) ?(link_flags=Build.arr (fun _ -> []))
?(js_of_ocaml=Jbuild.Js_of_ocaml.default) ?(js_of_ocaml=Dune_file.Js_of_ocaml.default)
cctx cctx
= =
let sctx = CC.super_context cctx in let sctx = CC.super_context cctx in
@ -174,7 +174,7 @@ let build_and_link_many
~programs ~programs
~linkages ~linkages
?link_flags ?link_flags
?(js_of_ocaml=Jbuild.Js_of_ocaml.default) ?(js_of_ocaml=Dune_file.Js_of_ocaml.default)
cctx cctx
= =
let dep_graphs = Ocamldep.rules cctx in let dep_graphs = Ocamldep.rules cctx in

View File

@ -29,7 +29,7 @@ module Linkage : sig
-> unit -> unit
-> t -> 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 end
(** {1 High-level functions} *) (** {1 High-level functions} *)
@ -40,7 +40,7 @@ val build_and_link
: program:Program.t : program:Program.t
-> linkages:Linkage.t list -> linkages:Linkage.t list
-> ?link_flags:(unit, string 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 -> Compilation_context.t
-> unit -> unit
@ -48,7 +48,7 @@ val build_and_link_many
: programs:Program.t list : programs:Program.t list
-> linkages:Linkage.t list -> linkages:Linkage.t list
-> ?link_flags:(unit, string 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 -> Compilation_context.t
-> unit -> unit
@ -60,6 +60,6 @@ val link_exe
-> linkage:Linkage.t -> linkage:Linkage.t
-> top_sorted_modules:(unit, Module.t list) Build.t -> top_sorted_modules:(unit, Module.t list) Build.t
-> ?link_flags:(unit, string 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 -> Compilation_context.t
-> unit -> unit

View File

@ -1,6 +1,6 @@
open Import open Import
module Menhir_rules = Menhir module Menhir_rules = Menhir
open Jbuild open Dune_file
open Build.O open Build.O
open! No_io open! No_io
@ -548,7 +548,7 @@ module Gen(P : Install_rules.Params) = struct
let compile_info = let compile_info =
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:(Dune_file.Preprocess_map.pps exes.buildable.preprocess)
~allow_overlaps:exes.buildable.allow_overlapping_dependencies ~allow_overlaps:exes.buildable.allow_overlapping_dependencies
in in
SC.Libs.gen_select_rules sctx compile_info ~dir; SC.Libs.gen_select_rules sctx compile_info ~dir;

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
open Build.O open Build.O
open! No_io open! No_io
@ -18,7 +18,7 @@ module Backend = struct
; extends : (Loc.t * string) list ; 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 let loc t = t.loc
@ -112,7 +112,7 @@ include Sub_system.Register_end_point(
; libraries : (Loc.t * string) list ; 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 = let empty loc =
{ loc { loc

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
open Build.O open Build.O
open! No_io open! No_io

View File

@ -19,7 +19,7 @@ let parse_sub_systems ~parsing_context sexps =
| Error (name, _, (loc, _, _)) -> | Error (name, _, (loc, _, _)) ->
Loc.fail loc "%S present twice" (Sub_system_name.to_string name)) Loc.fail loc "%S present twice" (Sub_system_name.to_string name))
|> Sub_system_name.Map.mapi ~f:(fun name (_, version, data) -> |> 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; Syntax.check_supported M.syntax version;
let parsing_context = let parsing_context =
(* We set the syntax to the version used when generating this subsystem. (* 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 = let sexps =
Sub_system_name.Map.to_list confs Sub_system_name.Map.to_list confs
|> List.map ~f:(fun (name, (ver, conf)) -> |> 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) Sexp.List [ Sexp.atom (Sub_system_name.to_string name)
; Syntax.Version.sexp_of_t ver ; Syntax.Version.sexp_of_t ver
; conf ; conf

View File

@ -2,7 +2,7 @@
open Stdune 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 val gen
: dune_version:Syntax.Version.t : dune_version:Syntax.Version.t
-> (Syntax.Version.t * Sexp.t) Sub_system_name.Map.t -> (Syntax.Version.t * Sexp.t) Sub_system_name.Map.t

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
module Jbuild = struct module Jbuild = struct
type t = type t =

View File

@ -4,7 +4,7 @@ module Jbuild : sig
type t = type t =
{ dir : Path.t { dir : Path.t
; project : Dune_project.t ; project : Dune_project.t
; stanzas : Jbuild.Stanzas.t ; stanzas : Dune_file.Stanzas.t
; kind : File_tree.Dune_file.Kind.t ; kind : File_tree.Dune_file.Kind.t
} }
end end

View File

@ -109,7 +109,7 @@ let link_rule cc ~runtime ~target =
; Arg_spec.Dyn get_all ; 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 sctx = Compilation_context.super_context cc in
let dir = Compilation_context.dir cc in let dir = Compilation_context.dir cc in
if separate_compilation_enabled sctx if separate_compilation_enabled sctx
@ -164,7 +164,7 @@ let setup_separate_compilation_rules sctx components =
As flags) ~spec ~target)) As flags) ~spec ~target))
let build_exe cc ~js_of_ocaml ~src = 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 = let javascript_files =
List.map javascript_files ~f:(Path.relative (Compilation_context.dir cc)) in List.map javascript_files ~f:(Path.relative (Compilation_context.dir cc)) in
let mk_target ext = Path.extend_basename src ~suffix:ext in let mk_target ext = Path.extend_basename src ~suffix:ext in

View File

@ -1,7 +1,7 @@
(** Generate rules for js_of_ocaml *) (** Generate rules for js_of_ocaml *)
open Import open Import
open Jbuild open Dune_file
val build_cm val build_cm
: Compilation_context.t : Compilation_context.t

View File

@ -28,10 +28,10 @@ module Info = struct
module Deps = struct module Deps = struct
type t = type t =
| Simple of (Loc.t * string) list | 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 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 match deps with
| [] -> Some (List.rev acc) | [] -> Some (List.rev acc)
| Direct x :: deps -> loop (x :: acc) deps | Direct x :: deps -> loop (x :: acc) deps
@ -42,13 +42,13 @@ module Info = struct
| None -> Complex deps | None -> Complex deps
let to_lib_deps = function 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 | Complex l -> l
end end
type t = type t =
{ loc : Loc.t { loc : Loc.t
; kind : Jbuild.Library.Kind.t ; kind : Dune_file.Library.Kind.t
; status : Status.t ; status : Status.t
; src_dir : Path.t ; src_dir : Path.t
; obj_dir : Path.t ; obj_dir : Path.t
@ -60,26 +60,26 @@ module Info = struct
; jsoo_runtime : Path.t list ; jsoo_runtime : Path.t list
; requires : Deps.t ; requires : Deps.t
; ppx_runtime_deps : (Loc.t * string) list ; ppx_runtime_deps : (Loc.t * string) list
; pps : (Loc.t * Jbuild.Pp.t) list ; pps : (Loc.t * Dune_file.Pp.t) list
; optional : bool ; optional : bool
; virtual_deps : (Loc.t * string) list ; virtual_deps : (Loc.t * string) list
; 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 : Dune_file.Sub_system_info.t Sub_system_name.Map.t
} }
let user_written_deps t = let user_written_deps t =
List.fold_left (t.virtual_deps @ t.ppx_runtime_deps) List.fold_left (t.virtual_deps @ t.ppx_runtime_deps)
~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 -> 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_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)])
in in
let stubs = let stubs =
if Jbuild.Library.has_stubs conf then if Dune_file.Library.has_stubs conf then
[Jbuild.Library.stubs_archive conf ~dir ~ext_lib:""] [Dune_file.Library.stubs_archive conf ~dir ~ext_lib:""]
else else
[] []
in in
@ -113,7 +113,7 @@ module Info = struct
; virtual_deps = conf.virtual_deps ; virtual_deps = conf.virtual_deps
; requires = Deps.of_lib_deps conf.buildable.libraries ; requires = Deps.of_lib_deps conf.buildable.libraries
; ppx_runtime_deps = conf.ppx_runtime_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 ; sub_systems = conf.sub_systems
; dune_version = Some conf.dune_version ; dune_version = Some conf.dune_version
} }
@ -228,7 +228,7 @@ type t =
; ppx_runtime_deps : t list Or_exn.t ; ppx_runtime_deps : t list Or_exn.t
; pps : t list Or_exn.t ; pps : t list Or_exn.t
; resolved_selects : Resolved_select.t list ; 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: ; (* This is mutable to avoid this error:
{[ {[
@ -447,7 +447,7 @@ module Sub_system = struct
type t = sub_system = .. type t = sub_system = ..
module type S = sig module type S = sig
module Info : Jbuild.Sub_system_info.S module Info : Dune_file.Sub_system_info.S
type t type t
type sub_system += T of t type sub_system += T of t
val instantiate val instantiate
@ -745,7 +745,7 @@ and resolve_complex_deps db deps ~allow_private_deps ~stack =
let res, resolved_selects = let res, resolved_selects =
List.fold_left deps ~init:(Ok [], []) ~f:(fun (acc_res, acc_selects) dep -> List.fold_left deps ~init:(Ok [], []) ~f:(fun (acc_res, acc_selects) dep ->
let res, acc_selects = let res, acc_selects =
match (dep : Jbuild.Lib_dep.t) with match (dep : Dune_file.Lib_dep.t) with
| Direct (loc, name) -> | Direct (loc, name) ->
let res = let res =
resolve_dep db name ~allow_private_deps ~loc ~stack >>| fun x -> [x] 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 } { (fst first) with stop = (fst last).stop }
in in
let pps = 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 resolve_simple_deps db pps ~allow_private_deps:true ~stack
>>= fun pps -> >>= fun pps ->
closure_with_overlap_checks None pps ~stack closure_with_overlap_checks None pps ~stack
@ -909,7 +909,7 @@ 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
; 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 ; 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 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 : Dune_file.Library.t)) ->
let info = Info.of_library_stanza ~dir 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)]
| Some p -> | Some p ->
let name = Jbuild.Public_lib.name p in let name = Dune_file.Public_lib.name p in
if name = conf.name then if name = conf.name then
[(name, Found info)] [(name, Found info)]
else else
@ -977,11 +977,11 @@ module DB = struct
| Ok x -> x | Ok x -> x
| Error (name, _, _) -> | Error (name, _, _) ->
match 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 || if name = conf.name ||
match conf.public with match conf.public with
| None -> false | None -> false
| Some p -> name = Jbuild.Public_lib.name p | Some p -> name = Dune_file.Public_lib.name p
then Some conf.buildable.loc then Some conf.buildable.loc
else None) else None)
with with
@ -1077,7 +1077,7 @@ module DB = struct
let resolve_pps t pps = let resolve_pps t pps =
resolve_simple_deps t ~allow_private_deps:true 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 ~stack:Dep_stack.empty
let rec all ?(recursive=false) t = let rec all ?(recursive=false) t =

View File

@ -21,7 +21,7 @@ val obj_dir : t -> Path.t
val is_local : t -> bool val is_local : t -> bool
val synopsis : t -> string option 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 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
@ -83,14 +83,14 @@ module Info : sig
module Deps : sig module Deps : sig
type t = type t =
| Simple of (Loc.t * string) list | Simple of (Loc.t * string) list
| Complex of Jbuild.Lib_dep.t list | Complex of Dune_file.Lib_dep.t list
end end
(** Raw description of a library, where dependencies are not (** Raw description of a library, where dependencies are not
resolved. *) resolved. *)
type t = type t =
{ loc : Loc.t { loc : Loc.t
; kind : Jbuild.Library.Kind.t ; kind : Dune_file.Library.Kind.t
; status : Status.t ; status : Status.t
; src_dir : Path.t ; src_dir : Path.t
; obj_dir : Path.t ; obj_dir : Path.t
@ -102,14 +102,14 @@ module Info : sig
; jsoo_runtime : Path.t list ; jsoo_runtime : Path.t list
; requires : Deps.t ; requires : Deps.t
; ppx_runtime_deps : (Loc.t * string) list ; ppx_runtime_deps : (Loc.t * string) list
; pps : (Loc.t * Jbuild.Pp.t) list ; pps : (Loc.t * Dune_file.Pp.t) list
; optional : bool ; optional : bool
; virtual_deps : (Loc.t * string) list ; virtual_deps : (Loc.t * string) list
; 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 : 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 val of_findlib_package : Findlib.Package.t -> t
end end
@ -216,7 +216,7 @@ module Compile : sig
val pps : t -> L.t Or_exn.t val pps : t -> L.t Or_exn.t
val optional : t -> bool 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 *) (** Sub-systems used in this compilation context *)
val sub_systems : t -> sub_system list val sub_systems : t -> sub_system list
@ -257,7 +257,7 @@ 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
-> (Path.t * Jbuild.Library.t) list -> (Path.t * Dune_file.Library.t) list
-> t -> t
val create_from_findlib val create_from_findlib
@ -289,13 +289,13 @@ module DB : sig
val resolve_user_written_deps val resolve_user_written_deps
: t : t
-> ?allow_overlaps:bool -> ?allow_overlaps:bool
-> Jbuild.Lib_dep.t list -> Dune_file.Lib_dep.t list
-> pps:(Loc.t * Jbuild.Pp.t) list -> pps:(Loc.t * Dune_file.Pp.t) list
-> Compile.t -> Compile.t
val resolve_pps val resolve_pps
: t : t
-> (Loc.t * Jbuild.Pp.t) list -> (Loc.t * Dune_file.Pp.t) list
-> L.t Or_exn.t -> L.t Or_exn.t
(** Return the list of all libraries in this database. If (** Return the list of all libraries in this database. If
@ -316,7 +316,7 @@ module Sub_system : sig
type t = sub_system = .. type t = sub_system = ..
module type S = sig module type S = sig
module Info : Jbuild.Sub_system_info.S module Info : Dune_file.Sub_system_info.S
type t type t
type sub_system += T of t type sub_system += T of t
val instantiate val instantiate

View File

@ -9,7 +9,7 @@ module SC = Super_context
(* This signature describes the input of the functor [Run], which follows. *) (* This signature describes the input of the functor [Run], which follows. *)
type stanza = type stanza =
Jbuild.Menhir.t Dune_file.Menhir.t
module type PARAMS = sig module type PARAMS = sig
@ -140,13 +140,13 @@ end
(* The final glue. *) (* The final glue. *)
let targets (stanza : Jbuild.Menhir.t) = let targets (stanza : Dune_file.Menhir.t) =
let f m = [m ^ ".ml"; m ^ ".mli"] in let f m = [m ^ ".ml"; m ^ ".mli"] in
match stanza.merge_into with match stanza.merge_into with
| Some m -> f m | Some m -> f m
| None -> List.concat_map stanza.modules ~f | 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 match stanza.merge_into with
| Some m -> [Module.Name.of_string m] | Some m -> [Module.Name.of_string m]
| None -> List.map stanza.modules ~f:Module.Name.of_string | None -> List.map stanza.modules ~f:Module.Name.of_string

View File

@ -3,13 +3,13 @@
(** Return the list of targets that are generated by this stanza. This (** 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 list of targets is used by the code that computes the list of
modules in the directory. *) 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. *) (** 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. *) (** Generate the rules for a [(menhir ...)] stanza. *)
val gen_rules val gen_rules
: Compilation_context.t : Compilation_context.t
-> Jbuild.Menhir.t -> Dune_file.Menhir.t
-> unit -> unit

View File

@ -6,10 +6,10 @@ module SC = Super_context
module Preprocess = struct module Preprocess = struct
type t = type t =
| Pps of Jbuild.Preprocess.pps | Pps of Dune_file.Preprocess.pps
| Other | Other
let make : Jbuild.Preprocess.t -> t = function let make : Dune_file.Preprocess.t -> t = function
| Pps pps -> Pps pps | Pps pps -> Pps pps
| _ -> Other | _ -> Other
@ -28,7 +28,7 @@ module Preprocess = struct
| Gt | Lt as ne -> ne | Gt | Lt as ne -> ne
| Eq -> | Eq ->
List.compare pps1 pps2 ~compare:(fun (_, a) (_, b) -> List.compare pps1 pps2 ~compare:(fun (_, a) (_, b) ->
Jbuild.Pp.compare a b) Dune_file.Pp.compare a b)
with with
| Eq -> a | Eq -> a
| _ -> Other | _ -> Other
@ -77,7 +77,7 @@ type t =
let make let make
?(requires=Ok []) ?(requires=Ok [])
?(flags=Build.return []) ?(flags=Build.return [])
?(preprocess=Jbuild.Preprocess.No_preprocessing) ?(preprocess=Dune_file.Preprocess.No_preprocessing)
?libname ?libname
?(source_dirs=Path.Set.empty) ?(source_dirs=Path.Set.empty)
?(objs_dirs=Path.Set.empty) ?(objs_dirs=Path.Set.empty)

View File

@ -7,7 +7,7 @@ type t
val make val make
: ?requires:Lib.t list Or_exn.t : ?requires:Lib.t list Or_exn.t
-> ?flags:(unit, string list) Build.t -> ?flags:(unit, string list) Build.t
-> ?preprocess:Jbuild.Preprocess.t -> ?preprocess:Dune_file.Preprocess.t
-> ?libname:string -> ?libname:string
-> ?source_dirs: Path.Set.t -> ?source_dirs: Path.Set.t
-> ?objs_dirs:Path.Set.t -> ?objs_dirs:Path.Set.t

View File

@ -5,7 +5,7 @@ open Import
(** Setup rules to build a single module. *) (** Setup rules to build a single module. *)
val build_module val build_module
: ?sandbox:bool : ?sandbox:bool
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t -> ?js_of_ocaml:Dune_file.Js_of_ocaml.t
-> ?dynlink:bool -> ?dynlink:bool
-> dep_graphs:Ocamldep.Dep_graphs.t -> dep_graphs:Ocamldep.Dep_graphs.t
-> Compilation_context.t -> Compilation_context.t
@ -15,7 +15,7 @@ val build_module
(** Setup rules to build all of the modules in the compilation context. *) (** Setup rules to build all of the modules in the compilation context. *)
val build_modules val build_modules
: ?sandbox:bool : ?sandbox:bool
-> ?js_of_ocaml:Jbuild.Js_of_ocaml.t -> ?js_of_ocaml:Dune_file.Js_of_ocaml.t
-> ?dynlink:bool -> ?dynlink:bool
-> dep_graphs:Ocamldep.Dep_graphs.t -> dep_graphs:Ocamldep.Dep_graphs.t
-> Compilation_context.t -> Compilation_context.t

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
open Build.O open Build.O
module SC = Super_context module SC = Super_context
@ -506,7 +506,7 @@ module Gen (S : sig val sctx : SC.t end) = struct
(stanzas (stanzas
|> List.concat_map ~f:(fun (w : SC.Dir_with_jbuild.t) -> |> List.concat_map ~f:(fun (w : SC.Dir_with_jbuild.t) ->
List.filter_map w.stanzas ~f:(function 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 begin match l.public with
| Some _ -> None | Some _ -> None
| None -> | None ->

View File

@ -1,7 +1,7 @@
(** Odoc rules *) (** Odoc rules *)
open Import open Import
open Jbuild open Dune_file
module Gen (S : sig val sctx : Super_context.t end) : sig module Gen (S : sig val sctx : Super_context.t end) : sig

View File

@ -215,7 +215,7 @@ module Map = struct
let of_bindings bindings = let of_bindings bindings =
{ vars = { 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 match x with
| Unnamed _ -> acc | Unnamed _ -> acc
| Named (s, _) -> String.Map.add acc s (No_info Var.Named_local)) | Named (s, _) -> String.Map.add acc s (No_info Var.Named_local))

View File

@ -40,7 +40,7 @@ module Map : sig
val superpose : t -> t -> t val superpose : t -> t -> t
(** Map with all named values as [Named_local] *) (** 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 val singleton : string -> Var.t -> t

View File

@ -1,6 +1,6 @@
open Import open Import
open Build.O open Build.O
open Jbuild open Dune_file
module SC = Super_context module SC = Super_context
@ -29,7 +29,7 @@ module Driver = struct
; replaces : (Loc.t * string) list ; 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 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 (* Extend the dependency stack as we don't have locations at
this point *) this point *)
Dep_path.prepend_exn e 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 (Lib.DB.resolve_pps lib_db
(List.map pps ~f:(fun x -> (Loc.none, x))) (List.map pps ~f:(fun x -> (Loc.none, x)))
>>= Lib.closure >>= Lib.closure
@ -320,7 +320,7 @@ let get_rules sctx key ~dir_kind =
| [] -> [] | [] -> []
| driver :: rest -> List.sort rest ~compare:String.compare @ [driver] | driver :: rest -> List.sort rest ~compare:String.compare @ [driver]
in 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 build_ppx_driver sctx pps ~lib_db ~dep_kind:Required ~target:exe ~dir_kind
let gen_rules sctx components = 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 let bindings = Pform.Map.input_file src.path in
add_alias src.path ~loc:None add_alias src.path ~loc:None
(Build.path src.path (Build.path src.path
>>^ (fun _ -> Jbuild.Bindings.empty) >>^ (fun _ -> Dune_file.Bindings.empty)
>>> SC.Action.run sctx >>> SC.Action.run sctx
action action
~loc ~loc
@ -561,7 +561,7 @@ let make sctx ~dir ~dep_kind ~lint ~preprocess
(preprocessor_deps (preprocessor_deps
>>> >>>
Build.path src Build.path src
>>^ (fun _ -> Jbuild.Bindings.empty) >>^ (fun _ -> Dune_file.Bindings.empty)
>>> >>>
SC.Action.run sctx SC.Action.run sctx
(Redirect (Redirect

View File

@ -11,8 +11,8 @@ val make
: Super_context.t : Super_context.t
-> dir:Path.t -> dir:Path.t
-> dep_kind:Lib_deps_info.Kind.t -> dep_kind:Lib_deps_info.Kind.t
-> lint:Jbuild.Preprocess_map.t -> lint:Dune_file.Preprocess_map.t
-> preprocess:Jbuild.Preprocess_map.t -> preprocess:Dune_file.Preprocess_map.t
-> preprocessor_deps:(unit, Path.t list) Build.t -> preprocessor_deps:(unit, Path.t list) Build.t
-> lib_name:string option -> lib_name:string option
-> scope:Scope.t -> scope:Scope.t
@ -41,7 +41,7 @@ val get_ppx_driver
: Super_context.t : Super_context.t
-> scope:Scope.t -> scope:Scope.t
-> dir_kind:File_tree.Dune_file.Kind.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 -> Path.t Or_exn.t
module Compat_ppx_exe_kind : sig module Compat_ppx_exe_kind : sig

View File

@ -68,7 +68,7 @@ module DB = struct
] ]
in in
let libs_by_project_name = 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))) (lib.project.name, (dir, lib)))
|> Project_name_map.of_list_multi |> Project_name_map.of_list_multi
in in
@ -78,7 +78,7 @@ module DB = struct
List.filter_map internal_libs ~f:(fun (_dir, lib) -> List.filter_map internal_libs ~f:(fun (_dir, lib) ->
match lib.public with match lib.public with
| None -> None | 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 |> String.Map.of_list
|> function |> function
| Ok x -> x | Ok x -> x
@ -87,7 +87,7 @@ module DB = struct
List.filter_map internal_libs ~f:(fun (_dir, lib) -> List.filter_map internal_libs ~f:(fun (_dir, lib) ->
match lib.public with match lib.public with
| None -> None | 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) lib.buildable.loc)
with with
| [] | [_] -> assert false | [] | [_] -> assert false

View File

@ -25,7 +25,7 @@ module DB : sig
: projects:Dune_project.t list : projects:Dune_project.t list
-> context:string -> context:string
-> installed_libs:Lib.DB.t -> installed_libs:Lib.DB.t
-> (Path.t * Jbuild.Library.t) list -> (Path.t * Dune_file.Library.t) list
-> t * Lib.DB.t -> t * Lib.DB.t
val find_by_dir : t -> Path.t -> scope val find_by_dir : t -> Path.t -> scope

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
open Build.O open Build.O
open! No_io open! No_io
@ -86,7 +86,7 @@ let alias sctx ~dir ~scope (alias_conf : Alias_conf.t) =
let module S = Sexp.To_sexp in let module S = Sexp.To_sexp in
Sexp.List Sexp.List
[ Sexp.unsafe_atom_of_string "user-alias" [ 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 ; S.option Action.Unexpanded.sexp_of_t
(Option.map alias_conf.action ~f:snd) (Option.map alias_conf.action ~f:snd)
] ]

View File

@ -1,7 +1,7 @@
(** Simple rules: user, copy_files, alias *) (** Simple rules: user, copy_files, alias *)
open Import open Import
open Jbuild open Dune_file
(** Interpret a [(rule ...)] stanza and return the targets it produces. *) (** Interpret a [(rule ...)] stanza and return the targets it produces. *)
val user_rule val user_rule

View File

@ -3,7 +3,7 @@ open! Import
include Sub_system_intf include Sub_system_intf
module Register_backend(M : Backend) = struct 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 Lib.Sub_system.Register(struct
include M include M
type Lib.Sub_system.t += T of t type Lib.Sub_system.t += T of t
@ -121,7 +121,7 @@ type Lib.Sub_system.t +=
Gen of (Library_compilation_context.t -> unit) Gen of (Library_compilation_context.t -> unit)
module Register_end_point(M : End_point) = struct 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 gen info (c : Library_compilation_context.t) =
let open Result.O in let open Result.O in

View File

@ -1,6 +1,6 @@
open! Import open! Import
module type Info = Jbuild.Sub_system_info.S module type Info = Dune_file.Sub_system_info.S
module type S = sig module type S = sig
module Info : Info module Info : Info
@ -84,7 +84,7 @@ module Library_compilation_context = struct
type t = type t =
{ super_context : Super_context.t { super_context : Super_context.t
; dir : Path.t ; dir : Path.t
; stanza : Jbuild.Library.t ; stanza : Dune_file.Library.t
; scope : Scope.t ; scope : Scope.t
; source_modules : Module.t Module.Name.Map.t ; source_modules : Module.t Module.Name.Map.t
; compile_info : Lib.Compile.t ; compile_info : Lib.Compile.t

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
module A = Action module A = Action
module Alias = Build_system.Alias module Alias = Build_system.Alias
@ -772,12 +772,12 @@ module Deps = struct
let interpret_named t ~scope ~dir bindings = let interpret_named t ~scope ~dir bindings =
List.map bindings ~f:(function List.map bindings ~f:(function
| Jbuild.Bindings.Unnamed p -> | Dune_file.Bindings.Unnamed p ->
dep t ~scope ~dir p >>^ fun l -> 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) -> | Named (s, ps) ->
Build.all (List.map ps ~f:(dep t ~scope ~dir)) >>^ fun l -> 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 |> Build.all
>>^ List.concat >>^ List.concat
end end
@ -821,7 +821,7 @@ module Action = struct
~f:(fun f -> U.partial_expand t ~dir ~map_exe ~f) ~f:(fun f -> U.partial_expand t ~dir ~map_exe ~f)
let expand_step2 ~dir ~dynamic_expansions ~bindings 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 = ~map_exe t =
U.Partial.expand t ~dir ~map_exe ~f:(fun pform syntax_version -> U.Partial.expand t ~dir ~map_exe ~f:(fun pform syntax_version ->
let key = String_with_vars.Var.full_name pform in let key = String_with_vars.Var.full_name pform in
@ -831,18 +831,18 @@ module Action = struct
| None -> | None ->
Option.map (Pform.Map.expand bindings pform syntax_version) ~f:(function Option.map (Pform.Map.expand bindings pform syntax_version) ~f:(function
| Var Named_local -> | 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 -> | None ->
Exn.code_error "Local named variable not present in named deps" Exn.code_error "Local named variable not present in named deps"
[ "pform", String_with_vars.Var.sexp_of_t pform [ "pform", String_with_vars.Var.sexp_of_t pform
; "deps_written_by_user", ; "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 | Some x -> Value.L.paths x
end end
| Var Deps -> | Var Deps ->
deps_written_by_user deps_written_by_user
|> Jbuild.Bindings.to_list |> Dune_file.Bindings.to_list
|> Value.L.paths |> Value.L.paths
| Var First_dep -> | Var First_dep ->
begin match deps_written_by_user with begin match deps_written_by_user with

View File

@ -6,7 +6,7 @@
*) *)
open Import open Import
open Jbuild open Dune_file
(** A directory with a jbuild *) (** A directory with a jbuild *)
module Dir_with_jbuild : sig module Dir_with_jbuild : sig
@ -121,7 +121,7 @@ val prefix_rules
val add_rule val add_rule
: t : t
-> ?sandbox:bool -> ?sandbox:bool
-> ?mode:Jbuild.Rule.Mode.t -> ?mode:Dune_file.Rule.Mode.t
-> ?locks:Path.t list -> ?locks:Path.t list
-> ?loc:Loc.t -> ?loc:Loc.t
-> (unit, Action.t) Build.t -> (unit, Action.t) Build.t
@ -129,7 +129,7 @@ val add_rule
val add_rule_get_targets val add_rule_get_targets
: t : t
-> ?sandbox:bool -> ?sandbox:bool
-> ?mode:Jbuild.Rule.Mode.t -> ?mode:Dune_file.Rule.Mode.t
-> ?locks:Path.t list -> ?locks:Path.t list
-> ?loc:Loc.t -> ?loc:Loc.t
-> (unit, Action.t) Build.t -> (unit, Action.t) Build.t

View File

@ -1,5 +1,5 @@
open Import open Import
open Jbuild open Dune_file
open Build.O open Build.O
open! No_io open! No_io

View File

@ -9,6 +9,6 @@ val utop_exe : Path.t -> Path.t
val setup val setup
: Super_context.t : Super_context.t
-> dir:Path.t -> dir:Path.t
-> libs:Jbuild.Library.t list -> libs:Dune_file.Library.t list
-> scope:Scope.t -> scope:Scope.t
-> unit -> unit

View File

@ -80,7 +80,7 @@
(alias (alias
(name runtest) (name runtest)
(deps (:t jbuild.mlt) (deps (:t dune_file.mlt)
(glob_files %{project_root}/src/.dune.objs/*.cmi) (glob_files %{project_root}/src/.dune.objs/*.cmi)
(glob_files %{project_root}/src/stdune/.stdune.objs/*.cmi)) (glob_files %{project_root}/src/stdune/.stdune.objs/*.cmi))
(action (chdir %{project_root} (action (chdir %{project_root}

View File

@ -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
|}]

View File

@ -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
|}]