From 99d1b89ddf5e42c1ed0873f88613fbd7fd2642d7 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Mar 2024 06:54:19 +0200 Subject: Improve import diagnostics --- libbuild2/file.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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> 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. // -- cgit v1.1