diff --git a/src/artifacts.ml b/src/artifacts.ml index 344288d4..0875649d 100644 --- a/src/artifacts.ml +++ b/src/artifacts.ml @@ -1,5 +1,5 @@ open Import -open Jbuild +open Dune_file type t = { context : Context.t diff --git a/src/build_interpret.ml b/src/build_interpret.ml index 28561fb7..dda3c677 100644 --- a/src/build_interpret.ml +++ b/src/build_interpret.ml @@ -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 = diff --git a/src/build_interpret.mli b/src/build_interpret.mli index d374146b..7beace39 100644 --- a/src/build_interpret.mli +++ b/src/build_interpret.mli @@ -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 diff --git a/src/build_system.ml b/src/build_system.ml index ad3a2d82..f1e59f63 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -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 diff --git a/src/dir_contents.ml b/src/dir_contents.ml index c2b9cb20..0da00173 100644 --- a/src/dir_contents.ml +++ b/src/dir_contents.ml @@ -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) | _ -> []) diff --git a/src/dir_contents.mli b/src/dir_contents.mli index d7202b91..d4480111 100644 --- a/src/dir_contents.mli +++ b/src/dir_contents.mli @@ -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 diff --git a/src/jbuild.ml b/src/dune_file.ml similarity index 100% rename from src/jbuild.ml rename to src/dune_file.ml diff --git a/src/jbuild.mli b/src/dune_file.mli similarity index 100% rename from src/jbuild.mli rename to src/dune_file.mli diff --git a/src/exe.ml b/src/exe.ml index a6085537..3a4aa7e9 100644 --- a/src/exe.ml +++ b/src/exe.ml @@ -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 diff --git a/src/exe.mli b/src/exe.mli index 6a351b46..d8d07350 100644 --- a/src/exe.mli +++ b/src/exe.mli @@ -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 diff --git a/src/gen_rules.ml b/src/gen_rules.ml index caafa74a..5e1e49f8 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -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; diff --git a/src/inline_tests.ml b/src/inline_tests.ml index 783ba6ed..98098cc7 100644 --- a/src/inline_tests.ml +++ b/src/inline_tests.ml @@ -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 diff --git a/src/install_rules.ml b/src/install_rules.ml index ac07a15a..62e20c4e 100644 --- a/src/install_rules.ml +++ b/src/install_rules.ml @@ -1,5 +1,5 @@ open Import -open Jbuild +open Dune_file open Build.O open! No_io diff --git a/src/installed_dune_file.ml b/src/installed_dune_file.ml index 75d4528c..43fd6e83 100644 --- a/src/installed_dune_file.ml +++ b/src/installed_dune_file.ml @@ -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 diff --git a/src/installed_dune_file.mli b/src/installed_dune_file.mli index a82abb8e..3f6caa5f 100644 --- a/src/installed_dune_file.mli +++ b/src/installed_dune_file.mli @@ -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 diff --git a/src/jbuild_load.ml b/src/jbuild_load.ml index a3ab2ab3..6bbb66fe 100644 --- a/src/jbuild_load.ml +++ b/src/jbuild_load.ml @@ -1,5 +1,5 @@ open Import -open Jbuild +open Dune_file module Jbuild = struct type t = diff --git a/src/jbuild_load.mli b/src/jbuild_load.mli index 5dc286d0..17c8214e 100644 --- a/src/jbuild_load.mli +++ b/src/jbuild_load.mli @@ -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 diff --git a/src/js_of_ocaml_rules.ml b/src/js_of_ocaml_rules.ml index 67202a77..f65c1cc8 100644 --- a/src/js_of_ocaml_rules.ml +++ b/src/js_of_ocaml_rules.ml @@ -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 diff --git a/src/js_of_ocaml_rules.mli b/src/js_of_ocaml_rules.mli index c734878c..8f5ad23c 100644 --- a/src/js_of_ocaml_rules.mli +++ b/src/js_of_ocaml_rules.mli @@ -1,7 +1,7 @@ (** Generate rules for js_of_ocaml *) open Import -open Jbuild +open Dune_file val build_cm : Compilation_context.t diff --git a/src/lib.ml b/src/lib.ml index d59f8ef4..11f44df5 100644 --- a/src/lib.ml +++ b/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 = diff --git a/src/lib.mli b/src/lib.mli index 8ae8df2f..312f3e24 100644 --- a/src/lib.mli +++ b/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 diff --git a/src/menhir.ml b/src/menhir.ml index 61f13f3a..6e4584f1 100644 --- a/src/menhir.ml +++ b/src/menhir.ml @@ -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 diff --git a/src/menhir.mli b/src/menhir.mli index 36c5c6af..904302a6 100644 --- a/src/menhir.mli +++ b/src/menhir.mli @@ -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 diff --git a/src/merlin.ml b/src/merlin.ml index 2674faa4..1a7ef73d 100644 --- a/src/merlin.ml +++ b/src/merlin.ml @@ -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) diff --git a/src/merlin.mli b/src/merlin.mli index 86f2bc2a..5e0eb696 100644 --- a/src/merlin.mli +++ b/src/merlin.mli @@ -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 diff --git a/src/module_compilation.mli b/src/module_compilation.mli index e57bda36..c0d2cc35 100644 --- a/src/module_compilation.mli +++ b/src/module_compilation.mli @@ -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 diff --git a/src/odoc.ml b/src/odoc.ml index 542ac69b..78552f18 100644 --- a/src/odoc.ml +++ b/src/odoc.ml @@ -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 -> diff --git a/src/odoc.mli b/src/odoc.mli index 90bd45d3..e8e1ee19 100644 --- a/src/odoc.mli +++ b/src/odoc.mli @@ -1,7 +1,7 @@ (** Odoc rules *) open Import -open Jbuild +open Dune_file module Gen (S : sig val sctx : Super_context.t end) : sig diff --git a/src/pform.ml b/src/pform.ml index 80dc5a59..531f986b 100644 --- a/src/pform.ml +++ b/src/pform.ml @@ -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)) diff --git a/src/pform.mli b/src/pform.mli index 4d5bf6a7..def55f81 100644 --- a/src/pform.mli +++ b/src/pform.mli @@ -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 diff --git a/src/preprocessing.ml b/src/preprocessing.ml index c2dd73bd..c1a5a653 100644 --- a/src/preprocessing.ml +++ b/src/preprocessing.ml @@ -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 diff --git a/src/preprocessing.mli b/src/preprocessing.mli index 0f5c6f18..0fe05343 100644 --- a/src/preprocessing.mli +++ b/src/preprocessing.mli @@ -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 diff --git a/src/scope.ml b/src/scope.ml index 0da4f1e7..72602a45 100644 --- a/src/scope.ml +++ b/src/scope.ml @@ -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 diff --git a/src/scope.mli b/src/scope.mli index 4cd31536..9bb2cfac 100644 --- a/src/scope.mli +++ b/src/scope.mli @@ -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 diff --git a/src/simple_rules.ml b/src/simple_rules.ml index de41af2c..86cadaca 100644 --- a/src/simple_rules.ml +++ b/src/simple_rules.ml @@ -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) ] diff --git a/src/simple_rules.mli b/src/simple_rules.mli index 1a40a90a..fc8c5660 100644 --- a/src/simple_rules.mli +++ b/src/simple_rules.mli @@ -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 diff --git a/src/sub_system.ml b/src/sub_system.ml index e021dc7a..c7a06b79 100644 --- a/src/sub_system.ml +++ b/src/sub_system.ml @@ -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 diff --git a/src/sub_system_intf.ml b/src/sub_system_intf.ml index 75aa743d..18461df9 100644 --- a/src/sub_system_intf.ml +++ b/src/sub_system_intf.ml @@ -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 diff --git a/src/super_context.ml b/src/super_context.ml index 5a4340f4..d87a7222 100644 --- a/src/super_context.ml +++ b/src/super_context.ml @@ -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 diff --git a/src/super_context.mli b/src/super_context.mli index 126d727d..17be2784 100644 --- a/src/super_context.mli +++ b/src/super_context.mli @@ -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 diff --git a/src/utop.ml b/src/utop.ml index 4b83784f..851a5ba1 100644 --- a/src/utop.ml +++ b/src/utop.ml @@ -1,5 +1,5 @@ open Import -open Jbuild +open Dune_file open Build.O open! No_io diff --git a/src/utop.mli b/src/utop.mli index 9cec6544..29b71c49 100644 --- a/src/utop.mli +++ b/src/utop.mli @@ -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 diff --git a/test/unit-tests/dune b/test/unit-tests/dune index aa2f0eef..f2df88bf 100644 --- a/test/unit-tests/dune +++ b/test/unit-tests/dune @@ -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} diff --git a/test/unit-tests/dune_file.mlt b/test/unit-tests/dune_file.mlt new file mode 100644 index 00000000..ecf75c77 --- /dev/null +++ b/test/unit-tests/dune_file.mlt @@ -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 = +val test : string -> Dune_file.Executables.Link_mode.t = +|}] + +(* Link modes can be read as a ( ) 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 = +|}] + +(* 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 +|}] diff --git a/test/unit-tests/jbuild.mlt b/test/unit-tests/jbuild.mlt deleted file mode 100644 index c1b09227..00000000 --- a/test/unit-tests/jbuild.mlt +++ /dev/null @@ -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 = -val test : string -> Jbuild.Executables.Link_mode.t = -|}] - -(* Link modes can be read as a ( ) 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 = -|}] - -(* 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 -|}]