aboutsummaryrefslogtreecommitdiff
path: root/libbpkg/manifest.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-09-28 22:15:02 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-10-02 16:40:22 +0300
commit523168b187b55085ff47064585838d321eb724a5 (patch)
tree5bf7934d583d01fbbed876b333921d9af4ce58a4 /libbpkg/manifest.hxx
parent9f632c7e160639ca7a11fe1ac48598b67e36652e (diff)
Add support for *-build-*email package manifest values and their overrides
Diffstat (limited to 'libbpkg/manifest.hxx')
-rw-r--r--libbpkg/manifest.hxx58
1 files changed, 50 insertions, 8 deletions
diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx
index dce0870..8439cdf 100644
--- a/libbpkg/manifest.hxx
+++ b/libbpkg/manifest.hxx
@@ -980,12 +980,15 @@ namespace bpkg
return os << bce.string ();
}
- // Package build configuration. Includes comment and optional target build
- // configuration class expressions/constraints overrides.
+ // Package build configuration. Includes comment and optional overrides for
+ // target build configuration class expressions/constraints and build
+ // notification emails.
//
class build_package_config
{
public:
+ using email_type = bpkg::email;
+
std::string name;
// Whitespace separated list of potentially double/single-quoted package
@@ -999,6 +1002,10 @@ namespace bpkg
butl::small_vector<build_class_expr, 1> builds;
std::vector<build_constraint> constraints;
+ butl::optional<email_type> email;
+ butl::optional<email_type> warning_email;
+ butl::optional<email_type> error_email;
+
build_package_config () = default;
// Built incrementally.
@@ -1024,6 +1031,31 @@ namespace bpkg
{
return !builds.empty () || !constraints.empty () ? constraints : common;
}
+
+ // Return the configuration's build notification emails if they override
+ // the specified common build notification emails and return the latter
+ // otherwise (see package_manifest::override() for the override semantics
+ // details).
+ //
+ const butl::optional<email_type>&
+ effective_email (const butl::optional<email_type>& common) const noexcept
+ {
+ return email || warning_email || error_email ? email : common;
+ }
+
+ const butl::optional<email_type>&
+ effective_warning_email (const butl::optional<email_type>& common) const
+ noexcept
+ {
+ return email || warning_email || error_email ? warning_email : common;
+ }
+
+ const butl::optional<email_type>&
+ effective_error_email (const butl::optional<email_type>& common) const
+ noexcept
+ {
+ return email || warning_email || error_email ? error_email : common;
+ }
};
enum class test_dependency_type
@@ -1330,14 +1362,15 @@ namespace bpkg
// {builds, build-{include,exclude}}
// {*-builds, *-build-{include,exclude}}
// {*-build-config}
+ // {*-build-*email}
//
// Throw manifest_parsing if the configuration specified by the build
- // package configuration-specific build constraints group value overrides
- // doesn't exists. In contrast, for the build config override add a new
- // configuration if it doesn't exist and update the arguments of the
- // existing configuration otherwise. In the former case, all the potential
- // build constraints overrides for such a newly added configuration must
- // follow the respective *-build-config override.
+ // package configuration-specific build constraints or emails group value
+ // overrides doesn't exists. In contrast, for the build config override
+ // add a new configuration if it doesn't exist and update the arguments of
+ // the existing configuration otherwise. In the former case, all the
+ // potential build constraints and emails overrides for such a newly added
+ // configuration must follow the respective *-build-config override.
//
// Note that the build constraints group values (both common and build
// config-specific) are overridden hierarchically so that the
@@ -1351,6 +1384,15 @@ namespace bpkg
// constraints are overridden, then for the remaining configs the build
// constraints are reset to `builds: none`.
//
+ // Similar to the build constraints groups, the common and build
+ // config-specific build emails group value overrides are mutually
+ // exclusive. If the common build emails are overridden, then all the
+ // build config-specific emails are reset to nullopt. Otherwise, if some
+ // build config-specific emails are overridden, then for the remaining
+ // configs the email is reset to the empty value and the warning and error
+ // emails are reset to nullopt (which effectively disables email
+ // notifications for such configurations).
+ //
// If a non-empty source name is specified, then the specified values are
// assumed to also include the line/column information and the possibly
// thrown manifest_parsing exception will contain the invalid value's