Skip to content
10 changes: 10 additions & 0 deletions otherlibs/stdune/src/fpath.ml
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ let traverse
?(on_symlink = `Resolve)
?(enter_dir = fun ~dir:_ _fname -> true)
?(on_error = `Raise)
?(sort_entries = false)
()
=
let on_other =
Expand Down Expand Up @@ -300,6 +301,15 @@ let traverse
let acc = on_error ~dir e acc in
loop root dirs acc
| Ok entries ->
let entries =
if sort_entries
then
List.sort
~compare:(fun (name1, _kind1) (name2, _kind2) ->
String.compare name2 name1)
entries
else entries
in
let stack, acc =
List.fold_left entries ~init:(dirs, acc) ~f:(fun (stack, acc) (fname, kind) ->
match (kind : Unix.file_kind) with
Expand Down
1 change: 1 addition & 0 deletions otherlibs/stdune/src/fpath.mli
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ val traverse
-> ?enter_dir:(dir:string -> Filename.t -> bool)
-> ?on_error:
[ `Ignore | `Raise | `Call of dir:string -> Unix_error.Detailed.t -> 'acc -> 'acc ]
-> ?sort_entries:bool
-> unit
-> 'acc

Expand Down
19 changes: 19 additions & 0 deletions src/dune_pkg/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
; OxCaml's ppx_expect v0.18 rejects [let%test_module] in favour of
; [module%test], but upstream ppx_expect has not released v0.18 yet.
; Until it does we must support both: pass the compatibility flag on
; OxCaml and nothing otherwise.

(rule
(enabled_if %{ocaml-config:ox})
(action
(write-file ppx-extra-flags "-inline-test-allow-let-test-module")))

(rule
(enabled_if
(not %{ocaml-config:ox}))
(action
(write-file ppx-extra-flags "")))

(library
(name dune_pkg)
(synopsis "[Internal] Dune's packaging support")
(foreign_stubs
(names md5_stubs)
(language c))
(inline_tests)
(preprocess
(pps ppx_expect -- %{read-lines:ppx-extra-flags}))
(libraries
stdune
lmdb
Expand Down
Loading
Loading