From 0f619ddcbee3b477edd2ab46f5f82d1ae693d553 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 May 2023 09:55:54 +0200 Subject: New 'lines' dependency format in depdb-dyndep --- libbuild2/adhoc-rule-buildscript.cxx | 44 +++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'libbuild2/adhoc-rule-buildscript.cxx') diff --git a/libbuild2/adhoc-rule-buildscript.cxx b/libbuild2/adhoc-rule-buildscript.cxx index cf45699..6134f27 100644 --- a/libbuild2/adhoc-rule-buildscript.cxx +++ b/libbuild2/adhoc-rule-buildscript.cxx @@ -1414,7 +1414,8 @@ namespace build2 if (f.relative ()) { if (!byp.cwd) - fail (il) << "relative prerequisite path '" << f + fail (il) << "relative " << what + << " prerequisite path '" << f << "' in make dependency declaration" << info << "consider using --cwd to specify relative path " << "base"; @@ -1432,6 +1433,47 @@ namespace build2 break; } + case dyndep_format::lines: + { + for (string l;; ++il.line) // Reuse the buffer. + { + if (eof (getline (is, l))) + break; + + if (l.empty ()) + fail (il) << "blank line in prerequisites list"; + + if (l.front () == ' ') + fail (il) << "non-existent prerequisite in --byproduct mode"; + + path f; + try + { + f = path (l); + + if (f.relative ()) + { + if (!byp.cwd) + fail (il) << "relative " << what + << " prerequisite path '" << f + << "' in lines dependency declaration" << + info << "consider using --cwd to specify " + << "relative path base"; + + f = *byp.cwd / f; + } + } + catch (const invalid_path&) + { + fail (il) << "invalid " << what << " prerequisite path '" + << l << "'"; + } + + add (move (f)); + } + + break; + } } // Add the terminating blank line. -- cgit v1.1