From bdb86456ec665f4367bc1caf52902a3a3a4fbbed Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 20 Jun 2020 18:54:44 +0300 Subject: Merge package external test, example, and benchmark dependencies into typed test dependency --- libbpkg/manifest.hxx | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'libbpkg/manifest.hxx') diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index b82b87e..fd528cd 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -276,7 +276,7 @@ namespace bpkg // // See libbutl/url.mxx for details. // - class manifest_url: public butl::url + class LIBBPKG_EXPORT manifest_url: public butl::url { public: std::string comment; @@ -668,6 +668,38 @@ namespace bpkg return os << to_string (t); } + enum class test_dependency_type + { + tests, + examples, + benchmarks + }; + + LIBBPKG_EXPORT std::string + to_string (test_dependency_type); + + // May throw std::invalid_argument. + // + LIBBPKG_EXPORT test_dependency_type + to_test_dependency_type (const std::string&); + + inline std::ostream& + operator<< (std::ostream& os, test_dependency_type t) + { + return os << to_string (t); + } + + struct test_dependency: dependency + { + test_dependency_type type; + + test_dependency () = default; + test_dependency (package_name n, + test_dependency_type t, + butl::optional c) + : dependency {std::move (n), std::move (c)}, type (t) {} + }; + class LIBBPKG_EXPORT package_manifest { public: @@ -704,9 +736,7 @@ namespace bpkg butl::optional build_error_email; std::vector dependencies; std::vector requirements; - butl::small_vector tests; - butl::small_vector examples; - butl::small_vector benchmarks; + butl::small_vector tests; butl::small_vector builds; std::vector build_constraints; -- cgit v1.1