Skip to content

Commit

Permalink
Move load_jbuild_ignore to upgrader.ml
Browse files Browse the repository at this point in the history
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
  • Loading branch information
jeremiedimino committed Jul 29, 2019
1 parent 8c3401d commit 5c5f5c4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
16 changes: 0 additions & 16 deletions src/file_tree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -72,22 +72,6 @@ module Dune_file = struct
({ contents; kind }, sub_dirs))
end

let load_jbuild_ignore path =
let path = Path.source path in
List.filteri (Io.lines_of_file path) ~f:(fun i fn ->
if Filename.dirname fn = Filename.current_dir_name then
true
else begin
User_warning.emit ~loc:(Loc.of_pos
( Path.to_string path
, i + 1, 0
, String.length fn
))
[ Pp.textf "subdirectory expression %s ignored" fn ];
false
end)
|> String.Set.of_list

module Dir = struct
type t =
{ path : Path.Source.t
Expand Down
3 changes: 0 additions & 3 deletions src/file_tree.mli
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,3 @@ val files_recursively_in
-> prefix_with:Path.t
-> Path.Source.t
-> Path.Set.t

(** Load a [jbuild-ignore] file *)
val load_jbuild_ignore : Path.Source.t -> String.Set.t
6 changes: 5 additions & 1 deletion src/upgrader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ let upgrade_stanza stanza =
in
upgrade stanza

let load_jbuild_ignore path =
let path = Path.source path in
String.Set.of_list (Io.lines_of_file path)

let upgrade_file todo file sexps comments ~look_for_jbuild_ignore =
let dir = Path.Source.parent_exn file in
let new_file =
Expand All @@ -208,7 +212,7 @@ let upgrade_file todo file sexps comments ~look_for_jbuild_ignore =
&& Path.exists (Path.source jbuild_ignore)) then
(sexps, [])
else begin
let data_only_dirs = File_tree.load_jbuild_ignore jbuild_ignore in
let data_only_dirs = load_jbuild_ignore jbuild_ignore in
let stanza =
Dune_lang.add_loc ~loc:Loc.none
(List (Dune_lang.atom "data_only_dirs"
Expand Down

0 comments on commit 5c5f5c4

Please sign in to comment.