Merge pull request #1120 from ocaml/fix-1099
Fix error when copy_files source does not exist
This commit is contained in:
commit
1cd5050861
|
@ -4,6 +4,9 @@ next
|
||||||
- Ignore stderr output when trying to find out the number of jobs
|
- Ignore stderr output when trying to find out the number of jobs
|
||||||
available (#1118, fix #1116, @diml)
|
available (#1118, fix #1116, @diml)
|
||||||
|
|
||||||
|
- Fix error message when the source directory of `copy_files` does not exist.
|
||||||
|
(#1120, fix #1099, @emillon)
|
||||||
|
|
||||||
1.1.1 (08/08/2018)
|
1.1.1 (08/08/2018)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,9 @@ val files_of : t -> Path.t -> Path.Set.t
|
||||||
(** [true] iff the path is either a directory or a file *)
|
(** [true] iff the path is either a directory or a file *)
|
||||||
val exists : t -> Path.t -> bool
|
val exists : t -> Path.t -> bool
|
||||||
|
|
||||||
|
(** [true] iff the path is a directory *)
|
||||||
|
val dir_exists : t -> Path.t -> bool
|
||||||
|
|
||||||
(** [true] iff the path is a file *)
|
(** [true] iff the path is a file *)
|
||||||
val file_exists : t -> Path.t -> string -> bool
|
val file_exists : t -> Path.t -> string -> bool
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,12 @@ let copy_files sctx ~dir ~scope ~src_dir (def: Copy_files.t) =
|
||||||
| Error (_pos, msg) ->
|
| Error (_pos, msg) ->
|
||||||
Loc.fail (String_with_vars.loc def.glob) "invalid glob: %s" msg
|
Loc.fail (String_with_vars.loc def.glob) "invalid glob: %s" msg
|
||||||
in
|
in
|
||||||
|
let file_tree = Super_context.file_tree sctx in
|
||||||
|
if not (File_tree.dir_exists file_tree src_in_src) then
|
||||||
|
Loc.fail
|
||||||
|
loc
|
||||||
|
"cannot find directory: %a"
|
||||||
|
Path.pp src_in_src;
|
||||||
(* add rules *)
|
(* add rules *)
|
||||||
let src_in_build = Path.append (SC.context sctx).build_dir src_in_src in
|
let src_in_build = Path.append (SC.context sctx).build_dir src_in_src in
|
||||||
let files = SC.eval_glob sctx ~dir:src_in_build re in
|
let files = SC.eval_glob sctx ~dir:src_in_build re in
|
||||||
|
|
|
@ -231,6 +231,14 @@
|
||||||
test-cases/github1019
|
test-cases/github1019
|
||||||
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
|
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
|
||||||
|
|
||||||
|
(alias
|
||||||
|
(name github1099)
|
||||||
|
(deps (package dune) (source_tree test-cases/github1099))
|
||||||
|
(action
|
||||||
|
(chdir
|
||||||
|
test-cases/github1099
|
||||||
|
(progn (run %{exe:cram.exe} -test run.t) (diff? run.t run.t.corrected)))))
|
||||||
|
|
||||||
(alias
|
(alias
|
||||||
(name github20)
|
(name github20)
|
||||||
(deps (package dune) (source_tree test-cases/github20))
|
(deps (package dune) (source_tree test-cases/github20))
|
||||||
|
@ -803,6 +811,7 @@
|
||||||
(alias force-test)
|
(alias force-test)
|
||||||
(alias gen-opam-install-file)
|
(alias gen-opam-install-file)
|
||||||
(alias github1019)
|
(alias github1019)
|
||||||
|
(alias github1099)
|
||||||
(alias github20)
|
(alias github20)
|
||||||
(alias github24)
|
(alias github24)
|
||||||
(alias github25)
|
(alias github25)
|
||||||
|
@ -898,6 +907,7 @@
|
||||||
(alias findlib-error)
|
(alias findlib-error)
|
||||||
(alias force-test)
|
(alias force-test)
|
||||||
(alias github1019)
|
(alias github1019)
|
||||||
|
(alias github1099)
|
||||||
(alias github20)
|
(alias github20)
|
||||||
(alias github24)
|
(alias github24)
|
||||||
(alias github25)
|
(alias github25)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
let () = ()
|
|
@ -0,0 +1,3 @@
|
||||||
|
(copy_files# "no_dir/*")
|
||||||
|
|
||||||
|
(executable (name demo))
|
|
@ -0,0 +1 @@
|
||||||
|
(lang dune 1.1)
|
|
@ -0,0 +1 @@
|
||||||
|
let () = ()
|
|
@ -0,0 +1,3 @@
|
||||||
|
(copy_files# "no_dir/*")
|
||||||
|
|
||||||
|
(executable (name demo))
|
|
@ -0,0 +1 @@
|
||||||
|
(lang dune 1.1)
|
|
@ -0,0 +1,15 @@
|
||||||
|
If the source directory does not exist, an error message is printed:
|
||||||
|
|
||||||
|
$ dune build --root no-dir demo.exe
|
||||||
|
Entering directory 'no-dir'
|
||||||
|
File "dune", line 1, characters 13-23:
|
||||||
|
Error: cannot find directory: no_dir
|
||||||
|
[1]
|
||||||
|
|
||||||
|
This works also is a file exists with the same name:
|
||||||
|
|
||||||
|
$ dune build --root file-with-same-name demo.exe
|
||||||
|
Entering directory 'file-with-same-name'
|
||||||
|
File "dune", line 1, characters 13-23:
|
||||||
|
Error: cannot find directory: no_dir
|
||||||
|
[1]
|
Loading…
Reference in New Issue