From 5d77345531d75b8a8becf884ec876a946585abbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bobot?= Date: Thu, 5 May 2022 11:56:46 +0200 Subject: [PATCH] Check that deps are not in source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit but in build or external. Signed-off-by: François Bobot --- src/dune_util/value.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dune_util/value.ml b/src/dune_util/value.ml index 4c14223af5e1..4640125ee14a 100644 --- a/src/dune_util/value.ml +++ b/src/dune_util/value.ml @@ -42,7 +42,12 @@ let to_path ?error_loc t ~dir = let to_path_in_build_or_external ?error_loc t ~dir = match t with | String s -> Path.relative_to_source_in_build_or_external ?error_loc ~dir s - | Dir p | Path p -> p + | Dir p | Path p -> + if Path.is_in_source_tree p then + Code_error.raise ?loc:error_loc + "to_path_in_build_or_external got a file in source directory" + [ ("path", Path.to_dyn p) ]; + p module L = struct let to_dyn t = Dyn.List (List.map t ~f:to_dyn)