diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-19 21:23:50 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-08-20 13:14:54 +0300 |
commit | 987bf4a6522e642a1e4dfe276d4fc1efbb2b52b5 (patch) | |
tree | b9261e402caa1d8ac20df9ad5635fca3a185a664 /bpkg/rep-fetch.cxx | |
parent | 4e9e142a6564b2a73848e735f9a1b5bb744d6a83 (diff) |
Add support for build-time mark (*) in tests, examples, and benchmarks package manifest values
Diffstat (limited to 'bpkg/rep-fetch.cxx')
-rw-r--r-- | bpkg/rep-fetch.cxx | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/bpkg/rep-fetch.cxx b/bpkg/rep-fetch.cxx index de6e3b7..7e0d3da 100644 --- a/bpkg/rep-fetch.cxx +++ b/bpkg/rep-fetch.cxx @@ -1448,10 +1448,32 @@ namespace bpkg dependencies& ds (tp->dependencies); if (ds.empty () || !ds.back ().type) - ds.push_back (dependency_alternatives_ex (td.type)); + ds.push_back (dependency_alternatives_ex (td.type, + td.buildtime)); - ds.back ().push_back ( - dependency {p->id.name, version_constraint (p->version)}); + dependency_alternatives_ex& da (ds.back ()); + + // Note that since we store all the primary packages as + // alternative dependencies (which must be all of the same + // dependency type) for the test package, it must either be a + // runtime or build-time dependency for all of them. + // + // Note that the test package alternative dependencies contain the + // `== <version>` constraints (see below), so we can use min + // version of such a constraint as the primary package version. + // + if (da.buildtime != td.buildtime) + fail << to_string (td.type) << " package " << td.name << " is a " + << "build-time dependency for one primary package and a " + << "run-time for another" << + info << (da.buildtime ? "build-time for " : "run-time for ") + << package_string (da[0].name, + *da[0].constraint->min_version) << + info << (td.buildtime ? "build-time for " : "run-time for ") + << package_string (p->id.name, p->version); + + da.push_back (dependency {p->id.name, + version_constraint (p->version)}); db.update (tp); } |