diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-05-29 09:55:54 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-05-29 14:12:00 +0200 |
commit | 609c81c87b2e672ebf64e10d709da869d0355495 (patch) | |
tree | d9b264f250a03844a8a6c226a5f7984f9c52d40a /libbuild2/adhoc-rule-buildscript.cxx | |
parent | 9bea2f465cc2b47e06d65d6a29cb0f0f0c37f29c (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. |