diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-05-29 09:55:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-05-29 13:08:02 +0200 |
commit | 0f619ddcbee3b477edd2ab46f5f82d1ae693d553 (patch) | |
tree | e8216a18ae0c80ba898905253f6fd0b857a68af3 /libbuild2/adhoc-rule-buildscript.cxx | |
parent | b3ab281662fec0a034984e00d527e1741b657f12 (diff) |
New 'lines' dependency format in depdb-dyndep
Diffstat (limited to 'libbuild2/adhoc-rule-buildscript.cxx')
-rw-r--r-- | libbuild2/adhoc-rule-buildscript.cxx | 44 |
1 files changed, 43 insertions, 1 deletions
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. |