aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
authorras0219 <533828+ras0219@users.noreply.github.com>2020-11-13 12:30:31 -0800
committerGitHub <noreply@github.com>2020-11-13 14:30:31 -0600
commit783763162901f32e6d6270aede22519844b8e9ce (patch)
treef955936fbd922a39aefba8faec6a40a0384d89c5 /toolsrc/include
parent1d8755cb409f655d5135472970d1da0ce975681b (diff)
downloadvcpkg-783763162901f32e6d6270aede22519844b8e9ce.tar.gz
vcpkg-783763162901f32e6d6270aede22519844b8e9ce.zip
[vcpkg] Implement constraints and overrides in manifests (#14183)
* [vcpkg] Implement constraints in manifests * [vcpkg] Add SourceControlFile::check_against_feature_flags to prevent accidentally ignoring versioning fields * [vcpkg] Switch check_against_feature_flags to accept fs::path * [vcpkg] Implement overrides parsing in manifests * [vcpkg] Address CR comments Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/vcpkg/packagespec.h28
-rw-r--r--toolsrc/include/vcpkg/sourceparagraph.h17
-rw-r--r--toolsrc/include/vcpkg/versions.h10
3 files changed, 45 insertions, 10 deletions
diff --git a/toolsrc/include/vcpkg/packagespec.h b/toolsrc/include/vcpkg/packagespec.h
index a362d8068..d45fb0182 100644
--- a/toolsrc/include/vcpkg/packagespec.h
+++ b/toolsrc/include/vcpkg/packagespec.h
@@ -6,6 +6,7 @@
#include <vcpkg/platform-expression.h>
#include <vcpkg/triplet.h>
+#include <vcpkg/versions.h>
namespace vcpkg::Parse
{
@@ -133,11 +134,25 @@ namespace vcpkg
static ExpectedS<Features> from_string(const std::string& input);
};
+ struct DependencyConstraint
+ {
+ Versions::Constraint::Type type = Versions::Constraint::Type::None;
+ std::string value;
+ int port_version = 0;
+
+ friend bool operator==(const DependencyConstraint& lhs, const DependencyConstraint& rhs);
+ friend bool operator!=(const DependencyConstraint& lhs, const DependencyConstraint& rhs)
+ {
+ return !(lhs == rhs);
+ }
+ };
+
struct Dependency
{
std::string name;
std::vector<std::string> features;
PlatformExpression::Expr platform;
+ DependencyConstraint constraint;
Json::Object extra_info;
@@ -145,6 +160,19 @@ namespace vcpkg
friend bool operator!=(const Dependency& lhs, const Dependency& rhs) { return !(lhs == rhs); }
};
+ struct DependencyOverride
+ {
+ std::string name;
+ Versions::Scheme version_scheme = Versions::Scheme::String;
+ std::string version;
+ int port_version = 0;
+
+ Json::Object extra_info;
+
+ friend bool operator==(const DependencyOverride& lhs, const DependencyOverride& rhs);
+ friend bool operator!=(const DependencyOverride& lhs, const DependencyOverride& rhs) { return !(lhs == rhs); }
+ };
+
struct ParsedQualifiedSpecifier
{
std::string name;
diff --git a/toolsrc/include/vcpkg/sourceparagraph.h b/toolsrc/include/vcpkg/sourceparagraph.h
index d88c0b0fd..2152e0237 100644
--- a/toolsrc/include/vcpkg/sourceparagraph.h
+++ b/toolsrc/include/vcpkg/sourceparagraph.h
@@ -2,6 +2,8 @@
#include <vcpkg/base/fwd/json.h>
+#include <vcpkg/fwd/vcpkgcmdarguments.h>
+
#include <vcpkg/base/expected.h>
#include <vcpkg/base/span.h>
#include <vcpkg/base/system.h>
@@ -63,6 +65,7 @@ namespace vcpkg
std::string homepage;
std::string documentation;
std::vector<Dependency> dependencies;
+ std::vector<DependencyOverride> overrides;
std::vector<std::string> default_features;
std::string license; // SPDX license expression
@@ -80,16 +83,7 @@ namespace vcpkg
/// </summary>
struct SourceControlFile
{
- SourceControlFile clone() const
- {
- SourceControlFile ret;
- ret.core_paragraph = std::make_unique<SourceParagraph>(*core_paragraph);
- for (const auto& feat_ptr : feature_paragraphs)
- {
- ret.feature_paragraphs.push_back(std::make_unique<FeatureParagraph>(*feat_ptr));
- }
- return ret;
- }
+ SourceControlFile clone() const;
static Parse::ParseExpected<SourceControlFile> parse_manifest_object(const std::string& origin,
const Json::Object& object);
@@ -107,6 +101,9 @@ namespace vcpkg
Optional<const FeatureParagraph&> find_feature(const std::string& featurename) const;
Optional<const std::vector<Dependency>&> find_dependencies_for_feature(const std::string& featurename) const;
+ Optional<std::string> check_against_feature_flags(const fs::path& origin,
+ const FeatureFlagSettings& flags) const;
+
friend bool operator==(const SourceControlFile& lhs, const SourceControlFile& rhs);
friend bool operator!=(const SourceControlFile& lhs, const SourceControlFile& rhs) { return !(lhs == rhs); }
};
diff --git a/toolsrc/include/vcpkg/versions.h b/toolsrc/include/vcpkg/versions.h
index 331bf7f8b..55586ddcc 100644
--- a/toolsrc/include/vcpkg/versions.h
+++ b/toolsrc/include/vcpkg/versions.h
@@ -9,4 +9,14 @@ namespace vcpkg::Versions
Date,
String
};
+
+ struct Constraint
+ {
+ enum class Type
+ {
+ None,
+ Minimum,
+ Exact
+ };
+ };
}