Merge branch 'master' into little-cleanups

This commit is contained in:
Rudi Grinberg 2018-06-01 02:37:09 +07:00 committed by GitHub
commit 2e86529ece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 27 additions and 23 deletions

View File

@ -10,16 +10,10 @@ module Outputs = struct
| Outputs -> "outputs" | Outputs -> "outputs"
end 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 module Make_ast
(Program : Sexpable) (Program : Sexp.Sexpable)
(Path : Sexpable) (Path : Sexp.Sexpable)
(String : Sexpable) (String : Sexp.Sexpable)
(Ast : Action_intf.Ast (Ast : Action_intf.Ast
with type program := Program.t with type program := Program.t
with type path := Path.t with type path := Path.t
@ -676,7 +670,7 @@ module Promotion = struct
let do_promote db = let do_promote db =
let by_targets = group_by_targets db in let by_targets = group_by_targets db in
let potential_build_contexts = let potential_build_contexts =
match Path.readdir Path.build_dir with match Path.readdir_unsorted Path.build_dir with
| exception _ -> [] | exception _ -> []
| files -> | files ->
List.filter_map files ~f:(fun fn -> List.filter_map files ~f:(fun fn ->

View File

@ -87,8 +87,7 @@ module Unexpanded : sig
with type path := String_with_vars.t with type path := String_with_vars.t
with type string := String_with_vars.t with type string := String_with_vars.t
val t : t Sexp.Of_sexp.t include Sexp.Sexpable with type t := t
val sexp_of_t : t Sexp.To_sexp.t
module Partial : sig module Partial : sig
include Action_intf.Ast include Action_intf.Ast

View File

@ -408,7 +408,7 @@ let get_dir_status t ~dir =
Dir_status.Loaded Path.Set.empty Dir_status.Loaded Path.Set.empty
else if not (Path.is_local dir) then else if not (Path.is_local dir) then
Dir_status.Loaded Dir_status.Loaded
(match Path.readdir dir with (match Path.readdir_unsorted dir with
| exception _ -> Path.Set.empty | exception _ -> Path.Set.empty
| files -> | files ->
Path.Set.of_list (List.map files ~f:(Path.relative dir))) 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 Hashtbl.mem t.files (Path.relative dir Config.jbuilder_keep_fname) then
() ()
else else
match Path.readdir dir with match Path.readdir_unsorted dir with
| exception _ -> () | exception _ -> ()
| files -> | files ->
List.iter files ~f:(fun fn -> List.iter files ~f:(fun fn ->

View File

@ -180,7 +180,7 @@ let load ?(extra_ignored_subtrees=Path.Set.empty) path =
let rec walk path ~dirs_visited ~project ~ignored : Dir.t = let rec walk path ~dirs_visited ~project ~ignored : Dir.t =
let contents = lazy ( let contents = lazy (
let files, sub_dirs = let files, sub_dirs =
Path.readdir path Path.readdir_unsorted path
|> List.filter_partition_map ~f:(fun fn -> |> List.filter_partition_map ~f:(fun fn ->
let path = Path.relative path fn in let path = Path.relative path fn in
let is_directory, file = let is_directory, file =

View File

@ -3,7 +3,7 @@ open Import
let parse_sub_systems sexps = let parse_sub_systems sexps =
List.filter_map sexps ~f:(fun sexp -> List.filter_map sexps ~f:(fun sexp ->
let name, ver, data = 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 in
match Sub_system_name.get name with match Sub_system_name.get name with
| None -> | None ->

View File

@ -52,8 +52,8 @@ val is_standard : t -> bool
module Unexpanded : sig module Unexpanded : sig
type expanded = t type expanded = t
type 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 standard : t
val field : ?default:t -> string -> t Sexp.Of_sexp.record_parser val field : ?default:t -> string -> t Sexp.Of_sexp.record_parser

View File

@ -465,7 +465,7 @@ let explode_exn t =
let exists t = let exists t =
try Sys.file_exists (to_string t) try Sys.file_exists (to_string t)
with Sys_error _ -> false 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 = let is_directory t =
try Sys.is_directory (to_string t) try Sys.is_directory (to_string t)
with Sys_error _ -> false with Sys_error _ -> false

View File

@ -128,7 +128,7 @@ val split_first_component : t -> (string * t) option
val insert_after_build_dir_exn : t -> string -> t val insert_after_build_dir_exn : t -> string -> t
val exists : t -> bool val exists : t -> bool
val readdir : t -> string list val readdir_unsorted : t -> string list
val is_directory : t -> bool val is_directory : t -> bool
val rmdir : t -> unit val rmdir : t -> unit
val unlink : t -> unit val unlink : t -> unit

View File

@ -452,3 +452,9 @@ module Of_sexp = struct
String.uncapitalize name) } String.uncapitalize name) }
"Unknown value %s" s "Unknown value %s" s
end end
module type Sexpable = sig
type t
val t : t Of_sexp.t
val sexp_of_t : t To_sexp.t
end

View File

@ -169,3 +169,9 @@ module Of_sexp : sig
val enum : (string * 'a) list -> 'a t val enum : (string * 'a) list -> 'a t
end end
module type Sexpable = sig
type t
val t : t Of_sexp.t
val sexp_of_t : t To_sexp.t
end

View File

@ -7,7 +7,7 @@ module Version = struct
let sexp_of_t t = Sexp.unsafe_atom_of_string (to_string t) 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 | Atom (loc, A s) -> begin
try try
Scanf.sscanf s "%u.%u" (fun a b -> (a, b)) Scanf.sscanf s "%u.%u" (fun a b -> (a, b))

View File

@ -9,8 +9,7 @@ module Version : sig
[Z <= Y]. *) [Z <= Y]. *)
type t = int * int type t = int * int
val sexp_of_t : t Sexp.To_sexp.t include Sexp.Sexpable with type t := t
val t_of_sexp : t Sexp.Of_sexp.t
(** Whether the parser can read the data or not *) (** Whether the parser can read the data or not *)
val can_read : parser_version:t -> data_version:t -> bool val can_read : parser_version:t -> data_version:t -> bool