Fix #534
This commit is contained in:
parent
4993c6b89a
commit
41b5017eb2
|
@ -1,3 +1,8 @@
|
||||||
|
next
|
||||||
|
----
|
||||||
|
|
||||||
|
- Fix invalid warning about non-existent direcotry (#536, fixes #534)
|
||||||
|
|
||||||
1.0+beta18 (21/02/2018)
|
1.0+beta18 (21/02/2018)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,32 @@ module Static_deps = struct
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
let static_deps t ~all_targets =
|
type file_kind = Reg | Dir
|
||||||
|
|
||||||
|
let inspect_path file_tree path =
|
||||||
|
match Path.drop_build_context path with
|
||||||
|
| None ->
|
||||||
|
if not (Path.exists path) then
|
||||||
|
None
|
||||||
|
else if Path.is_directory path then
|
||||||
|
Some Dir
|
||||||
|
else
|
||||||
|
Some Reg
|
||||||
|
| Some path ->
|
||||||
|
match File_tree.find_dir file_tree path with
|
||||||
|
| Some _ ->
|
||||||
|
Some Dir
|
||||||
|
| None ->
|
||||||
|
if Path.is_root path then
|
||||||
|
Some Dir
|
||||||
|
else if File_tree.file_exists file_tree
|
||||||
|
(Path.parent path)
|
||||||
|
(Path.basename path) then
|
||||||
|
Some Reg
|
||||||
|
else
|
||||||
|
None
|
||||||
|
|
||||||
|
let static_deps t ~all_targets ~file_tree =
|
||||||
let rec loop : type a b. (a, b) t -> Static_deps.t -> Static_deps.t = fun t acc ->
|
let rec loop : type a b. (a, b) t -> Static_deps.t -> Static_deps.t = fun t acc ->
|
||||||
match t with
|
match t with
|
||||||
| Arr _ -> acc
|
| Arr _ -> acc
|
||||||
|
@ -49,13 +74,16 @@ let static_deps t ~all_targets =
|
||||||
Re.execp re (Path.basename path))
|
Re.execp re (Path.basename path))
|
||||||
in
|
in
|
||||||
if Pset.is_empty result then begin
|
if Pset.is_empty result then begin
|
||||||
if not (Path.exists dir) then
|
match inspect_path file_tree dir with
|
||||||
|
| None ->
|
||||||
Loc.warn loc "Directory %s doesn't exist."
|
Loc.warn loc "Directory %s doesn't exist."
|
||||||
(Path.to_string_maybe_quoted dir)
|
(Path.to_string_maybe_quoted
|
||||||
else if not (Path.is_directory dir) then
|
(Path.drop_optional_build_context dir))
|
||||||
|
| Some Reg ->
|
||||||
Loc.warn loc "%s is not a directory."
|
Loc.warn loc "%s is not a directory."
|
||||||
(Path.to_string_maybe_quoted dir)
|
(Path.to_string_maybe_quoted
|
||||||
else
|
(Path.drop_optional_build_context dir))
|
||||||
|
| Some Dir ->
|
||||||
(* diml: we should probably warn in this case as well *)
|
(* diml: we should probably warn in this case as well *)
|
||||||
()
|
()
|
||||||
end;
|
end;
|
||||||
|
|
|
@ -43,6 +43,7 @@ end
|
||||||
val static_deps
|
val static_deps
|
||||||
: (_, _) Build.t
|
: (_, _) Build.t
|
||||||
-> all_targets:(dir:Path.t -> Path.Set.t)
|
-> all_targets:(dir:Path.t -> Path.Set.t)
|
||||||
|
-> file_tree:File_tree.t
|
||||||
-> Static_deps.t
|
-> Static_deps.t
|
||||||
|
|
||||||
val lib_deps
|
val lib_deps
|
||||||
|
|
|
@ -646,6 +646,7 @@ let rec compile_rule t ?(copy_source=false) pre_rule =
|
||||||
rule_deps
|
rule_deps
|
||||||
; action_deps = static_deps
|
; action_deps = static_deps
|
||||||
} = Build_interpret.static_deps build ~all_targets:(targets_of t)
|
} = Build_interpret.static_deps build ~all_targets:(targets_of t)
|
||||||
|
~file_tree:t.file_tree
|
||||||
in
|
in
|
||||||
|
|
||||||
let eval_rule () =
|
let eval_rule () =
|
||||||
|
@ -1148,6 +1149,7 @@ let eval_request t ~request ~process_target =
|
||||||
rule_deps
|
rule_deps
|
||||||
; action_deps = static_deps
|
; action_deps = static_deps
|
||||||
} = Build_interpret.static_deps request ~all_targets:(targets_of t)
|
} = Build_interpret.static_deps request ~all_targets:(targets_of t)
|
||||||
|
~file_tree:t.file_tree
|
||||||
in
|
in
|
||||||
|
|
||||||
let process_targets ts =
|
let process_targets ts =
|
||||||
|
@ -1205,6 +1207,7 @@ let static_deps_of_request t request =
|
||||||
rule_deps
|
rule_deps
|
||||||
; action_deps
|
; action_deps
|
||||||
} = Build_interpret.static_deps request ~all_targets:(targets_of t)
|
} = Build_interpret.static_deps request ~all_targets:(targets_of t)
|
||||||
|
~file_tree:t.file_tree
|
||||||
in
|
in
|
||||||
Pset.elements (Pset.union rule_deps action_deps)
|
Pset.elements (Pset.union rule_deps action_deps)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
$ $JBUILDER exec ./main.exe --root . -j1 --display short
|
$ $JBUILDER exec ./main.exe --root . -j1 --display short
|
||||||
File "jbuild", line 1, characters 0-124:
|
|
||||||
Warning: Directory _build/default doesn't exist.
|
|
||||||
File "jbuild", line 1, characters 0-89:
|
|
||||||
Warning: Directory _build/default doesn't exist.
|
|
||||||
echo main.ml
|
echo main.ml
|
||||||
ocamldep main.ml.d
|
ocamldep main.ml.d
|
||||||
ocamlc .main.eobjs/main.{cmi,cmo,cmt}
|
ocamlc .main.eobjs/main.{cmi,cmo,cmt}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
$ $JBUILDER runtest -j1 --display short --root .
|
$ $JBUILDER runtest -j1 --display short --root .
|
||||||
File "jbuild", line 54, characters 10-209:
|
File "jbuild", line 54, characters 10-209:
|
||||||
Warning: Directory _build/default/dir-that-doesnt-exist doesn't exist.
|
Warning: Directory dir-that-doesnt-exist doesn't exist.
|
||||||
diff alias runtest
|
diff alias runtest
|
||||||
diff alias runtest
|
diff alias runtest
|
||||||
diff alias runtest
|
diff alias runtest
|
||||||
|
|
Loading…
Reference in New Issue