diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-01 21:50:16 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-06 18:42:14 +0300 |
commit | f11d8c32c01ab1ac13268484b9e85732176a47d9 (patch) | |
tree | 960473ad9016458dde5f8a092b9715c77888aaac /load/load.cxx | |
parent | ca708a3f172e2f0ffab8638087b3e478de06b996 (diff) |
Add support for test-exclude task manifest value
Diffstat (limited to 'load/load.cxx')
-rw-r--r-- | load/load.cxx | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/load/load.cxx b/load/load.cxx index 260f557..b289829 100644 --- a/load/load.cxx +++ b/load/load.cxx @@ -566,7 +566,11 @@ load_packages (const shared_ptr<repository>& rp, else // Create external package object. // - p = make_shared<package> (move (pm.name), move (pm.version), rp); + p = make_shared<package> (move (pm.name), + move (pm.version), + move (pm.builds), + move (pm.build_constraints), + rp); db.persist (p); } @@ -600,9 +604,14 @@ load_packages (const shared_ptr<repository>& rp, // A non-stub package is buildable if belongs to at least one // buildable repository (see libbrep/package.hxx for details). + // Note that if this is an external test package it will be marked as + // unbuildable later (see resolve_dependencies() for details). // - if (!p->stub () && !p->buildable) - p->buildable = rp->buildable; + if (rp->buildable && !p->buildable && !p->stub ()) + { + p->buildable = true; + p->unbuildable_reason = nullopt; + } } p->other_repositories.push_back (rp); @@ -852,9 +861,11 @@ find (const lazy_shared_ptr<repository>& r, // Resolve package run-time dependencies, tests, examples, and benchmarks. // Make sure that the best matching dependency belongs to the package // repositories, their complements, recursively, or their immediate -// prerequisite repositories (only for run-time dependencies). Fail if unable -// to resolve a dependency, unless ignore_unresolved is true in which case -// leave this dependency NULL. Should be called once per internal package. +// prerequisite repositories (only for run-time dependencies). Set the +// buildable flag to false for the resolved tests, examples, and benchmarks +// packages. Fail if unable to resolve a dependency, unless ignore_unresolved +// is true in which case leave this dependency NULL. Should be called once per +// internal package. // static void resolve_dependencies (package& p, database& db, bool ignore_unresolved) @@ -872,7 +883,7 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved) p.benchmarks.empty ()) return; - auto resolve = [&p, &db] (dependency& d, bool prereq) + auto resolve = [&p, &db] (dependency& d, bool test) { // Dependency should not be resolved yet. // @@ -934,9 +945,26 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved) for (const auto& pp: db.query<package> (q + order_by_version_desc (vm))) { - if (find (p.internal_repository, pp, prereq)) + if (find (p.internal_repository, pp, !test)) { d.package.reset (db, pp.id); + + // If the resolved dependency is an external test, then mark it as + // such, unless it is a stub. + // + if (test) + { + shared_ptr<package> dp (d.package.load ()); + + if (!dp->stub ()) + { + dp->buildable = false; + dp->unbuildable_reason = unbuildable_reason::test; + + db.update (dp); + } + } + return true; } } @@ -963,26 +991,26 @@ resolve_dependencies (package& p, database& db, bool ignore_unresolved) // specifying in the manifest file an alternative which can't be // resolved, unless unresolved dependencies are allowed. // - if (!resolve (d, true /* prereq */) && !ignore_unresolved) + if (!resolve (d, false /* test */) && !ignore_unresolved) bail (d, "dependency"); } } for (dependency& d: p.tests) { - if (!resolve (d, false /* prereq */) && !ignore_unresolved) + if (!resolve (d, true /* test */) && !ignore_unresolved) bail (d, "tests"); } for (dependency& d: p.examples) { - if (!resolve (d, false /* prereq */) && !ignore_unresolved) + if (!resolve (d, true /* test */) && !ignore_unresolved) bail (d, "examples"); } for (dependency& d: p.benchmarks) { - if (!resolve (d, false /* prereq */) && !ignore_unresolved) + if (!resolve (d, true /* test */) && !ignore_unresolved) bail (d, "benchmarks"); } |