Skip to content

Commit

Permalink
Create dune-project when missing
Browse files Browse the repository at this point in the history
Signed-off-by: Ulysse Gérard <thevoodoos@gmail.com>
  • Loading branch information
voodoos committed Mar 3, 2020
1 parent 3a1b5e4 commit 605ae57
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/dune/upgrader.ml
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,8 @@ module V2 = struct
let upgrade todo dir =
Dune_project.default_dune_language_version := (2, 0);
let project = File_tree.Dir.project dir in
let _project_root = Dune_project.root project in
(* if project_root = File_tree.Dir.path dir ? *)
if Dune_project.root project = File_tree.Dir.path dir then
ignore (Dune_project.ensure_project_file_exists project);
update_project_file todo project;
upgrade_dune_files todo dir
end
Expand All @@ -625,7 +625,8 @@ let fold_on_project_roots ~f ~init =

let detect_project_version project dir =
(* TODO is it useful or can we use dune_version directly *)
if String.Set.mem (File_tree.Dir.files dir) File_tree.Dune_file.jbuild_fname
let in_tree = String.Set.mem (File_tree.Dir.files dir) in
if in_tree File_tree.Dune_file.jbuild_fname
then
Jbuild_project
else
Expand All @@ -635,8 +636,9 @@ let detect_project_version project dir =
Dune2_project
else if project_dune_version >= (1, 0) then
Dune1_project
else
Jbuild_project
else if in_tree File_tree.Dune_file.fname then
Dune1_project
else Jbuild_project

let detect_and_add_project_version dir acc =
let project = File_tree.Dir.project dir in
Expand Down

0 comments on commit 605ae57

Please sign in to comment.