From 161d105204eb66148c28ef2615f1a12d3ba33136 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 11 Jun 2015 17:11:54 +0200 Subject: Manifest object model, take 1 --- bpkg/buildfile | 2 +- bpkg/manifest | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ bpkg/manifest.cxx | 11 +++++ 3 files changed, 141 insertions(+), 1 deletion(-) create mode 100644 bpkg/manifest create mode 100644 bpkg/manifest.cxx diff --git a/bpkg/buildfile b/bpkg/buildfile index 45d9d89..8d11e61 100644 --- a/bpkg/buildfile +++ b/bpkg/buildfile @@ -3,4 +3,4 @@ # license : MIT; see accompanying LICENSE file import libs += libhello -lib{bpkg}: cxx{manifest-parser manifest-serializer} $libs +lib{bpkg}: cxx{manifest-parser manifest-serializer manifest} $libs diff --git a/bpkg/manifest b/bpkg/manifest new file mode 100644 index 0000000..bf17a64 --- /dev/null +++ b/bpkg/manifest @@ -0,0 +1,129 @@ +// file : bpkg/manifest -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#ifndef BPKG_MANIFEST +#define BPKG_MANIFEST + +#include +#include + +#include + +namespace bpkg +{ + using strings = std::vector; + + // priority + // + class priority + { + public: + enum value_type {low, medium, high, security}; + + std::string comment; + + priority (value_type v = low): value (v) {} + operator value_type () const {return value;} + + private: + value_type value; // Shouldn't be necessary to access directly. + }; + + // description + // description-file + // + struct description: std::string + { + bool file; + std::string comment; + }; + + // license + // + struct licenses: strings + { + std::string comment; + }; + + // change + // change-file + // + struct change: std::string + { + bool file; + std::string comment; + }; + + // url + // package-url + // + struct url: std::string + { + std::string comment; + }; + + // email + // package-email + // + struct email: std::string + { + std::string comment; + }; + + // depends + // + enum class comparison {eq, lt, gt, le, ge}; + + struct version_comparison + { + std::string value; + comparison operation; + }; + + struct dependency + { + std::string name; + butl::optional version; + }; + + struct dependency_alternatives: std::vector + { + bool conditional; + std::string comment; + }; + + // requires + // + struct requirement_alternatives: strings + { + bool conditional; + std::string comment; + }; + + struct manifest + { + using priority_type = bpkg::priority; + using url_type = bpkg::url; + using email_type = bpkg::email; + + std::string name; + std::string version; + priority_type priority; + std::string summary; + std::vector license_alternatives; + strings tags; + std::vector descriptions; + std::vector changes; + url_type url; + butl::optional package_url; + email_type email; + butl::optional package_email; + std::vector dependencies; + std::vector requirements; + }; + + using manifests = std::vector; +} + +#endif // BPKG_MANIFEST diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx new file mode 100644 index 0000000..40c7a32 --- /dev/null +++ b/bpkg/manifest.cxx @@ -0,0 +1,11 @@ +// file : bpkg/manifest.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +using namespace std; + +namespace bpkg +{ +} -- cgit v1.1