summaryrefslogtreecommitdiff
path: root/src/buildtool/build_engine/base_maps/source_map.cpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2023-01-12 11:53:53 +0100
committerKlaus Aehlig <klaus.aehlig@huawei.com>2023-01-12 12:10:45 +0100
commit1f06bb56dd237d318a55ce426ad1de5b9ea46e31 (patch)
tree37592be545a2b119b0ce162da91c4beb54b7d70c /src/buildtool/build_engine/base_maps/source_map.cpp
parent9582e7dae5137161707130dad56e09655b97951f (diff)
downloadjustbuild-1f06bb56dd237d318a55ce426ad1de5b9ea46e31.tar.gz
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.
Diffstat (limited to 'src/buildtool/build_engine/base_maps/source_map.cpp')
-rw-r--r--src/buildtool/build_engine/base_maps/source_map.cpp15
1 files changed, 11 insertions, 4 deletions
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 <filesystem>
+#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<DirectoryEntriesMap*>& 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()) {