aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/file.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2024-03-21 06:54:19 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2024-03-21 06:54:19 +0200
commit99d1b89ddf5e42c1ed0873f88613fbd7fd2642d7 (patch)
tree5b4e601141084db0b41d507af918173bdb938713 /libbuild2/file.cxx
parent24c5a3ebb2555b49ebbd10f5c1749fb3308c4772 (diff)
Improve import diagnostics
Diffstat (limited to 'libbuild2/file.cxx')
-rw-r--r--libbuild2/file.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/libbuild2/file.cxx b/libbuild2/file.cxx
index ee1b6b1..c0957ad 100644
--- a/libbuild2/file.cxx
+++ b/libbuild2/file.cxx
@@ -3411,6 +3411,11 @@ namespace build2
const target* pt (nullptr);
const scope* iroot (nullptr); // Imported root scope.
+ // Original project/name as imported for diagnostics.
+ //
+ string oname (meta ? tgt.value : string ());
+ project_name oproj (meta && tgt.proj ? *tgt.proj : project_name ());
+
pair<name, optional<dir_path>> r (
import_search (new_value,
base,
@@ -3515,6 +3520,13 @@ namespace build2
//
if (meta)
{
+ auto df = make_diag_frame (
+ [&oproj, &oname, &t] (const diag_record& dr)
+ {
+ if (!oproj.empty ())
+ import_suggest (dr, oproj, &t.type (), oname, false, "alternative ");
+ });
+
// The export.metadata value should start with the version followed by
// the metadata variable prefix.
//