diff --git a/src/action.ml b/src/action.ml index add0fcd8..4cc10353 100644 --- a/src/action.ml +++ b/src/action.ml @@ -10,16 +10,10 @@ module Outputs = struct | Outputs -> "outputs" end -module type Sexpable = sig - type t - val t : t Sexp.Of_sexp.t - val sexp_of_t : t Sexp.To_sexp.t -end - module Make_ast - (Program : Sexpable) - (Path : Sexpable) - (String : Sexpable) + (Program : Sexp.Sexpable) + (Path : Sexp.Sexpable) + (String : Sexp.Sexpable) (Ast : Action_intf.Ast with type program := Program.t with type path := Path.t @@ -676,7 +670,7 @@ module Promotion = struct let do_promote db = let by_targets = group_by_targets db in let potential_build_contexts = - match Path.readdir Path.build_dir with + match Path.readdir_unsorted Path.build_dir with | exception _ -> [] | files -> List.filter_map files ~f:(fun fn -> diff --git a/src/action.mli b/src/action.mli index 87df693b..484debf3 100644 --- a/src/action.mli +++ b/src/action.mli @@ -87,8 +87,7 @@ module Unexpanded : sig with type path := String_with_vars.t with type string := String_with_vars.t - val t : t Sexp.Of_sexp.t - val sexp_of_t : t Sexp.To_sexp.t + include Sexp.Sexpable with type t := t module Partial : sig include Action_intf.Ast diff --git a/src/build_system.ml b/src/build_system.ml index ede25ba7..b239f5c8 100644 --- a/src/build_system.ml +++ b/src/build_system.ml @@ -408,7 +408,7 @@ let get_dir_status t ~dir = Dir_status.Loaded Path.Set.empty else if not (Path.is_local dir) then Dir_status.Loaded - (match Path.readdir dir with + (match Path.readdir_unsorted dir with | exception _ -> Path.Set.empty | files -> Path.Set.of_list (List.map files ~f:(Path.relative dir))) @@ -637,7 +637,7 @@ let remove_old_artifacts t ~dir ~subdirs_to_keep = Hashtbl.mem t.files (Path.relative dir Config.jbuilder_keep_fname) then () else - match Path.readdir dir with + match Path.readdir_unsorted dir with | exception _ -> () | files -> List.iter files ~f:(fun fn -> diff --git a/src/file_tree.ml b/src/file_tree.ml index 8d120783..8cf4afd6 100644 --- a/src/file_tree.ml +++ b/src/file_tree.ml @@ -180,7 +180,7 @@ let load ?(extra_ignored_subtrees=Path.Set.empty) path = let rec walk path ~dirs_visited ~project ~ignored : Dir.t = let contents = lazy ( let files, sub_dirs = - Path.readdir path + Path.readdir_unsorted path |> List.filter_partition_map ~f:(fun fn -> let path = Path.relative path fn in let is_directory, file = diff --git a/src/installed_dune_file.ml b/src/installed_dune_file.ml index c2a9b4e3..fcd88858 100644 --- a/src/installed_dune_file.ml +++ b/src/installed_dune_file.ml @@ -3,7 +3,7 @@ open Import let parse_sub_systems sexps = List.filter_map sexps ~f:(fun sexp -> let name, ver, data = - Sexp.Of_sexp.(triple string (located Syntax.Version.t_of_sexp) raw) sexp + Sexp.Of_sexp.(triple string (located Syntax.Version.t) raw) sexp in match Sub_system_name.get name with | None -> diff --git a/src/ordered_set_lang.mli b/src/ordered_set_lang.mli index 010de4c3..f3154b8e 100644 --- a/src/ordered_set_lang.mli +++ b/src/ordered_set_lang.mli @@ -52,8 +52,8 @@ val is_standard : t -> bool module Unexpanded : sig type expanded = t type t - val t : t Sexp.Of_sexp.t - val sexp_of_t : t Sexp.To_sexp.t + + include Sexp.Sexpable with type t := t val standard : t val field : ?default:t -> string -> t Sexp.Of_sexp.record_parser diff --git a/src/stdune/path.ml b/src/stdune/path.ml index cdb1dae6..d4934334 100644 --- a/src/stdune/path.ml +++ b/src/stdune/path.ml @@ -465,7 +465,7 @@ let explode_exn t = let exists t = try Sys.file_exists (to_string t) with Sys_error _ -> false -let readdir t = Sys.readdir (to_string t) |> Array.to_list +let readdir_unsorted t = Sys.readdir (to_string t) |> Array.to_list let is_directory t = try Sys.is_directory (to_string t) with Sys_error _ -> false diff --git a/src/stdune/path.mli b/src/stdune/path.mli index 7936ed11..dc7e0fb3 100644 --- a/src/stdune/path.mli +++ b/src/stdune/path.mli @@ -128,7 +128,7 @@ val split_first_component : t -> (string * t) option val insert_after_build_dir_exn : t -> string -> t val exists : t -> bool -val readdir : t -> string list +val readdir_unsorted : t -> string list val is_directory : t -> bool val rmdir : t -> unit val unlink : t -> unit diff --git a/src/stdune/sexp.ml b/src/stdune/sexp.ml index 6a918df9..092c749c 100644 --- a/src/stdune/sexp.ml +++ b/src/stdune/sexp.ml @@ -452,3 +452,9 @@ module Of_sexp = struct String.uncapitalize name) } "Unknown value %s" s end + +module type Sexpable = sig + type t + val t : t Of_sexp.t + val sexp_of_t : t To_sexp.t +end diff --git a/src/stdune/sexp.mli b/src/stdune/sexp.mli index f4f826e5..722d1bac 100644 --- a/src/stdune/sexp.mli +++ b/src/stdune/sexp.mli @@ -169,3 +169,9 @@ module Of_sexp : sig val enum : (string * 'a) list -> 'a t end + +module type Sexpable = sig + type t + val t : t Of_sexp.t + val sexp_of_t : t To_sexp.t +end diff --git a/src/syntax.ml b/src/syntax.ml index 81d123a9..751a5287 100644 --- a/src/syntax.ml +++ b/src/syntax.ml @@ -7,7 +7,7 @@ module Version = struct let sexp_of_t t = Sexp.unsafe_atom_of_string (to_string t) - let t_of_sexp : t Sexp.Of_sexp.t = function + let t : t Sexp.Of_sexp.t = function | Atom (loc, A s) -> begin try Scanf.sscanf s "%u.%u" (fun a b -> (a, b)) diff --git a/src/syntax.mli b/src/syntax.mli index 219e376c..4287a763 100644 --- a/src/syntax.mli +++ b/src/syntax.mli @@ -9,8 +9,7 @@ module Version : sig [Z <= Y]. *) type t = int * int - val sexp_of_t : t Sexp.To_sexp.t - val t_of_sexp : t Sexp.Of_sexp.t + include Sexp.Sexpable with type t := t (** Whether the parser can read the data or not *) val can_read : parser_version:t -> data_version:t -> bool