diff options
-rw-r--r-- | bpkg/package.hxx | 9 | ||||
-rw-r--r-- | bpkg/package.xml | 6 | ||||
-rw-r--r-- | bpkg/rep-fetch.cxx | 28 | ||||
-rw-r--r-- | doc/manual.cli | 30 |
4 files changed, 54 insertions, 19 deletions
diff --git a/bpkg/package.hxx b/bpkg/package.hxx index cb1a401..14831e0 100644 --- a/bpkg/package.hxx +++ b/bpkg/package.hxx @@ -27,7 +27,7 @@ // #define DB_SCHEMA_VERSION_BASE 6 -#pragma db model version(DB_SCHEMA_VERSION_BASE, 10, closed) +#pragma db model version(DB_SCHEMA_VERSION_BASE, 11, closed) namespace bpkg { @@ -557,10 +557,10 @@ namespace bpkg // Create the special test dependencies object (built incrementally). // - dependency_alternatives_ex (test_dependency_type t) + dependency_alternatives_ex (test_dependency_type t, bool buildtime) : dependency_alternatives (false /* conditional */, - false /* buildtime */, - "" /* comment */), + buildtime, + "" /* comment */), type (t) {} }; @@ -579,6 +579,7 @@ namespace bpkg // tests // #pragma db value(test_dependency) definition + #pragma db member(test_dependency::buildtime) default(false) using optional_test_dependency_type = optional<test_dependency_type>; diff --git a/bpkg/package.xml b/bpkg/package.xml index e5b28c9..96aeed3 100644 --- a/bpkg/package.xml +++ b/bpkg/package.xml @@ -1,4 +1,10 @@ <changelog xmlns="http://www.codesynthesis.com/xmlns/odb/changelog" database="sqlite" version="1"> + <changeset version="11"> + <alter-table name="main.available_package_tests"> + <add-column name="test_buildtime" type="INTEGER" null="true" default="0"/> + </alter-table> + </changeset> + <changeset version="10"/> <changeset version="9"> 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); } diff --git a/doc/manual.cli b/doc/manual.cli index d8c8254..5332281 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -1236,18 +1236,24 @@ msvc[_NU] ; For example: msvc_14, msvc_15u3 \h2#manifest-package-tests-examples-benchmarks|\c{tests, examples, benchmarks}| \ -[tests]: <name> [<version-constraint>] -[examples]: <name> [<version-constraint>] -[benchmarks]: <name> [<version-constraint>] -\ - -Separate tests, examples, and benchmarks packages. These packages are built -and tested by automated build bots together with the primary package (see the -\c{bbot} documentation for details). This, in particular, implies that these -packages must be available from the primary package's repository or its -complement repositories, recursively. The recommended naming convention for -these packages is the primary package name followed by \c{-tests}, -\c{-examples}, or \c{-benchmarks}, respectively. For example: +[tests]: [*] <name> [<version-constraint>] +[examples]: [*] <name> [<version-constraint>] +[benchmarks]: [*] <name> [<version-constraint>] +\ + +Separate tests, examples, and benchmarks packages. If the value starts with +\c{*}, then the primary package is a \i{build-time} prerequisite for the +specified package. Otherwise it is \i{run-time}. See the +\l{#manifest-package-depends \c{depends}} value for details on \i{build-time} +prerequisites. + +These packages are built and tested by automated build bots together with the +primary package (see the \c{bbot} documentation for details). This, in +particular, implies that these packages must be available from the primary +package's repository or its complement repositories, recursively. The +recommended naming convention for these packages is the primary package name +followed by \c{-tests}, \c{-examples}, or \c{-benchmarks}, respectively. For +example: \ name: hello |