From b90cbd6de11442500bbb6e0cdfe0bdcb286d67ec Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 12 Jan 2022 14:28:43 +0300 Subject: Add support for multiple dependency alternatives --- bpkg/package.cxx | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'bpkg/package.cxx') diff --git a/bpkg/package.cxx b/bpkg/package.cxx index 9a8068c..e2a6911 100644 --- a/bpkg/package.cxx +++ b/bpkg/package.cxx @@ -7,6 +7,7 @@ #include #include #include +#include #include using namespace std; @@ -764,4 +765,58 @@ namespace bpkg r.push_back (move (pd)); return r; } + + bool + toolchain_buildtime_dependency (const common_options& o, + const dependency_alternatives_ex& das, + const package_name& pkg) + { + if (das.buildtime) + { + for (const dependency_alternative& da: das) + { + for (const dependency& d: da) + { + const package_name& dn (d.name); + + if (dn == "build2") + { + if (d.constraint && !satisfy_build2 (o, d)) + { + fail << "unable to satisfy constraint (" << d << ") for " + << "package " << pkg << + info << "available build2 version is " << build2_version; + } + + return true; + } + else if (dn == "bpkg") + { + if (d.constraint && !satisfy_bpkg (o, d)) + { + fail << "unable to satisfy constraint (" << d << ") for " + << "package " << pkg << + info << "available bpkg version is " << bpkg_version; + } + + return true; + } + } + } + } + + return false; + } + + bool + evaluate_enabled (const dependency_alternative& da, const package_name& pkg) + { + // @@ DEP TMP + // + if (da.enable) + fail << "conditional dependency for package " << pkg << + info << "conditional dependencies are not yet supported"; + + return true; + } } -- cgit v1.1