From 1f06bb56dd237d318a55ce426ad1de5b9ea46e31 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Thu, 12 Jan 2023 11:53:53 +0100 Subject: source map: quote file names in error message ... to ensure unique readability even with file names containing spaces or other special symbols; those kind of fancy file names typically occur when a string intended as named target is implicitly taken as a file (e.g., due to a spelling error). While there, also include directory and repository in the error message. --- src/buildtool/build_engine/base_maps/source_map.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/buildtool/build_engine/base_maps/source_map.cpp') diff --git a/src/buildtool/build_engine/base_maps/source_map.cpp b/src/buildtool/build_engine/base_maps/source_map.cpp index b0292821..ad91a09b 100644 --- a/src/buildtool/build_engine/base_maps/source_map.cpp +++ b/src/buildtool/build_engine/base_maps/source_map.cpp @@ -16,6 +16,7 @@ #include +#include "nlohmann/json.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/file_system/object_type.hpp" #include "src/buildtool/multithreading/async_map_consumer.hpp" @@ -72,10 +73,16 @@ auto CreateSourceTargetMap(const gsl::not_null& dirs, return; } } - (*logger)(fmt::format( - "Cannot determine source file {}", - path(key.GetNamedTarget().name).filename().string()), - true); + (*logger)( + fmt::format( + "Cannot determine source file {} in directory {} of " + "repository {}", + nlohmann::json( + path(key.GetNamedTarget().name).filename().string()) + .dump(), + nlohmann::json(dir.string()).dump(), + nlohmann::json(key.GetNamedTarget().repository).dump()), + true); }; if (ws_root != nullptr and ws_root->HasFastDirectoryLookup()) { -- cgit v1.2.3